diff --git a/config/sync/block.block.erabletheme_leprogramme_2.yml b/config/sync/block.block.erabletheme_leprogramme_2.yml
new file mode 100644
index 0000000..988e9af
--- /dev/null
+++ b/config/sync/block.block.erabletheme_leprogramme_2.yml
@@ -0,0 +1,31 @@
+uuid: fdcecdf1-6b41-44be-9a67-d1bc81a2eab3
+langcode: fr
+status: true
+dependencies:
+ config:
+ - system.menu.le-
+ module:
+ - menu_block
+ theme:
+ - erabletheme
+id: erabletheme_leprogramme_2
+theme: erabletheme
+region: sidebar_first
+weight: 0
+provider: null
+plugin: 'menu_block:le-'
+settings:
+ id: 'menu_block:le-'
+ label: 'Le Programme'
+ label_display: visible
+ provider: menu_block
+ follow: false
+ follow_parent: child
+ label_link: false
+ label_type: block
+ level: 1
+ depth: 0
+ expand_all_items: false
+ parent: 'le-:'
+ suggestion: le_
+visibility: { }
diff --git a/config/sync/block.block.erabletheme_unequestion.yml b/config/sync/block.block.erabletheme_unequestion.yml
index b0cd675..caf544a 100644
--- a/config/sync/block.block.erabletheme_unequestion.yml
+++ b/config/sync/block.block.erabletheme_unequestion.yml
@@ -1,6 +1,6 @@
uuid: 8eb6829e-ca59-4575-9995-09c358c6044e
langcode: fr
-status: true
+status: false
dependencies:
content:
- 'block_content:link:82c97cc5-9a38-42e6-852f-e160d945a338'
diff --git a/config/sync/block.block.erabletheme_votrequestionnexistepas.yml b/config/sync/block.block.erabletheme_votrequestionnexistepas.yml
index 5ca3a15..ff65b2a 100644
--- a/config/sync/block.block.erabletheme_votrequestionnexistepas.yml
+++ b/config/sync/block.block.erabletheme_votrequestionnexistepas.yml
@@ -1,6 +1,6 @@
uuid: 06d94b61-c1be-4382-b4e0-2184f06300c7
langcode: fr
-status: true
+status: false
dependencies:
content:
- 'block_content:link:40c00cc4-49aa-41f8-b27c-3545c6be2982'
diff --git a/config/sync/page_manager.page_variant.home-panels_variant-0.yml b/config/sync/page_manager.page_variant.home-panels_variant-0.yml
index b92cadb..7b97870 100644
--- a/config/sync/page_manager.page_variant.home-panels_variant-0.yml
+++ b/config/sync/page_manager.page_variant.home-panels_variant-0.yml
@@ -46,8 +46,8 @@ variant_settings:
uuid: 42e5f5be-e990-4ced-854c-3f431dbfdcc0
41595e31-d8d6-4940-a1e5-8687c04af5a5:
id: sitesmap_block
- label: 'Sites map Block'
- label_display: '0'
+ label: 'Carte des projets lauréats 2024'
+ label_display: visible
provider: erable_mod
context_mapping: { }
region: content
diff --git a/config/sync/views.view.projets.yml b/config/sync/views.view.projets.yml
index 1873584..10b0eef 100644
--- a/config/sync/views.view.projets.yml
+++ b/config/sync/views.view.projets.yml
@@ -11,6 +11,8 @@ dependencies:
- image.style.medium
- node.type.projet
- system.menu.main
+ content:
+ - 'config_pages:les_projets:7af1760d-0b6b-42ed-8032-76310f6a4eb2'
module:
- image_delta_formatter
- node
@@ -168,12 +170,7 @@ display:
replica: false
query_tags: { }
relationships: { }
- header:
- entity_config_pages:
- id: entity_config_pages
- table: views
- field: entity_config_pages
- plugin_id: entity
+ header: { }
footer: { }
display_extenders: { }
cache_metadata:
@@ -685,8 +682,8 @@ display:
alter:
alter_text: false
text: ''
- make_link: false
- path: ''
+ make_link: true
+ path: '/taxonomy/term/{{ field_th__target_id }}'
absolute: false
external: false
replace_spaces: false
@@ -732,7 +729,7 @@ display:
delta_offset: 0
delta_reversed: false
delta_first_last: false
- multi_type: separator
+ multi_type: ul
separator: ', '
field_api_classes: false
defaults:
@@ -747,8 +744,8 @@ display:
group_type: group
admin_label: ''
plugin_id: entity
- empty: true
- target: b8729588-5a4f-450a-ac00-e472ef8922be
+ empty: false
+ target: 7af1760d-0b6b-42ed-8032-76310f6a4eb2
view_mode: default
tokenize: true
bypass_access: false
diff --git a/web/modules/custom/erable_mod/assets/css/carte-interactive.css b/web/modules/custom/erable_mod/assets/css/carte-interactive.css
index b4736ec..413e4e8 100644
--- a/web/modules/custom/erable_mod/assets/css/carte-interactive.css
+++ b/web/modules/custom/erable_mod/assets/css/carte-interactive.css
@@ -1,7 +1,7 @@
#sites-map-container {
position: relative;
margin: 0 auto;
- max-width: 40vw;
+ width: 100%;
}
#map_base {
diff --git a/web/modules/custom/erable_mod/assets/css/carte-interactive.old.css b/web/modules/custom/erable_mod/assets/css/carte-interactive.old.css
deleted file mode 100644
index 2476ceb..0000000
--- a/web/modules/custom/erable_mod/assets/css/carte-interactive.old.css
+++ /dev/null
@@ -1,91 +0,0 @@
-#sites-map-container {
- text-align: center;
- position: relative;
- width: 100%; /* Prend toute la largeur du conteneur parent */
- max-width: 800px; /* Optionnel : Limiter la largeur maximale */
- margin: 0 auto; /* Centrer le conteneur */
- height: auto; /* Permet à la hauteur de s'ajuster automatiquement */
- @media (max-width: 810px) {
- width: 80%; /* Prend toute la largeur du conteneur parent */
- }
- @media (max-width: 530px) {
- width: 100%; /* Prend toute la largeur du conteneur parent */
- height: 485px;
- }
- @media (max-width: 400px) {
- width: 100%; /* Prend toute la largeur du conteneur parent */
- height: 430px;
- }
-}
-
-
-
-/* Changer la couleur au survol (hover) */
-#sites-map-container .site-link:hover{
- cursor: pointer;
-}
-
-
-/* Styles du popup (caché par défaut) */
-#sites-map-container #popup {
- display: none;
- position: absolute;
- z-index: 1000;
- text-align: left;
- padding-left: 1rem;
- pointer-events: none;
- @media (max-width: 1090px) {
- bottom: 20px;
- }
-
-}
-
-/* Position du popup à droite lorsque l'écran est plus grand que 1090px */
-@media (min-width: 1090px) {
- #sites-map-container #popup {
- top: 50%; /* Centrer verticalement */
- left: 80%; /* Placer le popup à droite de la carte */
- transform: translateY(-50%); /* Ajuster pour centrer verticalement */
- width: 300px;
- }
-}
-
-
-#sites-map-container strong{
- color: #f7002b;
-}
-#sites-map-container a{
- display: none;
- align-items: center;
- color: white;
- background: black;
- text-transform: uppercase;
- font-size: 0.8rem;
- padding-left: 0.5rem;
- text-decoration: none;
- margin-top: 0.7rem;
- height: 1.3rem;
-}
-#sites-map-container a:after{
- display: inline-flex;
- content: url("../img/noun-arrow-to-right.svg");
- padding-right: 0.2rem;
- padding-left: 0.2rem;
-
-}
-
-#popup-content{
- width: 300px;
- padding-right: 30px;
-
- p{
- font-size: 0.7rem;
- }
- @media (max-width : 810px) {
- width: 300px;
- background-color: white;
- border-radius: 5px;
- padding: 0.5rem;
- padding-left: 1rem;
- }
-}
diff --git a/web/modules/custom/erable_mod/assets/js/carte-interactive.js b/web/modules/custom/erable_mod/assets/js/carte-interactive.js
index cfc6ba0..8f9b648 100644
--- a/web/modules/custom/erable_mod/assets/js/carte-interactive.js
+++ b/web/modules/custom/erable_mod/assets/js/carte-interactive.js
@@ -186,7 +186,7 @@ function placeProjectsIcons(projectsIcons) {
const territory = findTerritory(lat, lon);
- console.log(icon.dataset.title, territory);
+ // console.log(icon.dataset.title, territory);
if (territory && localisationMapPlacements[territory]) {
@@ -261,8 +261,11 @@ function hidePopup(){
placeProjectsIcons(projectsIcons);
// debugMapPlacement();
-
-window.addEventListener('resize', placeProjectsIcons(projectsIcons));
+document.addEventListener('DOMContentLoaded', () => {
+ window.addEventListener('resize', () => {
+ placeProjectsIcons(projectsIcons)
+ });
+});
function debugMapPlacement() {
const container = document.querySelector('#sites-map-container');
diff --git a/web/modules/custom/erable_mod/assets/js/carte-interactive.js.old b/web/modules/custom/erable_mod/assets/js/carte-interactive.js.old
deleted file mode 100644
index f288a90..0000000
--- a/web/modules/custom/erable_mod/assets/js/carte-interactive.js.old
+++ /dev/null
@@ -1,115 +0,0 @@
-// // Sélection des éléments principaux
-const svgElement = document.querySelector('#sites-map-container svg');
-const popup = document.querySelector('#sites-map-container #popup');
-const popupContent = document.querySelector('#sites-map-container #popup-content');
-const modalBackground = document.querySelector('#sites-map-container #modal-background');
-
-// Vérifiez si la page contient la classe '.node-type-site'
-const isSitePage = document.body.classList.contains('node-type-site');
-console.log(isSitePage);
-
-
-
-// Fonction pour afficher le popup
-function showPopup(content, x, y, isLeftHalf) {
- // Si on est sur une page avec la classe 'node-type-site', ne pas afficher le popup
- if (isSitePage) return;
-
- popupContent.innerHTML = content;
-
-
- // Afficher le popup et le fond de modal
- popup.style.display = 'block';
- modalBackground.style.display = 'block';
-
-}
-
-// Fonction pour fermer le popup
-function closePopup() {
- popup.style.display = 'none';
- modalBackground.style.display = 'none'; // Désactiver le fond modal
-}
-
-// Gérer le survol des cercles (au lieu du clic)
-svgElement.addEventListener('mouseover', function(event) {
- if (event.target.classList.contains('site-link')) {
- const content = event.target.getAttribute('data-content');
-
- // Afficher le popup avec la position et l'alignement adaptés
- showPopup(content);
- }
-
- // Gestion du changement de couleur sur le cercle
- if (event.target.tagName === 'circle') {
- event.target.setAttribute('fill', 'red');
- }
-});
-
-// Fermer le popup lorsque la souris quitte le cercle
-svgElement.addEventListener('mouseout', function(event) {
- if (event.target.classList.contains('site-link')) {
- closePopup();
- }
-
- // Réinitialiser la couleur du cercle au survol de la souris
- if (event.target.tagName === 'circle') {
- event.target.setAttribute('fill', 'black'); // Remettre en noir
- }
-});
-
-
-// Mettre à jour la logique de calcul des positions
-function recalculateSitePositions() {
- const allSites = document.querySelectorAll('.site-link');
-
- allSites.forEach((site, index) => {
- const geofield = site.getAttribute('data-geofield'); // Assurez-vous que ces attributs sont bien définis
- const lon = parseFloat(geofield.split(',')[0]);
- const lat = parseFloat(geofield.split(',')[1]);
-
- const x = round((lon - lonLeft) / (lonRight - lonLeft) * vp_w);
- const y = round((latTop - lat) / (latTop - latBottom) * vp_h);
-
- site.setAttribute('transform', `translate(${x}, ${y})`);
- });
-}
-
-window.addEventListener('resize', function() {
- recalculateSitePositions();
- if (popup.style.display === 'block') {
- const currentPopupRect = popup.getBoundingClientRect();
- const rect = svgElement.getBoundingClientRect();
- showPopup(popupContent.innerHTML, currentPopupRect.left - rect.left, currentPopupRect.top - rect.top);
- }
-});
-
-// Gérer le clic ou le toucher des cercles
-function handleCircleClick(content) {
- showPopup(content, event.clientX, event.clientY, event.target.getAttribute('data-left-half') === 'true');
-}
-
-// Écouter les événements de clic et de toucher sur le SVG
-svgElement.addEventListener('click', function(event) {
- if (event.target.classList.contains('site-link') || event.target.tagName === 'rect') {
- const content = event.target.getAttribute('data-content');
- handleCircleClick(content);
- }
-});
-
-
-///////////////////// page site point rouge quand sur page ///////////////////////
-
-// Récupérer l'ID de la page depuis la classe du body
-const body = document.querySelector('body');
-const pageId = body.className.match(/node-id-(\d+)/)[1]; // Extraire l'ID de la page
-
-// Sélectionner le groupe SVG qui a l'ID correspondant
-const matchingGroup = document.querySelector(`#site-${pageId}`);
-
-// Si un groupe correspondant est trouvé, changer la couleur du cercle à l'intérieur
-if (matchingGroup) {
- const circle = matchingGroup.querySelector('circle'); // Sélectionner le cercle à l'intérieur du groupe
- if (circle) {
- circle.setAttribute('fill', 'red'); // Changer la couleur du cercle
- }
-}
diff --git a/web/modules/custom/erable_mod/erable_mod.libraries.yml b/web/modules/custom/erable_mod/erable_mod.libraries.yml
index 50a42b1..9544e70 100644
--- a/web/modules/custom/erable_mod/erable_mod.libraries.yml
+++ b/web/modules/custom/erable_mod/erable_mod.libraries.yml
@@ -1,7 +1,6 @@
sites_map_block:
css:
theme:
- assets/css/fontface.scss: {}
assets/css/carte-interactive.css: {}
js:
- assets/js/carte-interactive.js: {}
\ No newline at end of file
+ assets/js/carte-interactive.js: {}
diff --git a/web/modules/custom/erable_mod/erable_mod.module b/web/modules/custom/erable_mod/erable_mod.module
index ee58c18..5c73385 100644
--- a/web/modules/custom/erable_mod/erable_mod.module
+++ b/web/modules/custom/erable_mod/erable_mod.module
@@ -11,7 +11,7 @@
function erable_mod_theme() {
return array(
'svg_mapsites' => array(
- 'variables' => array('vpw' => null, 'vph' => null, 'sites' => []),
+ 'variables' => array('sites' => [], 'intro' => null),
),
);
-}
\ No newline at end of file
+}
diff --git a/web/modules/custom/erable_mod/src/Plugin/Block/SitesMap.php b/web/modules/custom/erable_mod/src/Plugin/Block/SitesMap.php
index 5f0dc7b..db162a1 100644
--- a/web/modules/custom/erable_mod/src/Plugin/Block/SitesMap.php
+++ b/web/modules/custom/erable_mod/src/Plugin/Block/SitesMap.php
@@ -26,6 +26,9 @@ class SitesMap extends BlockBase {
$allSites = \Drupal::entityTypeManager()->getStorage('node')
->loadByProperties(['type' => 'projet', 'status' => 1]);
+ $intro_text = \Drupal::entityTypeManager()->getStorage('config_pages')
+ ->load('2')->get('field_intro')-> value;
+
$sites_paths = "";
foreach($allSites as $index => $site){
@@ -35,11 +38,8 @@ class SitesMap extends BlockBase {
$link_options = ['absolute' => FALSE, 'attributes' => ['class' => 'site-link']];
$site_link_object = Link::createFromRoute("voir le site", 'entity.node.canonical', ['node' => $site->id()], $link_options);
- // $link = $site_link_object->toString()->getGeneratedLink();
$href = $site_link_object->getUrl()->toString();
- // $datacontent = htmlspecialchars("$title
$subtitle
$link");
-
$geofield = $site->get('field_carte')->get(0);
$lon = $geofield->lon;
$lat = $geofield->lat;
@@ -60,6 +60,7 @@ class SitesMap extends BlockBase {
'svg_mapsites' => [
'#theme' => 'svg_mapsites',
'#sites' => $sites_paths,
+ '#intro' => $intro_text,
'#attached' => [
'library' => [
'erable_mod/sites_map_block',
@@ -69,9 +70,6 @@ class SitesMap extends BlockBase {
];
return $return;
- // return [
- // '#markup' => $this->t('Hello, Sites Map!'),
- // ];
}
public function getCacheMaxAge() {
return 0;
diff --git a/web/modules/custom/erable_mod/templates/svg-mapsites.html.twig b/web/modules/custom/erable_mod/templates/svg-mapsites.html.twig
index 8c4d338..e88f0b7 100644
--- a/web/modules/custom/erable_mod/templates/svg-mapsites.html.twig
+++ b/web/modules/custom/erable_mod/templates/svg-mapsites.html.twig
@@ -1,3 +1,6 @@
+
+ {{ intro|raw }}
+
{#