paragraph id

This commit is contained in:
2021-12-10 17:28:32 +01:00
parent 5ddfb22134
commit 5cf232a542
10 changed files with 109 additions and 39 deletions
+13 -7
View File
@@ -150,6 +150,14 @@ a {
width: 100%; } } width: 100%; } }
@media (max-width: 479px) { @media (max-width: 479px) {
#header-top #block-logogouv img {
min-width: 60px;
width: 70%;
height: auto; }
#header-top #block-logoeql img {
min-width: 60px;
width: 80%;
height: auto; }
.path-frontpage .block-region-content .block-views-blockactus-blocks-pages-block-1 .view-actus-blocks-pages .view-content { .path-frontpage .block-region-content .block-views-blockactus-blocks-pages-block-1 .view-actus-blocks-pages .view-content {
display: flex; display: flex;
flex-direction: column; } } flex-direction: column; } }
@@ -706,7 +714,7 @@ a {
text-transform: uppercase; } text-transform: uppercase; }
.node-id-3 { .node-id-3 {
background: url("../images/pictos/carre-contour-bleu_partenaire.svg"); background: url("../images/pictos/carre_site.mp4");
background-repeat: no-repeat; background-repeat: no-repeat;
background-position-y: 7rem; background-position-y: 7rem;
max-width: 100vw; max-width: 100vw;
@@ -1037,15 +1045,13 @@ header {
height: 100%; height: 100%;
align-items: center; } align-items: center; }
#header-top .region-header-top-left #block-logogouv img { #header-top .region-header-top-left #block-logogouv img {
min-width: 80px; width: 80%;
width: 70%;
height: auto; } height: auto; }
#header-top .region-header-top-left #block-logoeql { #header-top .region-header-top-left #block-logoeql {
display: flex; display: flex;
height: 100%; height: 100%;
align-items: center; } align-items: center; }
#header-top .region-header-top-left #block-logoeql img { #header-top .region-header-top-left #block-logoeql img {
min-width: 80px;
width: 80%; width: 80%;
height: auto; } height: auto; }
#header-top .region-header-top-left ul { #header-top .region-header-top-left ul {
@@ -1094,9 +1100,9 @@ header {
display: flex; display: flex;
flex-direction: row-reverse; flex-direction: row-reverse;
margin-bottom: 0; margin-bottom: 0;
min-height: 54px; min-height: 65px;
justify-content: space-around; justify-content: space-around;
min-width: 120%; } width: 120%; }
#header-top #block-socialnetwork-2 p a { #header-top #block-socialnetwork-2 p a {
color: white; color: white;
font-size: 0; } font-size: 0; }
@@ -1105,7 +1111,7 @@ header {
#header-top #block-socialnetwork-2 p .link-twitter { #header-top #block-socialnetwork-2 p .link-twitter {
display: flex; display: flex;
background-color: black; background-color: black;
min-width: 40px; width: 40px;
justify-content: center; justify-content: center;
align-items: end; } align-items: end; }
#header-top #block-socialnetwork-2 p .link-twitter:before { #header-top #block-socialnetwork-2 p .link-twitter:before {
+2 -3
View File
@@ -5,7 +5,6 @@ global-css:
global-js: global-js:
js: js:
scripts/main.js: {} scripts/main.js: {}
dependencies:
# dependencies: - core/jquery
# - core/jquery
+35 -8
View File
@@ -31,13 +31,40 @@ function eql_preprocess_node(&$variables){
// counter pour id // counter pour id
// function eql_preprocess_field(&$variables) { // function eql_preprocess_field(&$variables) {
// static $counter = 0; // // static $counter = 0;
// $variables['counter'] = $counter++;ext // // $variables['counter'] = $counter++;
// } // $variables['elements']['#paragraph']->item_id;
// }
// la fonction suivante ne sert à rien
function eql_preprocess_field(&$variables) {
$paragraph = &$variables['paragraph'];
$variables['attributes']['class'][] = 'paragraph-type-' . $paragraph->id();
$hook_id = $paragraph->get('paragraph-id--')->getString();
$variables['attributes']['class'][] = 'hook-id-' . $hook_id;
}
//might be useful for if-clause: $variables['field_name'] and $variables['field_type']
// if ($paragraph && $paragraph->getEntityTypeId() == 'paragraph' . $paragraph->id() ) {
//whatever logic you need goes here, e.g. something like
//$variables['attributes']['data-from-parent-paragraph'] = $parentEntity->getYourStuff();
// }
// function MYTHEME_preprocess_views_view_fields__view_machine_name(&$vars) {
// static $counter = 0; // function yourtheme_preprocess_field(&$variables, $hook) {
// $vars['counter'] = $counter++; // $element = $variables['element'];
// } // $parentEntity = $element['#object'];
// //might be useful for if-clause: $variables['field_name'] and $variables['field_type']
// if ($parentEntity && $parentEntity->getEntityTypeId() == 'paragraph' ) {
// //whatever logic you need goes here, e.g. something like
// //$variables['attributes']['data-from-parent-paragraph'] = $parentEntity->getYourStuff();
// }
// }
// $variables['elements']['#entity']->item_id;
// function MYTHEME_preprocess_views_view_fields__view_machine_name(&$vars) {
// static $counter = 0;
// $vars['counter'] = $counter++;
// }
Binary file not shown.
+18
View File
@@ -14,6 +14,8 @@ function toggleMenu(event) {
// faq reponse open // faq reponse open
// Attention ouvre toutes les question en même temps
var answers = document.getElementsByClassName("field--name-field-reponse"); var answers = document.getElementsByClassName("field--name-field-reponse");
var questions = document.getElementsByClassName("field--name-field-question"); var questions = document.getElementsByClassName("field--name-field-question");
@@ -31,6 +33,22 @@ function toggleFaq(event) {
answer.classList.toggle('opened');} answer.classList.toggle('opened');}
} }
// fonction pour attribuer la class du parents
var fields = document.getElementsByClassName("field--name-field-titre");
var paragraphs = document.getElementsByClassName("paragraph--type--texte");
for (let i = 0; i < fields.length; i++) {
const field = fields[i]
}
function giveIdParent(){
document.field.classList="paragraphs";
}
// Function mouseOut ()
// {
// document.getelementbyid("flashdiv").classname="flash-I";
// }
// open external link in new window // open external link in new window
// $(".ext").each( // $(".ext").each(
// function(i,e){ // function(i,e){
@@ -47,6 +47,22 @@
@media (max-width: 479px){ @media (max-width: 479px){
#header-top{
#block-logogouv{
img{
min-width: 60px;
width: 70%;
height: auto;
}
}
#block-logoeql{
img{
min-width: 60px;
width: 80%;
height: auto;
}
}
}
.path-frontpage{ .path-frontpage{
.block-region-content{ .block-region-content{
.block-views-blockactus-blocks-pages-block-1{ .block-views-blockactus-blocks-pages-block-1{
+1 -1
View File
@@ -1,6 +1,6 @@
.node-id-3{ .node-id-3{
background: url('../images/pictos/carre-contour-bleu_partenaire.svg'); background: url('../images/pictos/carre_site.mp4');
background-repeat: no-repeat; background-repeat: no-repeat;
background-position-y: 7rem; background-position-y: 7rem;
max-width: 100vw; max-width: 100vw;
@@ -33,15 +33,13 @@ header{
color: $black; color: $black;
font-weight: 800; font-weight: 800;
flex: 1; flex: 1;
// justify-content: space-between;
#block-logogouv{ #block-logogouv{
display: flex; display: flex;
height: 100%; height: 100%;
align-items: center; align-items: center;
img{ img{
min-width: 80px; width: 80%;
width: 70%;
height: auto; height: auto;
} }
} }
@@ -51,7 +49,7 @@ header{
align-items: center; align-items: center;
img{ img{
min-width: 80px; // min-width: 80px;
width: 80%; width: 80%;
height: auto; height: auto;
} }
@@ -68,11 +66,8 @@ header{
flex-direction: column; flex-direction: column;
padding: 1rem; padding: 1rem;
} }
.ul1.sous-liste{
// padding-right: 2rem;
}
li{ li{
// width: 200px;
a { a {
color: $black; color: $black;
} }
@@ -120,29 +115,28 @@ header{
} }
} }
} }
// reseaux sociaux
#block-socialnetwork-2{ #block-socialnetwork-2{
position: relative; position: relative;
top: -33px; top: -33px;
align-self: flex-end; align-self: flex-end;
margin-left: auto; margin-left: auto;
// display: none;
.field--name-body{ .field--name-body{
min-height: 75px; min-height: 75px;
margin-right: 1rem; margin-right: 1rem;
} }
p{ p{
display: flex; display: flex;
flex-direction: row-reverse; flex-direction: row-reverse;
margin-bottom: 0; margin-bottom: 0;
min-height: 54px; min-height: 65px;
justify-content: space-around; justify-content: space-around;
min-width: 120%; width: 120%;
a{ a{
color: $white; color: $white;
font-size: 0; font-size: 0;
// padding-left: 0.5rem;
// padding-right: 0.5rem;
} }
svg.ext{ svg.ext{
display: none; display: none;
@@ -150,7 +144,7 @@ header{
.link-twitter{ .link-twitter{
display: flex; display: flex;
background-color: black; background-color: black;
min-width: 40px; width: 40px;
justify-content: center; justify-content: center;
align-items: end; align-items: end;
&:before{ &:before{
@@ -59,11 +59,18 @@
'first_part_home', 'first_part_home',
] ]
%} %}
{% {# {%
set id_titre = [ set id_titre = [
'id' ~ paragraph_id|clean_id, 'id-' ~ paragraph|clean_id,
'block-' ~ plugin_id|clean_class, 'block-' ~ plugin_id|clean_class,
key.value, key.value,
'id-' ~ counter,
]
%} #}
{%
set id_hook = [
'hook-id-' ~ paragraph.id()|clean_id,
'paragraph-id--' ~ paragraph.id()|clean_id,
] ]
%} %}
@@ -82,7 +89,9 @@
{# <span> {{index}}</span> #} {# <span> {{index}}</span> #}
{# <span id="{{item[key].value }}"></span> #} {# <span id="{{item[key].value }}"></span> #}
{# <span>{{counter}}</span> #} {# <span>{{counter}}</span> #}
<div {{ attributes.addClass(classes, 'field__item').setAttribute('id', id_titre) }}>{{ item.content }}</div> {# <div {{ attributes.addClass(classes, 'field__item') }}>{{ item.content }}</div> #}
<div {{ attributes.addClass(classes, 'field__item').setAttribute('id', id_hook) }}>{{ item.content }}</div>
{# {% endfor %} #} {# {% endfor %} #}
{% endfor %} {% endfor %}
@@ -47,7 +47,8 @@
] ]
%} %}
{% block paragraph %} {% block paragraph %}
<div{{ attributes.addClass(classes) }}> {# <div{{ attributes.addClass(classes) }}> #}
<div{{ attributes.addClass(classes).setAttribute('id', 'paragraph-id--' ~ paragraph.id()) }}>
{% block content %} {% block content %}
{{ content }} {{ content }}
{% endblock %} {% endblock %}