Bachir Soussi Chiadmi 3 years ago
parent
commit
f9645ccd61

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


+ 15 - 0
web/themes/custom/edlptheme/assets/scripts/main.js

@@ -38,6 +38,8 @@
 
       if(_is_mobile){
         initMobile();
+      }else if(drupalSettings.path.isFront){
+        initDesktopHome();
       }
 
       initEvents();
@@ -179,6 +181,19 @@
     //     .parents('.taxonomy-term.vocabulary-entrees.home_mobile').toggleClass(part+'-opened');
     // }
 
+    function initDesktopHome(){
+      console.log('initDesktopHome');
+      // allow multiple prods on home but display only one randomly
+      var $prods = $('.grid .col .node--type-page');
+      $r = Math.floor(Math.random() * $prods.length)
+      $prods.each(function(index) {
+        if(index != $r){
+          $(this).parents('.col').remove();
+        }
+      });
+      console.log('$prods', $prods);
+    }
+
     //  ___             _
     // | __|_ _____ _ _| |_ ___
     // | _|\ V / -_) ' \  _(_-<

+ 6 - 4
web/themes/custom/edlptheme/edlptheme.theme

@@ -110,10 +110,10 @@ function edlptheme_theme_suggestions_taxonomy_term_alter(&$suggestions, $variabl
 
 function edlptheme_preprocess_edlp_home(&$vars){
   // render the promoted_statics and promoted_prods
-  $promoteds = ['statics', 'prods'];
+  // $promoteds = ['statics', 'prods'];
   // dpm($vars);
-  foreach ($promoteds as $index => $p) {
-    foreach($vars['nodes_' . $p] as &$node){
+  // foreach ($promoteds as $index => $p) {
+    foreach($vars['nodes_statics'] as &$node){
       switch($node['vm']){
         case "image_2_columns":
           $cols = 4;
@@ -129,8 +129,10 @@ function edlptheme_preprocess_edlp_home(&$vars){
       };
       $node['cols'] = $cols;
     }
+  // }
+  foreach($vars['nodes_prods'] as &$node){
+    $node['cols'] = 4;
   }
-
 }
 
 function edlptheme_preprocess_taxonomy_term__entrees__mobile_home(&$vars){

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