Sfoglia il codice sorgente

production page can now filter the cospus map

Bachir Soussi Chiadmi 6 anni fa
parent
commit
afac7f57b0

+ 12 - 1
sites/all/modules/figli/edlp_ajax/src/Controller/EdlpAjaxController.php

@@ -176,7 +176,9 @@ class EdlpAjaxController extends ControllerBase {
       'rendered'=> $rendered,
     ];
 
-    // if content type page (productions) get the menu items and linked dates
+    // if content type page (productions) :
+    // -- get the menu items and linked dates
+    // -- get the linked documents for corpus map
     if($this->bundle == "page"){
       $menuLinkManager = \Drupal::service('plugin.manager.menu.link');
       $links = $menuLinkManager->loadLinksByRoute('entity.node.canonical', array('node' => $this->id), 'productions');
@@ -195,6 +197,15 @@ class EdlpAjaxController extends ControllerBase {
         }
       }
       $data['menu_parents'] = $menu_parents;
+
+      // Documents liés
+      $documents_lies = $this->entity->get('field_documents_lies')->getValue();
+      if(count($documents_lies)){
+        foreach ($documents_lies as $key => $field) {
+          $data['documents_lies'][] = $field['target_id'];
+        }
+      }
+
     }
 
     // translations links

+ 41 - 17
sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js

@@ -47,6 +47,8 @@
     var _nodes_centered = [];
     var _nodes_centered_attractions = [];
 
+    var _loaded = false;
+
     var _playlist = [];
 
     var _p_velocity_factor = 0.5;
@@ -63,15 +65,6 @@
     var _ecolors = _settings.colors;
     // Physics
     var _attracter;
-        // _repulser_top,
-        // _repulser_center,
-        // _repulser_bottom,
-        // _scrambler_TL,
-        // _scrambler_TR,
-        // _scrambler_BR,
-        // _scrambler_BL,
-        // _scrambler_CL,
-        // _scrambler_CR;
 
     var check_parts_colid_frq = 2;
     var check_parts_colid_tick = 1;
@@ -109,14 +102,14 @@
       _canvas.height = _scene_props.height*_dpi;
       _ctx.scale(_dpi, _dpi);
 
-
-      if(_nodes.length){
+      if(_loaded){
         for (var i = 0; i < _nodes.length; i++) {
           _nodes[i].onResizeCanvas();
         }
-        // move _attracter and _repulser to the center again
+        // move _attracter and _repulser to their right places again
         resizePhysics();
       }
+
     };
 
     //   ___
@@ -152,6 +145,7 @@
       initEvents();
       checkPreOpenedEntry();
       startAnime();
+      _loaded = true;
     };
 
     //  ___ _           _
@@ -329,8 +323,8 @@
 
         Node.prototype.onResizeCanvas = function(){
           this.calcWallLimits();
+          // TODO: scramble only if not aside or centered
           this.shuffleOriP();
-          // TODO: when canvas is smaller what about nodes hors champs, they are coming back alone but it's too long
         };
 
         Node.prototype.shuffleOriP = function(){
@@ -503,7 +497,7 @@
           this.wall_bouncing_elasticity = 0.15;
         }
         Node.prototype.unsetAside = function(){
-          console.log('unsetAside');
+          // console.log('unsetAside');
           this.aside = false;
           this.ori_p_attract.on = false;
           this.ori_p.position.x = this.ori_pos.x;
@@ -511,6 +505,18 @@
           // this.unFade();
         }
 
+        Node.prototype.resolveNormalPos = function(){
+          // console.log("resolveNormalPos");
+          switch(true){
+            case this.center:
+              this.unsetCentered();
+              break;
+            case this.aside:
+              this.unsetAside();
+              break;
+          }
+        };
+
         Node.prototype.scramble = function(){
           this.scrambling = true;
           this.unsetCentered();
@@ -811,7 +817,8 @@
     // / __| ___ __ _ _ _ __| |_
     // \__ \/ -_) _` | '_/ _| ' \
     // |___/\___\__,_|_| \__|_||_|
-    function filterSearchResults(nids){
+    // and ajax modal content filtering
+    function filterByNids(nids){
       shutDownArticles();
 
       _nodes_centered = [];
@@ -833,6 +840,13 @@
     // \__ \/ _| '_/ _` | '  \| '_ \ | | ' \/ _` |
     // |___/\__|_| \__,_|_|_|_|_.__/_|_|_||_\__, |
     //                                      |___/
+    // function resolveNormalPosAllNodes(){
+    //   console.log('resolveNormalPosAllNodes');
+    //   for (var i = 0; i < _nodes.length; i++) {
+    //     _nodes[i].resolveNormalPos();
+    //   }
+    // };
+
     function scrambleCollection(){
       // console.log('scrambleCollection');
       for (var i = 0; i < _nodes.length; i++) {
@@ -980,6 +994,11 @@
         })
         .on('close-all-entree', function(e){
           closeAllEntries();
+        })
+        .on('scramble-collection', function(e){
+          console.log('scramble-collection', e);
+          // resolveNormalPosAllNodes();
+          scrambleCollection();
         });
 
       _$entrees_block_termlinks.on('click', function(event) {
@@ -1008,10 +1027,15 @@
         .on('chutier-action-done', function(e) {
           _nodes_by_nid[e.target_id].chutier_action = e.new_action;
         })
+        .on('ajax-node-loaded-linked-documents', function(e){
+          console.log("Edlp Corpus, ajax-node-loaded-linked-documents",e.nids);
+          // filter map's nodes
+          filterByNids(e.nids);
+        })
         .on('search-results-loaded', function(e){
           //console.log("Edlp Corpus, search-results-loaded",e.results);
-          // TODO: filter map's nodes
-          filterSearchResults(e.results);
+          // filter map's nodes
+          filterByNids(e.results);
         })
         .on('search-closed', function(e){
           scrambleCollection();

+ 41 - 17
sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js

@@ -47,6 +47,8 @@
     var _nodes_centered = [];
     var _nodes_centered_attractions = [];
 
+    var _loaded = false;
+
     var _playlist = [];
 
     var _p_velocity_factor = 0.5;
@@ -63,15 +65,6 @@
     var _ecolors = _settings.colors;
     // Physics
     var _attracter;
-        // _repulser_top,
-        // _repulser_center,
-        // _repulser_bottom,
-        // _scrambler_TL,
-        // _scrambler_TR,
-        // _scrambler_BR,
-        // _scrambler_BL,
-        // _scrambler_CL,
-        // _scrambler_CR;
 
     var check_parts_colid_frq = 2;
     var check_parts_colid_tick = 1;
@@ -109,14 +102,14 @@
       _canvas.height = _scene_props.height*_dpi;
       _ctx.scale(_dpi, _dpi);
 
-
-      if(_nodes.length){
+      if(_loaded){
         for (var i = 0; i < _nodes.length; i++) {
           _nodes[i].onResizeCanvas();
         }
-        // move _attracter and _repulser to the center again
+        // move _attracter and _repulser to their right places again
         resizePhysics();
       }
+
     };
 
     //   ___
@@ -152,6 +145,7 @@
       initEvents();
       checkPreOpenedEntry();
       startAnime();
+      _loaded = true;
     };
 
     //  ___ _           _
@@ -329,8 +323,8 @@
 
         Node.prototype.onResizeCanvas = function(){
           this.calcWallLimits();
+          // TODO: scramble only if not aside or centered
           this.shuffleOriP();
-          // TODO: when canvas is smaller what about nodes hors champs, they are coming back alone but it's too long
         };
 
         Node.prototype.shuffleOriP = function(){
@@ -503,7 +497,7 @@
           this.wall_bouncing_elasticity = 0.15;
         }
         Node.prototype.unsetAside = function(){
-          console.log('unsetAside');
+          // console.log('unsetAside');
           this.aside = false;
           this.ori_p_attract.on = false;
           this.ori_p.position.x = this.ori_pos.x;
@@ -511,6 +505,18 @@
           // this.unFade();
         }
 
+        Node.prototype.resolveNormalPos = function(){
+          // console.log("resolveNormalPos");
+          switch(true){
+            case this.center:
+              this.unsetCentered();
+              break;
+            case this.aside:
+              this.unsetAside();
+              break;
+          }
+        };
+
         Node.prototype.scramble = function(){
           this.scrambling = true;
           this.unsetCentered();
@@ -811,7 +817,8 @@
     // / __| ___ __ _ _ _ __| |_
     // \__ \/ -_) _` | '_/ _| ' \
     // |___/\___\__,_|_| \__|_||_|
-    function filterSearchResults(nids){
+    // and ajax modal content filtering
+    function filterByNids(nids){
       shutDownArticles();
 
       _nodes_centered = [];
@@ -833,6 +840,13 @@
     // \__ \/ _| '_/ _` | '  \| '_ \ | | ' \/ _` |
     // |___/\__|_| \__,_|_|_|_|_.__/_|_|_||_\__, |
     //                                      |___/
+    // function resolveNormalPosAllNodes(){
+    //   console.log('resolveNormalPosAllNodes');
+    //   for (var i = 0; i < _nodes.length; i++) {
+    //     _nodes[i].resolveNormalPos();
+    //   }
+    // };
+
     function scrambleCollection(){
       // console.log('scrambleCollection');
       for (var i = 0; i < _nodes.length; i++) {
@@ -980,6 +994,11 @@
         })
         .on('close-all-entree', function(e){
           closeAllEntries();
+        })
+        .on('scramble-collection', function(e){
+          console.log('scramble-collection', e);
+          // resolveNormalPosAllNodes();
+          scrambleCollection();
         });
 
       _$entrees_block_termlinks.on('click', function(event) {
@@ -1008,10 +1027,15 @@
         .on('chutier-action-done', function(e) {
           _nodes_by_nid[e.target_id].chutier_action = e.new_action;
         })
+        .on('ajax-node-loaded-linked-documents', function(e){
+          console.log("Edlp Corpus, ajax-node-loaded-linked-documents",e.nids);
+          // filter map's nodes
+          filterByNids(e.nids);
+        })
         .on('search-results-loaded', function(e){
           //console.log("Edlp Corpus, search-results-loaded",e.results);
-          // TODO: filter map's nodes
-          filterSearchResults(e.results);
+          // filter map's nodes
+          filterByNids(e.results);
         })
         .on('search-closed', function(e){
           scrambleCollection();

+ 99 - 59
sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js

@@ -15,6 +15,7 @@
       start:0,
       end:0
     };
+    var _corpus_promise;
 
     //  ___      _ _
     // |_ _|_ _ (_) |_
@@ -23,6 +24,11 @@
     function init(){
       console.log("EdlpTheme init()");
 
+      if(!drupalSettings.path.isFront)
+        return;
+
+      _deferred = initEvents();
+
       _audioPlayer = new AudioPlayer();
       _compoPlayer = new CompoPlayer();
 
@@ -30,11 +36,10 @@
 
       initHistory();
 
-      if(!drupalSettings.path.isFront)
-        return;
-
-      initEvents();
-
+      // if(!drupalSettings.path.isFront)
+      //   return;
+      //
+      // initEvents();
     };
 
     //  ___             _
@@ -42,8 +47,15 @@
     // | _|\ V / -_) ' \  _(_-<
     // |___|\_/\___|_||_\__/__/
     function initEvents(){
+      // https://www.html5rocks.com/en/tutorials/async/deferred/
+      var $corpus_df = $.Deferred();
+      _corpus_promise = $corpus_df.promise();
+
       _$body
-        .on('corpus-map-ready', onCorpusMapReady)
+        .on('corpus-map-ready', function(e){
+          onCorpusMapReady(e);
+          $corpus_df.resolve();
+        })
         .on('on-studio-chutier-updated', initAjaxLinks)
         .on('studio-initialized', function(e){
           _compoPlayer.newCompo();
@@ -247,6 +259,22 @@
           $('a[data-drupal-link-system-path="'+menu_sys_path+'"]').addClass('is-active-trail');
         }
       }
+      // if entity has corpus-map's linked document call a filter to corpus map
+      if(typeof data.documents_lies != 'undefined'){
+        if(_corpus_ready){
+          _$body.trigger({
+            type:'ajax-node-loaded-linked-documents',
+            nids:data.documents_lies
+          });
+        }else{
+          _corpus_promise.done(function(){
+            _$body.trigger({
+              type:'ajax-node-loaded-linked-documents',
+              nids:data.documents_lies
+            });
+          });
+        }
+      }
 
       // if block attached (eg : from edlp_productions module)
       // not used anymore as production block is always present (but not visible)
@@ -378,12 +406,7 @@
       }
       // remove the col
       $col.remove();
-      // if row is empty and we are not in productions or entree notice|index call closeAllModals()
-      if(!$('.col', _$row).length
-        && !_$body.is('.entity-type-node.bundle-page')
-        && !_$body.is('.entity-type-taxonomy_term.bundle-entrees')){
-          backToFrontPage();
-      }
+      checkRowEmpty();
     };
 
     //    _    _            ___ _         _
@@ -625,6 +648,7 @@
     // | (__/ _ \ '_| '_ \ || (_-<
     //  \___\___/_| | .__/\_,_/__/
     //              |_|
+
     function onCorpusMapReady(e){
       //console.log('theme : onCorpusReady', e);
       _corpus_ready = true;
@@ -1335,53 +1359,6 @@
       // }
     };
 
-    //  ___            _   ___
-    // | __| _ ___ _ _| |_| _ \__ _ __ _ ___
-    // | _| '_/ _ \ ' \  _|  _/ _` / _` / -_)
-    // |_||_| \___/_||_\__|_| \__,_\__, \___|
-    //                             |___/
-    function backToFrontPage(pop_state){
-      console.log('backToFrontPage', pop_state);
-      closeAllModals();
-      // assume we are going back to front page
-      $('body').removeClass().addClass('path-frontpage');
-      $('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
-      // close entrees
-      _$corpus_canvas.trigger({'type':'close-all-entree'});
-
-      if(typeof pop_state == "undefined" || !pop_state){
-        console.log('backToFrontPage push state');
-        history.pushState({home:true}, null, drupalSettings.path.baseUrl+drupalSettings.path.currentLanguage);
-      }
-    }
-
-    function initHome(){
-      addCloseModalBtnToCols();
-      // console.log('theme : initHome');
-      // console.log('theme : initProductions');
-      var $grid = $('.grid',_$row).masonry({
-        itemSelector:'.col',
-        columnWidth:'.col-2',
-        horizontalOrder: true,
-        containerStyle: null,
-        // disable initial layout
-        // initLayout: false,
-      });
-      // bind event
-      // $grid.masonry( 'on', 'layoutComplete', function() {
-      //   console.log('layout is complete');
-      // });
-
-      // layout Masonry after each image loads
-      $grid.imagesLoaded().progress( function() {
-        $grid.masonry('layout');
-      });
-
-      $grid.imagesLoaded(function(){
-        $grid.masonry('layout');
-      });
-    }
-
     //  ___             _         _   _
     // | _ \_ _ ___  __| |_  _ __| |_(_)___ _ _  ___
     // |  _/ '_/ _ \/ _` | || / _|  _| / _ \ ' \(_-<
@@ -1434,6 +1411,54 @@
       });
     };
 
+    //  ___            _   ___
+    // | __| _ ___ _ _| |_| _ \__ _ __ _ ___
+    // | _| '_/ _ \ ' \  _|  _/ _` / _` / -_)
+    // |_||_| \___/_||_\__|_| \__,_\__, \___|
+    //                             |___/
+    function backToFrontPage(pop_state){
+      console.log('backToFrontPage', pop_state);
+      closeAllModals();
+      // assume we are going back to front page
+      $('body').removeClass().addClass('path-frontpage');
+      $('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
+      // close entrees
+      _$corpus_canvas.trigger({'type':'close-all-entree'});
+      _$corpus_canvas.trigger({'type':'scramble-collection'});
+
+      if(typeof pop_state == "undefined" || !pop_state){
+        console.log('backToFrontPage push state');
+        history.pushState({home:true}, null, drupalSettings.path.baseUrl+drupalSettings.path.currentLanguage);
+      }
+    }
+
+    function initHome(){
+      addCloseModalBtnToCols();
+      // console.log('theme : initHome');
+      // console.log('theme : initProductions');
+      var $grid = $('.grid',_$row).masonry({
+        itemSelector:'.col',
+        columnWidth:'.col-2',
+        horizontalOrder: true,
+        containerStyle: null,
+        // disable initial layout
+        // initLayout: false,
+      });
+      // bind event
+      // $grid.masonry( 'on', 'layoutComplete', function() {
+      //   console.log('layout is complete');
+      // });
+
+      // layout Masonry after each image loads
+      $grid.imagesLoaded().progress( function() {
+        $grid.masonry('layout');
+      });
+
+      $grid.imagesLoaded(function(){
+        $grid.masonry('layout');
+      });
+    }
+
     //  __  __         _      _
     // |  \/  |___  __| |__ _| |___
     // | |\/| / _ \/ _` / _` | (_-<
@@ -1444,6 +1469,21 @@
       _$row.html('');
       _$ajaxLinks.removeClass('is-active');
       _$body.trigger({'type':'all-modal-closed'});
+      // checkRowEmpty();
+    };
+
+    function checkRowEmpty(){
+      // TODO: remove is-active class from index or notice entree links
+      // if row is empty and we are not in productions or entree notice|index call closeAllModals()
+      if(!$('.col', _$row).length && !_$body.is('.entity-type-taxonomy_term.bundle-entrees')){
+        if(!_$body.is('.entity-type-node.bundle-page')){
+          // we weren't on production or entree, so go back to front page
+          backToFrontPage();
+        }else{
+          // if we were on production page just scramble collection in case of map was filtered
+          _$corpus_canvas.trigger({'type':'scramble-collection'});
+        }
+      }
     };
 
     //  _  _     _

+ 99 - 59
sites/all/themes/custom/edlptheme/assets/scripts/main.js

@@ -15,6 +15,7 @@
       start:0,
       end:0
     };
+    var _corpus_promise;
 
     //  ___      _ _
     // |_ _|_ _ (_) |_
@@ -23,6 +24,11 @@
     function init(){
       console.log("EdlpTheme init()");
 
+      if(!drupalSettings.path.isFront)
+        return;
+
+      _deferred = initEvents();
+
       _audioPlayer = new AudioPlayer();
       _compoPlayer = new CompoPlayer();
 
@@ -30,11 +36,10 @@
 
       initHistory();
 
-      if(!drupalSettings.path.isFront)
-        return;
-
-      initEvents();
-
+      // if(!drupalSettings.path.isFront)
+      //   return;
+      //
+      // initEvents();
     };
 
     //  ___             _
@@ -42,8 +47,15 @@
     // | _|\ V / -_) ' \  _(_-<
     // |___|\_/\___|_||_\__/__/
     function initEvents(){
+      // https://www.html5rocks.com/en/tutorials/async/deferred/
+      var $corpus_df = $.Deferred();
+      _corpus_promise = $corpus_df.promise();
+
       _$body
-        .on('corpus-map-ready', onCorpusMapReady)
+        .on('corpus-map-ready', function(e){
+          onCorpusMapReady(e);
+          $corpus_df.resolve();
+        })
         .on('on-studio-chutier-updated', initAjaxLinks)
         .on('studio-initialized', function(e){
           _compoPlayer.newCompo();
@@ -247,6 +259,22 @@
           $('a[data-drupal-link-system-path="'+menu_sys_path+'"]').addClass('is-active-trail');
         }
       }
+      // if entity has corpus-map's linked document call a filter to corpus map
+      if(typeof data.documents_lies != 'undefined'){
+        if(_corpus_ready){
+          _$body.trigger({
+            type:'ajax-node-loaded-linked-documents',
+            nids:data.documents_lies
+          });
+        }else{
+          _corpus_promise.done(function(){
+            _$body.trigger({
+              type:'ajax-node-loaded-linked-documents',
+              nids:data.documents_lies
+            });
+          });
+        }
+      }
 
       // if block attached (eg : from edlp_productions module)
       // not used anymore as production block is always present (but not visible)
@@ -378,12 +406,7 @@
       }
       // remove the col
       $col.remove();
-      // if row is empty and we are not in productions or entree notice|index call closeAllModals()
-      if(!$('.col', _$row).length
-        && !_$body.is('.entity-type-node.bundle-page')
-        && !_$body.is('.entity-type-taxonomy_term.bundle-entrees')){
-          backToFrontPage();
-      }
+      checkRowEmpty();
     };
 
     //    _    _            ___ _         _
@@ -625,6 +648,7 @@
     // | (__/ _ \ '_| '_ \ || (_-<
     //  \___\___/_| | .__/\_,_/__/
     //              |_|
+
     function onCorpusMapReady(e){
       //console.log('theme : onCorpusReady', e);
       _corpus_ready = true;
@@ -1335,53 +1359,6 @@
       // }
     };
 
-    //  ___            _   ___
-    // | __| _ ___ _ _| |_| _ \__ _ __ _ ___
-    // | _| '_/ _ \ ' \  _|  _/ _` / _` / -_)
-    // |_||_| \___/_||_\__|_| \__,_\__, \___|
-    //                             |___/
-    function backToFrontPage(pop_state){
-      console.log('backToFrontPage', pop_state);
-      closeAllModals();
-      // assume we are going back to front page
-      $('body').removeClass().addClass('path-frontpage');
-      $('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
-      // close entrees
-      _$corpus_canvas.trigger({'type':'close-all-entree'});
-
-      if(typeof pop_state == "undefined" || !pop_state){
-        console.log('backToFrontPage push state');
-        history.pushState({home:true}, null, drupalSettings.path.baseUrl+drupalSettings.path.currentLanguage);
-      }
-    }
-
-    function initHome(){
-      addCloseModalBtnToCols();
-      // console.log('theme : initHome');
-      // console.log('theme : initProductions');
-      var $grid = $('.grid',_$row).masonry({
-        itemSelector:'.col',
-        columnWidth:'.col-2',
-        horizontalOrder: true,
-        containerStyle: null,
-        // disable initial layout
-        // initLayout: false,
-      });
-      // bind event
-      // $grid.masonry( 'on', 'layoutComplete', function() {
-      //   console.log('layout is complete');
-      // });
-
-      // layout Masonry after each image loads
-      $grid.imagesLoaded().progress( function() {
-        $grid.masonry('layout');
-      });
-
-      $grid.imagesLoaded(function(){
-        $grid.masonry('layout');
-      });
-    }
-
     //  ___             _         _   _
     // | _ \_ _ ___  __| |_  _ __| |_(_)___ _ _  ___
     // |  _/ '_/ _ \/ _` | || / _|  _| / _ \ ' \(_-<
@@ -1434,6 +1411,54 @@
       });
     };
 
+    //  ___            _   ___
+    // | __| _ ___ _ _| |_| _ \__ _ __ _ ___
+    // | _| '_/ _ \ ' \  _|  _/ _` / _` / -_)
+    // |_||_| \___/_||_\__|_| \__,_\__, \___|
+    //                             |___/
+    function backToFrontPage(pop_state){
+      console.log('backToFrontPage', pop_state);
+      closeAllModals();
+      // assume we are going back to front page
+      $('body').removeClass().addClass('path-frontpage');
+      $('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
+      // close entrees
+      _$corpus_canvas.trigger({'type':'close-all-entree'});
+      _$corpus_canvas.trigger({'type':'scramble-collection'});
+
+      if(typeof pop_state == "undefined" || !pop_state){
+        console.log('backToFrontPage push state');
+        history.pushState({home:true}, null, drupalSettings.path.baseUrl+drupalSettings.path.currentLanguage);
+      }
+    }
+
+    function initHome(){
+      addCloseModalBtnToCols();
+      // console.log('theme : initHome');
+      // console.log('theme : initProductions');
+      var $grid = $('.grid',_$row).masonry({
+        itemSelector:'.col',
+        columnWidth:'.col-2',
+        horizontalOrder: true,
+        containerStyle: null,
+        // disable initial layout
+        // initLayout: false,
+      });
+      // bind event
+      // $grid.masonry( 'on', 'layoutComplete', function() {
+      //   console.log('layout is complete');
+      // });
+
+      // layout Masonry after each image loads
+      $grid.imagesLoaded().progress( function() {
+        $grid.masonry('layout');
+      });
+
+      $grid.imagesLoaded(function(){
+        $grid.masonry('layout');
+      });
+    }
+
     //  __  __         _      _
     // |  \/  |___  __| |__ _| |___
     // | |\/| / _ \/ _` / _` | (_-<
@@ -1444,6 +1469,21 @@
       _$row.html('');
       _$ajaxLinks.removeClass('is-active');
       _$body.trigger({'type':'all-modal-closed'});
+      // checkRowEmpty();
+    };
+
+    function checkRowEmpty(){
+      // TODO: remove is-active class from index or notice entree links
+      // if row is empty and we are not in productions or entree notice|index call closeAllModals()
+      if(!$('.col', _$row).length && !_$body.is('.entity-type-taxonomy_term.bundle-entrees')){
+        if(!_$body.is('.entity-type-node.bundle-page')){
+          // we weren't on production or entree, so go back to front page
+          backToFrontPage();
+        }else{
+          // if we were on production page just scramble collection in case of map was filtered
+          _$corpus_canvas.trigger({'type':'scramble-collection'});
+        }
+      }
     };
 
     //  _  _     _

+ 3 - 3
sites/default/config/sync/core.entity_view_display.node.evenement.teaser.yml

@@ -27,7 +27,7 @@ content:
     region: content
   field_date:
     type: daterange_custom
-    weight: 2
+    weight: 1
     region: content
     label: hidden
     settings:
@@ -37,14 +37,14 @@ content:
     third_party_settings: {  }
   field_page_liee:
     type: entity_reference_label
-    weight: 1
+    weight: 0
     region: content
     label: hidden
     settings:
       link: false
     third_party_settings: {  }
   links:
-    weight: 0
+    weight: 2
     region: content
     settings: {  }
     third_party_settings: {  }

+ 2 - 9
sites/default/config/sync/core.entity_view_display.node.page.default.yml

@@ -30,14 +30,6 @@ content:
     settings: {  }
     third_party_settings: {  }
     region: content
-  field_documents_lies:
-    weight: 4
-    label: above
-    settings:
-      link: true
-    third_party_settings: {  }
-    type: entity_reference_label
-    region: content
   field_son:
     weight: 2
     label: hidden
@@ -61,12 +53,13 @@ content:
     settings: {  }
     third_party_settings: {  }
   production_subtree:
-    weight: 5
+    weight: 4
     region: content
     settings: {  }
     third_party_settings: {  }
 hidden:
   field_afficher_en_page_d_acceuil: true
+  field_documents_lies: true
   field_page_type: true
   field_view_mode: true
   field_workflow_generic: true