carte interactive sur page node projet
This commit is contained in:
@@ -9,6 +9,7 @@ const isHomePage = document.querySelector('main#home') !== null;
|
||||
const isLessitesPage = document.querySelector('div#lessites') !== null;
|
||||
const isNodeTypeSitePage = document.body.classList.contains('node-type-site');
|
||||
const isCandidaturePage = document.querySelector('main#pour_candidater') !== null;
|
||||
const isNodeTypeProjetPage = document.body.classList.contains('node-type-projet');
|
||||
|
||||
// Identifier le cercle de la page courante pour node-type-site
|
||||
let currentPageCircle = null;
|
||||
@@ -25,6 +26,30 @@ if (isNodeTypeSitePage) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Identifier le cercle du SITE lié quand on est sur une page node-type-projet
|
||||
if (isNodeTypeProjetPage && svgElement) {
|
||||
// On récupère le lien vers le site lié dans le bloc "Site lié"
|
||||
const linkedSiteLink = document.querySelector('.field_field_site_projet article.node-type-site a[href*="/sites/"]');
|
||||
|
||||
if (linkedSiteLink) {
|
||||
// On normalise le chemin (sans domaine) de l'URL du site
|
||||
const sitePath = new URL(linkedSiteLink.getAttribute('href'), window.location.origin).pathname;
|
||||
|
||||
// On cherche le cercle dont le data-url pointe vers le même site
|
||||
const correspondingCircle = Array.from(svgElement.querySelectorAll('circle.site-link')).find(circle => {
|
||||
const circleUrl = circle.getAttribute('data-url');
|
||||
if (!circleUrl) return false;
|
||||
|
||||
const circlePath = new URL(circleUrl, window.location.origin).pathname;
|
||||
return circlePath === sitePath;
|
||||
});
|
||||
|
||||
if (correspondingCircle) {
|
||||
currentPageCircle = correspondingCircle;
|
||||
currentPageCircle.setAttribute('fill', 'red'); // Met en rouge le cercle du site lié
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Fonction pour afficher le popup
|
||||
@@ -123,6 +148,14 @@ svgElement.addEventListener('click', function(event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isNodeTypeProjetPage) {
|
||||
if (event.target.classList.contains('site-link')) {
|
||||
const targetUrl = event.target.getAttribute('data-url');
|
||||
if (targetUrl) {
|
||||
window.location.href = targetUrl; // Redirige vers le data-url correspondant
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Fonction pour gérer l'agrandissement de views-row au survol des cercles
|
||||
|
||||
@@ -4337,6 +4337,7 @@ body {
|
||||
}
|
||||
.node-type-projet .layout--threecol-25-50-25 .layout__region--first .block-region-first .field_field_site_projet .node-type-site .more-link {
|
||||
width: fit-content;
|
||||
display: inline-flex;
|
||||
background: black;
|
||||
}
|
||||
@media (max-width: 810px) {
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
}
|
||||
.more-link{
|
||||
width: fit-content;
|
||||
display: inline-flex;
|
||||
// padding-left: 0.5rem;
|
||||
background: black;
|
||||
@media (max-width:810px) {
|
||||
|
||||
Reference in New Issue
Block a user