code postaux en code de départements (5 chiffres à 2) + changement du get le nid dans la liste étape à droite

This commit is contained in:
Valentin 2024-10-11 16:33:41 +02:00
parent 5106413b4d
commit 8b922fe40a
6 changed files with 38 additions and 20 deletions

View File

@ -348,7 +348,7 @@ display:
entity_field: nid entity_field: nid
plugin_id: field plugin_id: field
label: '' label: ''
exclude: true exclude: false
alter: alter:
alter_text: false alter_text: false
text: '' text: ''

View File

@ -117,19 +117,11 @@ import router from './router/router';
function processEtapeLinks(store, map) { function processEtapeLinks(store, map) {
let etape_li = document.querySelectorAll('#etapes-liste li'); let etape_li = document.querySelectorAll('#etapes-liste li');
etape_li.forEach((li) => { etape_li.forEach((li) => {
let field = li.querySelector('div.views-field-title'); let nidElement = li.querySelector('.views-field-nid');
let nid = null; let nid = nidElement.innerText;
let classList = field.classList;
classList.forEach((classe) => {
let reg = /data-node-(\d+)/;
let result = classe.match(reg);
if (result) {
nid = result[1];
}
})
if (nid) { if (nid) {
let a = field.querySelector('a'); let a = li.querySelector('a');
a.setAttribute('data-node-nid', nid); a.setAttribute('data-node-nid', nid);
li.addEventListener('click', (e) => onClickContentLink(e, store, map, 'etape')); li.addEventListener('click', (e) => onClickContentLink(e, store, map, 'etape'));
} }

View File

@ -13,7 +13,7 @@
<div class="locality"> <div class="locality">
<div class="top-triangle"></div> <div class="top-triangle"></div>
<div class="locality-title"> <div class="locality-title">
<h1>{{content.title}} <em v-if="content.adresse">({{ content.adresse.postal_code }})</em></h1> <h1>{{content.title}} <em v-if="content.adresse">({{ content.adresse.postal_code.slice(0, 2) }})</em></h1>
</div> </div>
</div> </div>
</header> </header>

View File

@ -312,7 +312,7 @@ body{
} }
} }
.leaflet-tooltip-pane { .leaflet-tooltip-pane {
width: 20vw; width: 25vw;
pointer-events: none; pointer-events: none;
> div { > div {
padding: 0; padding: 0;
@ -326,7 +326,7 @@ body{
max-height: 15vh; max-height: 15vh;
overflow: hidden; overflow: hidden;
display: grid; display: grid;
grid-template-columns: minmax(10px, 10vw) 10vw; grid-template-columns: minmax(10px, 12.5vw) 12.5vw;
grid-template-rows: 1.5fr 0.5fr; grid-template-rows: 1.5fr 0.5fr;
transform: translateY(-60%); transform: translateY(-60%);
background-color: white; background-color: white;
@ -337,10 +337,11 @@ body{
grid-row: 1 / span 1; grid-row: 1 / span 1;
font-family: 'Joost', sans-serif; font-family: 'Joost', sans-serif;
font-size: $m-font-size; font-size: $m-font-size;
display: flex; /* display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
*/
padding-top: 10px; padding-top: 10px;
padding-left: 20px; padding-left: 20px;
padding-right: 20px; padding-right: 20px;
@ -349,7 +350,10 @@ body{
font-weight: bold; font-weight: bold;
text-decoration: none; text-decoration: none;
color: $main-color; color: $main-color;
padding-right: 10px; padding-right: 5px;
> span {
font-weight: lighter;
}
} }
} }
> div:nth-of-type(2) { > div:nth-of-type(2) {
@ -500,6 +504,9 @@ body{
p { p {
margin: 0; margin: 0;
} }
> .views-field-nid {
display: none;
}
> .views-field-title { > .views-field-title {
grid-column: 1 / span 1; grid-column: 1 / span 1;
grid-row: 1 / span 1; grid-row: 1 / span 1;

View File

@ -20,4 +20,12 @@
* @ingroup themeable * @ingroup themeable
*/ */
#} #}
<p>{{- output -}}</p> {% if output|length == 5
and output|replace(
{'0':'', '1':'', '2':'', '3':'', '4':'', '5':'', '6':'', '7':'', '8':'', '9':''}
) == ''
%}
<p>{{- output|slice(0, 2) -}}</p>
{% else %}
<p>{{- output -}}</p>
{% endif %}

View File

@ -24,9 +24,20 @@
{% if output %} {% if output %}
{% set separated_contents = output|split('\n') %} {% set separated_contents = output|split('\n') %}
{% for content in separated_contents %} {% for content in separated_contents %}
{% if (content|trim ends with ')') %}
{% if content != '' %}
<div class="separated-content">
{{ content|trim|slice(0, -12) }}
<span>{{ content|trim|slice(-7, content|trim|length - 1)|slice(0, -4) }})</span></a>
</div>
{% endif %}
{% else %}
{% if content != '' %} {% if content != '' %}
<div class="separated-content">{{ content|trim }}</div> <div class="separated-content">{{ content|trim }}</div>
{% endif %} {% endif %}
{% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</div </div