Browse Source

.is-active type media

ouidade 1 week ago
parent
commit
ca49778787

File diff suppressed because it is too large
+ 7 - 1
web/themes/custom/eql/dist/assets/css/bundle.css


+ 7 - 4
web/themes/custom/eql/eql.theme

@@ -277,6 +277,7 @@ function eql_preprocess_views_view_unformatted(array &$variables) {
 }
 }
 
 
 
 
+
 function eql_preprocess_form(&$variables) {
 function eql_preprocess_form(&$variables) {
   $terms = \Drupal::entityTypeManager()
   $terms = \Drupal::entityTypeManager()
     ->getStorage('taxonomy_term')
     ->getStorage('taxonomy_term')
@@ -285,14 +286,19 @@ function eql_preprocess_form(&$variables) {
   $transliterator = \Drupal::service('transliteration');
   $transliterator = \Drupal::service('transliteration');
   $media_links = [];
   $media_links = [];
 
 
+  // Récupère la valeur actuelle du filtre dans l’URL
+  $request = \Drupal::request();
+  $active_tid = $request->query->get('field_type_de_media_target_id');
+
   foreach ($terms as $term) {
   foreach ($terms as $term) {
-    $slug = strtolower($transliterator->transliterate($term->name));
+    $slug = Html::cleanCssIdentifier(strtolower($transliterator->transliterate($term->name)));
     $slug = Html::cleanCssIdentifier($slug); // Nettoie pour CSS
     $slug = Html::cleanCssIdentifier($slug); // Nettoie pour CSS
 
 
     $media_links[] = [
     $media_links[] = [
       'tid' => $term->tid,
       'tid' => $term->tid,
       'label' => $term->name,
       'label' => $term->name,
       'slug' => $slug,
       'slug' => $slug,
+      'active' => (string)$term->tid === $active_tid, // <-- True si c'est celui sélectionné
     ];
     ];
   }
   }
 
 
@@ -305,6 +311,3 @@ function eql_preprocess_form(&$variables) {
 
 
 
 
 
 
-
-
-

+ 61 - 1
web/themes/custom/eql/scss/pages/ressources.scss

@@ -158,6 +158,14 @@
                                                     padding-bottom: 1rem;
                                                     padding-bottom: 1rem;
                                                 }
                                                 }
                                             }
                                             }
+                                            button.is-active {
+                                                background-color: $blue-dark;
+                                                color: white;
+                                              
+                                                a {
+                                                  color: white;
+                                                }
+                                              }
                                             button{
                                             button{
                                                 background-color: transparent;
                                                 background-color: transparent;
                                                 // border-radius: 30px;
                                                 // border-radius: 30px;
@@ -170,6 +178,7 @@
                                                     background-color: $blue-dark;
                                                     background-color: $blue-dark;
                                                     color: white;
                                                     color: white;
                                                 }
                                                 }
+                                           
                                                 a {
                                                 a {
                                                     color: $blue-dark;
                                                     color: $blue-dark;
                                                     display: inline-flex;
                                                     display: inline-flex;
@@ -190,9 +199,11 @@
                                                         content:url("../images/pictos/videos.svg");
                                                         content:url("../images/pictos/videos.svg");
                                                         padding-right: 0.5rem;
                                                         padding-right: 0.5rem;
                                                         }
                                                         }
-                                                        &:hover::before{
+                                                        &:hover::before,
+                                                        .is-active &::before{
                                                             content:url("../images/pictos/videos-blanc.svg");
                                                             content:url("../images/pictos/videos-blanc.svg");
                                                         }
                                                         }
+                                                       
                                                     }
                                                     }
                                                 }
                                                 }
                                                 &.button-podcasts{
                                                 &.button-podcasts{
@@ -250,6 +261,55 @@
                                                         }
                                                         }
                                                     }
                                                     }
                                                 }
                                                 }
+
+
+                                            }
+                                            button.is-active{
+                                                &.button-videos{
+                                                    margin-top: 1rem;
+                                                    a {
+                                                         &::before,
+                                                        .is-active &::before{
+                                                            content:url("../images/pictos/videos-blanc.svg");
+                                                        }
+                                                       
+                                                    }
+                                                }
+                                                &.button-podcasts{
+                                                    a {
+                                                        &::before{
+                                                            content:url("../images/pictos/podcasts-blanc.svg");
+                                                        }
+                                                    }
+                                                }
+                                                &.button-reportage-photos{
+                                                    a {
+                                                        &::before{
+                                                            content:url("../images/pictos/en-images-blanc.svg");
+                                                        }
+                                                    }
+                                                }
+                                                &.button-livres{
+                                                    a {
+                                                        &::before{
+                                                            content:url("../images/pictos/ecrits-blanc.svg");
+                                                        }
+                                                    }
+                                                }
+                                                &.button-articles{
+                                                    a {
+                                                        &::before{
+                                                            content:url("../images/pictos/ecrits-blanc.svg");
+                                                        }
+                                                    }
+                                                }
+                                                &.button-publications---rapports{
+                                                    a {
+                                                        &::before{
+                                                            content:url("../images/pictos/ecrits-blanc.svg");
+                                                        }
+                                                    }
+                                                }
                                             }
                                             }
                                         }
                                         }
                                         form{
                                         form{

+ 2 - 2
web/themes/custom/eql/templates/partials/form.html.twig

@@ -24,10 +24,10 @@
    <button class="button-publications-rapports" type="button" style=""><a href="https://stage.eql.figli.io/ressources?field_type_de_media_target_id=696&field_type_de_ressource_target_id=All&field_mots_clefs_target_id=All&field_date_de_parution_value=&combine="> Publications/rapports</a></button>
    <button class="button-publications-rapports" type="button" style=""><a href="https://stage.eql.figli.io/ressources?field_type_de_media_target_id=696&field_type_de_ressource_target_id=All&field_mots_clefs_target_id=All&field_date_de_parution_value=&combine="> Publications/rapports</a></button>
 </div> #}
 </div> #}
 
 
-<div class="buttons-filtres-ressources">
 
 
+<div class="buttons-filtres-ressources">
   {% for item in media_links %}
   {% for item in media_links %}
-    <button class="button-{{ item.slug }}" type="button">
+    <button class="button-{{ item.slug }}{% if item.active %} is-active{% endif %}" type="button">
       <a href="{{ path('<front>') ~ 'ressources?field_type_de_media_target_id=' ~ item.tid ~ '&field_type_de_ressource_target_id=All&field_mots_clefs_target_id=All&field_date_de_parution_value=&combine=' }}">
       <a href="{{ path('<front>') ~ 'ressources?field_type_de_media_target_id=' ~ item.tid ~ '&field_type_de_ressource_target_id=All&field_mots_clefs_target_id=All&field_date_de_parution_value=&combine=' }}">
         {{ item.label }}
         {{ item.label }}
       </a>
       </a>

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