Browse Source

fixed back to home mobile #423

Bachir Soussi Chiadmi 3 years ago
parent
commit
11d54412cd

File diff suppressed because it is too large
+ 0 - 0
web/themes/custom/edlptheme/assets/dist/scripts/main.min.js


+ 24 - 18
web/themes/custom/edlptheme/assets/scripts/main.js

@@ -829,7 +829,7 @@
       }
     };
     function onHistoryPopState(e){
-      console.log('onPopState',e.state);
+      console.log('onHistoryPopState',e.state);
       if(e.state.home){
         backToFrontPage(true);
       }
@@ -2247,25 +2247,31 @@
     //                             |___/
     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
-      if(_corpus_ready){
-        _$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');
-        state = {
-          home:true,
-          context:"home",
-          caller:null
+      if(!_is_mobile){
+        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
+        if(_corpus_ready){
+          _$corpus_canvas.trigger({'type':'close-all-entree'});
+          _$corpus_canvas.trigger({'type':'scramble-collection'});
         }
-        _states_history.unshift(state);
-        history.pushState(state, null, _base_url+drupalSettings.path.currentLanguage);
+
+        if(typeof pop_state == "undefined" || !pop_state){
+          console.log('backToFrontPage push state');
+          state = {
+            home:true,
+            context:"home",
+            caller:null
+          }
+          _states_history.unshift(state);
+          history.pushState(state, null, _base_url+drupalSettings.path.currentLanguage);
+        }
+      }else{
+        // if mobile reload the front page
+        ajaxLoadContent({home: true, ajax_path: 'home_m/ajax', sys_path: 'frontpage'});
       }
     }
 

Some files were not shown because too many files changed in this diff