Parcourir la source

home sections labels link made active

bach il y a 2 ans
Parent
commit
81eb01d101

+ 1 - 1
config/sync/core.entity_view_display.node.frontpage.home_light.yml

@@ -255,7 +255,7 @@ content:
     region: content
     label: hidden
     settings:
-      link: true
+      link: false
     third_party_settings: {  }
   field_a_database:
     weight: 6

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
web/themes/custom/materiotheme/assets/dist/main.css


BIN
web/themes/custom/materiotheme/assets/dist/main.css.gz


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
web/themes/custom/materiotheme/assets/dist/main.js


BIN
web/themes/custom/materiotheme/assets/dist/main.js.gz


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
web/themes/custom/materiotheme/assets/dist/report.html


+ 3 - 3
web/themes/custom/materiotheme/assets/styles/main.scss

@@ -951,9 +951,9 @@ article.node--type-frontpage{
         background-color: $color-base;
         @extend %part-columned-layout;
         .field--name-field-a-database{
-          .field__label{
-            cursor: pointer;
-          }
+          // .field__label{
+          //   cursor: pointer;
+          // }
         }
         .field--name-field-database-links{
           .field__item{

+ 21 - 0
web/themes/custom/materiotheme/materiotheme.theme

@@ -331,3 +331,24 @@ function materiotheme_preprocess_printable(array &$variables) {
 //     $variables['attributes']['src'] = '/themes/custom/materiotheme/assets/img/blank.gif';
 //   }
 // }
+
+
+function materiotheme_preprocess_field__node__field_a_database__frontpage(array &$variables) {
+  if ($variables['logged_in']) {
+    $variables['label_link'] = array(
+      "href" => '/' . $variables['element']['#language'] . '/base'
+    );
+  }
+}
+
+function materiotheme_preprocess_field__node__field_blabla__frontpage(array &$variables) {
+  $variables['label_link'] = array(
+    "href" => '/' . $variables['element']['#language'] . '/blabla'
+  );
+}
+
+function materiotheme_preprocess_field__node__field_showrooms__frontpage(array &$variables) {
+  $variables['label_link'] = array(
+    "href" => '/' . $variables['element']['#language'] . '/showrooms'
+  );
+}

+ 9 - 1
web/themes/custom/materiotheme/templates/content/field--node--field-a-database--frontpage.html.twig

@@ -67,7 +67,15 @@
   {% endif %}
 {% else %}
   <div{{ attributes.addClass(classes) }}>
-    <div{{ title_attributes.addClass(title_classes) }} @click.prevent="onClickFieldLabel($event, 'database')">{{ label }}</div>
+    <div{{ title_attributes.addClass(title_classes) }}>
+      {% if label_link %}
+        <a href="{{ label_link.href }}" @click.prevent="onClickLink">
+          {{ label }}
+        </a>
+      {% else %}
+        {{ label }}
+      {% endif %}
+    </div>
     {% if multiple %}
       <div class="field__items">
     {% endif %}

+ 6 - 2
web/themes/custom/materiotheme/templates/content/field--node--field-blabla--frontpage.html.twig

@@ -68,9 +68,13 @@
 {% else %}
   <div{{ attributes.addClass(classes) }}>
     <div{{ title_attributes.addClass(title_classes) }}>
-      <a href="/blabla" @click.prevent="onClickLink">
+      {% if label_link %}
+        <a href="{{ label_link.href }}" @click.prevent="onClickLink">
+          {{ label }}
+        </a>
+      {% else %}
         {{ label }}
-      </a>
+      {% endif %}
     </div>
     {% if multiple %}
       <div class="field__items">

+ 6 - 2
web/themes/custom/materiotheme/templates/content/field--node--field-showrooms--frontpage.html.twig

@@ -68,9 +68,13 @@
 {% else %}
   <div{{ attributes.addClass(classes) }}>
     <div{{ title_attributes.addClass(title_classes) }}>
-      <a href="/showrooms" @click.prevent="onClickLink">
+      {% if label_link %}
+        <a href="{{ label_link.href }}" @click.prevent="onClickLink">
+          {{ label }}
+        </a>
+      {% else %}
         {{ label }}
-      </a>
+      {% endif %}
     </div>
     {% if multiple %}
       <div class="field__items">

+ 4 - 3
web/themes/custom/materiotheme/vuejs/components/Pages/Home.vue

@@ -149,7 +149,7 @@ export default {
           }
         } else {
           // find existing router route compared with link href
-          let pathbase = target.pathname.match(/^(\/\w{2}\/[^\/]+)\/.*/i)
+          let pathbase = target.pathname.match(/^(\/\w{2}\/[^\/]+)\/?.*/i)
           console.log('pathbase', pathbase)
 
           for (let i = 0; i < this.$router.options.routes.length; i++) {
@@ -175,8 +175,9 @@ export default {
         }
       }
     },
-    onClickFieldLabel(e){
-      console.log("onClickFieldLabel", e, this.$router, this.$route)
+    onClickFieldLabel(e, part){
+      console.log("onClickFieldLabel", part, e, this.$router, this.$route)
+
     }
   },
   watch: {

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff