home sections labels link made active

This commit is contained in:
Bachir Soussi Chiadmi 2021-06-10 19:45:30 +02:00
parent 27ece7a12c
commit 81eb01d101
12 changed files with 54 additions and 16 deletions

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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{

View File

@ -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'
);
}

View File

@ -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 %}

View File

@ -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 }}
{% endif %}
</div>
{% if multiple %}
<div class="field__items">

View File

@ -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 }}
{% endif %}
</div>
{% if multiple %}
<div class="field__items">

View File

@ -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: {