Compare commits

...

3 Commits

18 changed files with 519 additions and 679 deletions

190
composer.lock generated
View File

@ -2369,17 +2369,17 @@
},
{
"name": "drupal/block_class",
"version": "3.0.0",
"version": "2.0.12",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/block_class.git",
"reference": "3.0.0"
"reference": "2.0.12"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/block_class-3.0.0.zip",
"reference": "3.0.0",
"shasum": "41993c9ee6b925ec30e927cb557bafd9d5c05461"
"url": "https://ftp.drupal.org/files/projects/block_class-2.0.12.zip",
"reference": "2.0.12",
"shasum": "cc3945f8038bcc9bb48eff897df332aa952d62e6"
},
"require": {
"drupal/core": "^9 || ^10 || ^11"
@ -2387,8 +2387,8 @@
"type": "drupal-module",
"extra": {
"drupal": {
"version": "3.0.0",
"datestamp": "1723241676",
"version": "2.0.12",
"datestamp": "1723243074",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
@ -2692,30 +2692,27 @@
},
{
"name": "drupal/config_ignore",
"version": "3.3.0",
"version": "2.4.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/config_ignore.git",
"reference": "8.x-3.3"
"reference": "8.x-2.4"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/config_ignore-8.x-3.3.zip",
"reference": "8.x-3.3",
"shasum": "4446811ecb023820a57c227d35c034e0d4363a70"
"url": "https://ftp.drupal.org/files/projects/config_ignore-8.x-2.4.zip",
"reference": "8.x-2.4",
"shasum": "e0e45dde2d6927c5d26de59f352792fb6cf26554"
},
"require": {
"drupal/core": "^8.8 || ^9 || ^10 || ^11"
},
"require-dev": {
"drupal/config_filter": "^1.8||^2.2",
"drush/drush": "^10 || ^11 || ^12"
"drupal/config_filter": "^1 || ^2",
"drupal/core": "^8 || ^9 || ^10"
},
"type": "drupal-module",
"extra": {
"drupal": {
"version": "8.x-3.3",
"datestamp": "1713299496",
"version": "8.x-2.4",
"datestamp": "1676045435",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
@ -2743,11 +2740,12 @@
"homepage": "https://www.drupal.org/user/413139"
}
],
"description": "Ignore certain configuration during import and export.",
"description": "Ignore certain configuration during import.",
"homepage": "http://drupal.org/project/config_ignore",
"support": {
"source": "https://git.drupalcode.org/project/config_ignore",
"issues": "http://drupal.org/project/config_ignore"
"issues": "https://drupal.org/project/config_ignore",
"irc": "irc://irc.freenode.org/drupal-contribute"
}
},
{
@ -4371,26 +4369,26 @@
},
{
"name": "drupal/extlink",
"version": "2.0.4",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/extlink.git",
"reference": "2.0.4"
"reference": "8.x-1.7"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/extlink-2.0.4.zip",
"reference": "2.0.4",
"shasum": "0331ef3457d3a1701f01e04f8256bdd823ea3512"
"url": "https://ftp.drupal.org/files/projects/extlink-8.x-1.7.zip",
"reference": "8.x-1.7",
"shasum": "38650688b5a58496db59f40b2a7f36c4bedcbfb4"
},
"require": {
"drupal/core": "^10 || ^11"
"drupal/core": "^8 || ^9 || ^10"
},
"type": "drupal-module",
"extra": {
"drupal": {
"version": "2.0.4",
"datestamp": "1732565828",
"version": "8.x-1.7",
"datestamp": "1665770295",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
@ -5879,17 +5877,17 @@
},
{
"name": "drupal/leaflet",
"version": "10.2.41",
"version": "10.2.42",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/leaflet.git",
"reference": "10.2.41"
"reference": "10.2.42"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/leaflet-10.2.41.zip",
"reference": "10.2.41",
"shasum": "aec6763b23e035d2c92b7f8374ac4f7626e26756"
"url": "https://ftp.drupal.org/files/projects/leaflet-10.2.42.zip",
"reference": "10.2.42",
"shasum": "7480d4b3c5ea8952191b9fea9b55528ad2ac9f0b"
},
"require": {
"drupal/core": "^9.3 || ^10 || ^11",
@ -5898,8 +5896,8 @@
"type": "drupal-module",
"extra": {
"drupal": {
"version": "10.2.41",
"datestamp": "1739919738",
"version": "10.2.42",
"datestamp": "1740753317",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
@ -6568,7 +6566,7 @@
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/menu_block.git",
"reference": "b798eff46f2ee54dbb4510cb0cbb873cc7f1aacf"
"reference": "217779758c6b6c729155595fc90e86375ca6bc5b"
},
"require": {
"drupal/core": "^10.1 || ^11"
@ -6579,8 +6577,8 @@
"dev-1.x": "1.x-dev"
},
"drupal": {
"version": "8.x-1.13+6-dev",
"datestamp": "1739495736",
"version": "8.x-1.13+8-dev",
"datestamp": "1740622280",
"security-coverage": {
"status": "not-covered",
"message": "Dev releases are not covered by Drupal security advisories."
@ -8248,21 +8246,20 @@
},
{
"name": "drupal/views_bulk_edit",
"version": "3.0.0",
"version": "2.9.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/views_bulk_edit.git",
"reference": "3.0.0"
"reference": "8.x-2.9"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/views_bulk_edit-3.0.0.zip",
"reference": "3.0.0",
"shasum": "3b16079aa95fb4834561fcfd1197cce73b7f4b88"
"url": "https://ftp.drupal.org/files/projects/views_bulk_edit-8.x-2.9.zip",
"reference": "8.x-2.9",
"shasum": "db45a8cc9ac629859374b24974eafcef257e4387"
},
"require": {
"drupal/core": "^9.4 || ^10 || ^11",
"php": ">=8.1"
"drupal/core": "^9.4 || ^10"
},
"require-dev": {
"drupal/views_bulk_operations": "~4.2.4"
@ -8273,8 +8270,8 @@
"type": "drupal-module",
"extra": {
"drupal": {
"version": "3.0.0",
"datestamp": "1725358398",
"version": "8.x-2.9",
"datestamp": "1690222256",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
@ -11106,16 +11103,16 @@
},
{
"name": "symfony/dependency-injection",
"version": "v6.4.16",
"version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/dependency-injection.git",
"reference": "7a379d8871f6a36f01559c14e11141cc02eb8dc8"
"reference": "b343c3b2f1539fe41331657b37d5c96c1d1ea842"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/7a379d8871f6a36f01559c14e11141cc02eb8dc8",
"reference": "7a379d8871f6a36f01559c14e11141cc02eb8dc8",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/b343c3b2f1539fe41331657b37d5c96c1d1ea842",
"reference": "b343c3b2f1539fe41331657b37d5c96c1d1ea842",
"shasum": ""
},
"require": {
@ -11167,7 +11164,7 @@
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/dependency-injection/tree/v6.4.16"
"source": "https://github.com/symfony/dependency-injection/tree/v6.4.19"
},
"funding": [
{
@ -11183,7 +11180,7 @@
"type": "tidelift"
}
],
"time": "2024-11-25T14:52:46+00:00"
"time": "2025-02-20T10:02:49+00:00"
},
{
"name": "symfony/deprecation-contracts",
@ -11254,16 +11251,16 @@
},
{
"name": "symfony/error-handler",
"version": "v6.4.18",
"version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/error-handler.git",
"reference": "e8d3b5b1975e67812a54388b1ba8e9ec28eb770e"
"reference": "3d4e55cd2b8f1979a65eba9ab749d6466c316f71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/error-handler/zipball/e8d3b5b1975e67812a54388b1ba8e9ec28eb770e",
"reference": "e8d3b5b1975e67812a54388b1ba8e9ec28eb770e",
"url": "https://api.github.com/repos/symfony/error-handler/zipball/3d4e55cd2b8f1979a65eba9ab749d6466c316f71",
"reference": "3d4e55cd2b8f1979a65eba9ab749d6466c316f71",
"shasum": ""
},
"require": {
@ -11309,7 +11306,7 @@
"description": "Provides tools to manage errors and ease debugging PHP code",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/error-handler/tree/v6.4.18"
"source": "https://github.com/symfony/error-handler/tree/v6.4.19"
},
"funding": [
{
@ -11325,7 +11322,7 @@
"type": "tidelift"
}
],
"time": "2025-01-06T09:38:16+00:00"
"time": "2025-02-02T20:16:33+00:00"
},
{
"name": "symfony/event-dispatcher",
@ -11692,16 +11689,16 @@
},
{
"name": "symfony/http-kernel",
"version": "v6.4.18",
"version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "fca7197bfe9e99dfae7fb1ad3f7f5bd9ef80e1b7"
"reference": "88f2c9f7feff86bb7b9105c5151bc2c1404cd64c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/fca7197bfe9e99dfae7fb1ad3f7f5bd9ef80e1b7",
"reference": "fca7197bfe9e99dfae7fb1ad3f7f5bd9ef80e1b7",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/88f2c9f7feff86bb7b9105c5151bc2c1404cd64c",
"reference": "88f2c9f7feff86bb7b9105c5151bc2c1404cd64c",
"shasum": ""
},
"require": {
@ -11786,7 +11783,7 @@
"description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-kernel/tree/v6.4.18"
"source": "https://github.com/symfony/http-kernel/tree/v6.4.19"
},
"funding": [
{
@ -11802,7 +11799,7 @@
"type": "tidelift"
}
],
"time": "2025-01-29T07:25:58+00:00"
"time": "2025-02-26T10:51:37+00:00"
},
{
"name": "symfony/mailer",
@ -11886,16 +11883,16 @@
},
{
"name": "symfony/mime",
"version": "v6.4.18",
"version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
"reference": "917d77981eb1ea963608d5cda4d9c0cf72eaa68e"
"reference": "ac537b6c55ccc2c749f3c979edfa9ec14aaed4f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/917d77981eb1ea963608d5cda4d9c0cf72eaa68e",
"reference": "917d77981eb1ea963608d5cda4d9c0cf72eaa68e",
"url": "https://api.github.com/repos/symfony/mime/zipball/ac537b6c55ccc2c749f3c979edfa9ec14aaed4f3",
"reference": "ac537b6c55ccc2c749f3c979edfa9ec14aaed4f3",
"shasum": ""
},
"require": {
@ -11951,7 +11948,7 @@
"mime-type"
],
"support": {
"source": "https://github.com/symfony/mime/tree/v6.4.18"
"source": "https://github.com/symfony/mime/tree/v6.4.19"
},
"funding": [
{
@ -11967,7 +11964,7 @@
"type": "tidelift"
}
],
"time": "2025-01-23T13:10:52+00:00"
"time": "2025-02-17T21:23:52+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -12604,16 +12601,16 @@
},
{
"name": "symfony/process",
"version": "v6.4.15",
"version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "3cb242f059c14ae08591c5c4087d1fe443564392"
"reference": "7a1c12e87b08ec9c97abdd188c9b3f5a40e37fc3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/3cb242f059c14ae08591c5c4087d1fe443564392",
"reference": "3cb242f059c14ae08591c5c4087d1fe443564392",
"url": "https://api.github.com/repos/symfony/process/zipball/7a1c12e87b08ec9c97abdd188c9b3f5a40e37fc3",
"reference": "7a1c12e87b08ec9c97abdd188c9b3f5a40e37fc3",
"shasum": ""
},
"require": {
@ -12645,7 +12642,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v6.4.15"
"source": "https://github.com/symfony/process/tree/v6.4.19"
},
"funding": [
{
@ -12661,7 +12658,7 @@
"type": "tidelift"
}
],
"time": "2024-11-06T14:19:14+00:00"
"time": "2025-02-04T13:35:48+00:00"
},
{
"name": "symfony/psr-http-message-bridge",
@ -12831,16 +12828,16 @@
},
{
"name": "symfony/serializer",
"version": "v6.4.18",
"version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/serializer.git",
"reference": "6ad986f62276da4c8c69754decfaa445a89cb6e3"
"reference": "a221b2f6066af304d760cff7a26f201b4fab4aef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/serializer/zipball/6ad986f62276da4c8c69754decfaa445a89cb6e3",
"reference": "6ad986f62276da4c8c69754decfaa445a89cb6e3",
"url": "https://api.github.com/repos/symfony/serializer/zipball/a221b2f6066af304d760cff7a26f201b4fab4aef",
"reference": "a221b2f6066af304d760cff7a26f201b4fab4aef",
"shasum": ""
},
"require": {
@ -12909,7 +12906,7 @@
"description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/serializer/tree/v6.4.18"
"source": "https://github.com/symfony/serializer/tree/v6.4.19"
},
"funding": [
{
@ -12925,7 +12922,7 @@
"type": "tidelift"
}
],
"time": "2025-01-28T18:47:02+00:00"
"time": "2025-02-24T08:42:36+00:00"
},
{
"name": "symfony/service-contracts",
@ -13176,16 +13173,16 @@
},
{
"name": "symfony/validator",
"version": "v6.4.18",
"version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/validator.git",
"reference": "ce20367d07b2592202e9c266b16a93fa50145207"
"reference": "f3e853dffe7c5db675686b8216d6d890dad8c885"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/validator/zipball/ce20367d07b2592202e9c266b16a93fa50145207",
"reference": "ce20367d07b2592202e9c266b16a93fa50145207",
"url": "https://api.github.com/repos/symfony/validator/zipball/f3e853dffe7c5db675686b8216d6d890dad8c885",
"reference": "f3e853dffe7c5db675686b8216d6d890dad8c885",
"shasum": ""
},
"require": {
@ -13253,7 +13250,7 @@
"description": "Provides tools to validate values",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/validator/tree/v6.4.18"
"source": "https://github.com/symfony/validator/tree/v6.4.19"
},
"funding": [
{
@ -13269,7 +13266,7 @@
"type": "tidelift"
}
],
"time": "2025-01-27T16:05:44+00:00"
"time": "2025-02-19T13:12:02+00:00"
},
{
"name": "symfony/var-dumper",
@ -13358,16 +13355,16 @@
},
{
"name": "symfony/var-exporter",
"version": "v6.4.13",
"version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-exporter.git",
"reference": "0f605f72a363f8743001038a176eeb2a11223b51"
"reference": "be6e71b0c257884c1107313de5d247741cfea172"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/0f605f72a363f8743001038a176eeb2a11223b51",
"reference": "0f605f72a363f8743001038a176eeb2a11223b51",
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/be6e71b0c257884c1107313de5d247741cfea172",
"reference": "be6e71b0c257884c1107313de5d247741cfea172",
"shasum": ""
},
"require": {
@ -13415,7 +13412,7 @@
"serialize"
],
"support": {
"source": "https://github.com/symfony/var-exporter/tree/v6.4.13"
"source": "https://github.com/symfony/var-exporter/tree/v6.4.19"
},
"funding": [
{
@ -13431,7 +13428,7 @@
"type": "tidelift"
}
],
"time": "2024-09-25T14:18:03+00:00"
"time": "2025-02-13T09:33:32+00:00"
},
{
"name": "symfony/yaml",
@ -13757,6 +13754,7 @@
"drupal/advanced_text_formatter": 5,
"drupal/bulkdelete": 20,
"drupal/config_devel": 20,
"drupal/config_ignore": 5,
"drupal/config_update": 15,
"drupal/context": 5,
"drupal/date_range_formatter": 20,

View File

@ -20,4 +20,5 @@ content:
weight: 0
region: content
hidden:
field_titre: true
search_api_excerpt: true

View File

@ -284,7 +284,7 @@ display:
popupAnchor:
x: ''
'y': ''
html: "<div></div>\r\n<div></div>\r\n<div></div>\r\n<div class=\"url\">[node:url]</div>\r\n<div class=\"couleur\">[node:field_couleur]</div>"
html: "<div class=\"url\">[node:url]</div>\r\n<div class=\"couleur\">[node:field_couleur]</div>"
html_class: 'leaflet-map-divicon '
circle_marker_options: '{"radius":100,"color":"red","fillColor":"#f03","fillOpacity":0.5}'
leaflet_markercluster:
@ -299,6 +299,7 @@ display:
geocoder:
control: false
settings:
popup: false
autocomplete:
placeholder: 'Search Address'
title: 'Search an Address on the Map'
@ -311,7 +312,6 @@ display:
min_terms: 4
delay: 800
zoom: 16
popup: false
options: ''
map_lazy_load:
lazy_load: true
@ -1195,7 +1195,18 @@ display:
defaults:
fields: false
display_description: ''
display_extenders: { }
display_extenders:
matomo:
enabled: false
keyword_gets: ''
keyword_behavior: first
keyword_concat_separator: ' '
category_behavior: none
category_gets: ''
category_concat_separator: ' '
category_fallback: ''
category_facets: { }
category_facets_concat_separator: ', '
cache_metadata:
max-age: -1
contexts:

@ -1 +1 @@
Subproject commit 9eab6ebc8d0bfaede4486d8695cd9f92cfc8ddbe
Subproject commit 18c6b02464fdc76846d9ed4261a9403fb7d0dc18

View File

@ -39,8 +39,9 @@ import '../scss/main.scss'
generalListLinks,
logoLink,
mapIcons,
mapContainer,
} = processClickableElements();
const clickableElements = [...etapeListLinks, ...generalListLinks, logoLink, ...mapIcons];
const clickableElements = [...etapeListLinks, ...generalListLinks, logoLink, ...mapIcons, mapContainer];
setupMapStore(mapStore, map, settings);

View File

@ -3,6 +3,25 @@
import { defineStore } from 'pinia';
import REST from '../api/rest-axios';
import { findContentByPath } from '../utils/content/findContentByPath';
import {
getCleanDate,
fetchFromRelationships,
getRelatedEtape,
} from '../utils/content/contentFetchUtils';
import {
getCarteSensible,
getTitreTexte,
getChiffresCles,
getDiaporama,
getEntretien,
getVideos,
} from '../utils/content/cleanParties';
import {
getPartenaires,
getGouvernance,
} from '../utils/content/multiItemPages';
export const useContentStore = defineStore('content', {
state: () => ({
contentType: '',
@ -14,7 +33,7 @@ export const useContentStore = defineStore('content', {
etape_number: '',
couleur: '',
dates: {},
previous : {},
previous: {},
next: {},
vignette: {},
parties: [],
@ -30,105 +49,23 @@ export const useContentStore = defineStore('content', {
}),
actions: {
async fetchContentData(path) {
console.log('start fetch content');
this.resetStore(false);
const contentTypes = [ 'etape', 'static', 'gouvernance', 'partenaire' ];
const contentTypes = ['etape', 'static', 'gouvernance', 'partenaire'];
try {
const findContentByPath = async (contentTypes, path) => {
for (let type of contentTypes) {
const response = await REST.get(`/jsonapi/node/${type}/`);
const content = response.data.data.find(content =>
content.attributes.metatag.some(tag =>
tag.tag === "link" && tag.attributes.href === path
)
);
if (content) {
console.log('content found');
return {
contentType: type,
rawContent: content,
};
}
// Handle special case for governance/partners (multiple items per page)
const pageRequested = window.location.href.split('/').pop().replace(/s?$/, '');
if (type === pageRequested
|| (type === 'gouvernance' && pageRequested === 'contact')
) {
return {
contentType: type,
rawContent: response.data.data,
};
}
}
return null;
};
const { contentType, rawContent } = await findContentByPath(contentTypes, path);
this.contentType = contentType;
// console.log(`current type: ${contentType}`);
if (this.contentType !== 'gouvernance' && this.contentType !== 'partenaire') {
const vignettePromise = fetchFromRelationships('field_vignette', rawContent.relationships);
const partiesPromise = fetchFromRelationships('field_parties', rawContent.relationships);
// TO DEBUG
const cleanContentMethod = 'original';
if (this.contentType !== 'gouvernance' && this.contentType !== 'partenaire'
&& cleanContentMethod === 'original'
) {
console.time('etape content processing');
// pageTitle
for (let tag of rawContent.attributes.metatag) {
if (tag.tag === "meta") {
this.pageTitle = tag.attributes.content;
break;
}
}
// contentTitle
this.content.contentTitle = rawContent.attributes.title;
// vignette
const vignetteFetch = await this.fetchFromRelationships('field_vignette', rawContent.relationships);
if (vignetteFetch) {
this.content.vignette = {
url: {
original: vignetteFetch.attributes.uri.url,
small: vignetteFetch.attributes.image_style_uri.content_small,
medium: vignetteFetch.attributes.image_style_uri.content_medium,
large: vignetteFetch.attributes.image_style_uri.content_large,
},
alt: rawContent.relationships.field_vignette.data.meta.alt
};
}
// liens
if (rawContent.attributes.field_liens.length) {
this.content.liens = [];
for (let lien of rawContent.attributes.field_liens) {
this.content.liens.push({
title: lien.title,
url: lien.uri,
});
}
}
// pièces jointes
if (rawContent.relationships.field_pieces_jointes.data.length) {
this.content.pieces_jointes = [];
for (let pieceJointe of rawContent.relationships.field_pieces_jointes.data) {
if (pieceJointe.meta.display) {
const uuid = pieceJointe.id;
const response = await REST.get(`/jsonapi/file/file/${uuid}`);
this.content.pieces_jointes.push({
title: pieceJointe.meta.description,
url: response.data.data.attributes.uri.url,
});
}
}
}
let previousEtapePromise, nextEtapePromise;
if (contentType === 'etape') {
// related étapes
previousEtapePromise = getRelatedEtape('previous', path);
nextEtapePromise = getRelatedEtape('next', path);
// coordinates
this.content.coordinates = {
lat: rawContent.attributes.field_geofield.lat,
@ -142,185 +79,9 @@ export const useContentStore = defineStore('content', {
this.content.couleur = rawContent.attributes.field_couleur;
// dates
this.content.dates = {
start: this.getCleanDate(rawContent.attributes.field_dates.value),
end: this.getCleanDate(rawContent.attributes.field_dates.end_value),
start: getCleanDate(rawContent.attributes.field_dates.value),
end: getCleanDate(rawContent.attributes.field_dates.end_value),
}
// previous / next
await this.getRelatedEtape('previous', path);
await this.getRelatedEtape('next', path);
}
// parties
const fieldParties = contentType === 'etape' ? 'field_parties' : 'field_parties_static';
const partiesFetch = await this.fetchFromRelationships(fieldParties, rawContent.relationships);
console.log(this.content);
console.timeEnd('etape content processing');
if (partiesFetch) {
this.content.parties = [];
for (let partie of partiesFetch) {
const partieType = partie.type.replace(/^paragraph--/, "");
let partieContent = {
type: partieType,
};
switch (partieType) {
case 'carte_sensible':
const carteSensibleFetch = await this.fetchFromRelationships('field_image_carte', partie.relationships);
if (carteSensibleFetch) {
partieContent.carteSensible = {
url: {
original: carteSensibleFetch.attributes.uri.url,
small: carteSensibleFetch.attributes.image_style_uri.content_small,
medium: carteSensibleFetch.attributes.image_style_uri.content_medium,
large: carteSensibleFetch.attributes.image_style_uri.content_large,
xlarge: carteSensibleFetch.attributes.image_style_uri.content_x_large,
},
alt: partie.relationships.field_image_carte.data.meta.alt,
};
}
break;
case 'titre_texte':
console.time('get images from text original')
partieContent.titre = partie.attributes.field_titre;
partieContent.texte = partie.attributes.field_texte.value;
// get the resized images from the text
const imgRegex = /<img[^>]+>/g;
const uuidRegex = /data-entity-uuid="([^"]+)"/;
const imgTags = partieContent.texte.match(imgRegex);
if (imgTags) {
for (const imgTag of imgTags) {
const uuidMatch = imgTag.match(uuidRegex);
if (uuidMatch && uuidMatch[1]) {
const uuid = uuidMatch[1];
const response = await REST.get(`/jsonapi/file/file/${uuid}`);
const imagesFetch = response.data.data;
const newImgTag = imgTag
.replace(/src="[^"]+"/,`src="${imagesFetch.attributes.image_style_uri.content_medium}"`)
.replace('>',' data-large-src="' + imagesFetch.attributes.image_style_uri.content_large + '">');
partieContent.texte = partieContent.texte.replace(imgTag, newImgTag);
}
}
}
console.timeEnd('get images from text original')
break;
case 'chiffres_cles':
const chiffresClesFetch = await this.fetchFromRelationships('field_chiffres_clefs', partie.relationships);
if (chiffresClesFetch) {
partieContent.chiffresCles = [];
for (let chiffre of chiffresClesFetch) {
partieContent.chiffresCles.push({
chiffre: chiffre.attributes.field_chiffre,
description: chiffre.attributes.field_description,
});
}
}
break;
case 'diaporama':
const diaporamaFetch = await this.fetchFromRelationships('field_diaporama', partie.relationships);
if (diaporamaFetch) {
partieContent.diaporama = [];
for (let [index, image] of diaporamaFetch.entries()) {
partieContent.diaporama.push({
url: {
original: image.attributes.uri.url,
small: image.attributes.image_style_uri.content_small,
medium: image.attributes.image_style_uri.content_medium,
large: image.attributes.image_style_uri.content_large,
},
alt: partie.relationships.field_diaporama.data[index].meta.alt,
});
}
}
break;
case 'entretien':
partieContent.entretien = {};
partieContent.entretien.titre = partie.attributes.field_titre;
const personnesFetch = await this.fetchFromRelationships('field_personne_s', partie.relationships);
const questionsReponsesFetch = await this.fetchFromRelationships('field_questions_reponses', partie.relationships);
if (personnesFetch && questionsReponsesFetch) {
partieContent.entretien.personnes = [];
for (let personne of personnesFetch) {
const portraitFetch = await this.fetchFromRelationships('field_portrait', personne.relationships);
if (portraitFetch) {
partieContent.entretien.personnes.push({
portrait: {
original: portraitFetch.attributes.uri.url,
small: portraitFetch.attributes.image_style_uri.content_small,
medium: portraitFetch.attributes.image_style_uri.content_medium,
large: portraitFetch.attributes.image_style_uri.content_large,
},
alt: personne.relationships.field_portrait.data.meta.alt,
description: personne.attributes.field_description,
});
}
}
partieContent.entretien.questionsReponses = [];
for (let qr of questionsReponsesFetch) {
partieContent.entretien.questionsReponses.push({
question: qr.attributes.field_question,
reponse: qr.attributes.field_reponse.value,
});
}
}
break;
case 'exergue':
partieContent.exergue = partie.attributes.field_texte_exergue.value;
break;
case 'video':
partieContent.videos = [];
for (let video of partie.attributes.field_videos) {
const videoId = video.split('?v=')[1];
const videoUrl = `https://www.youtube.com/embed/${videoId}`;
partieContent.videos.push(videoUrl);
}
break;
}
this.content.parties.push(partieContent);
}
}
console.log('content cleaned');
} else if (this.contentType !== 'gouvernance' && this.contentType !== 'partenaire'
&& cleanContentMethod === 'promise'
) {
console.time('etape content promise processing');
const vignettePromise = this.fetchFromRelationships('field_vignette', rawContent.relationships);
const partiesPromise = this.fetchFromRelationships('field_parties', rawContent.relationships);
const previousEtapePromise = contentType === 'etape'? this.getRelatedEtape('previous', path) : null;
const nextEtapePromise = contentType === 'etape' ? this.getRelatedEtape('next', path) : null;
if (contentType === 'etape') {
// coordinates
this.content.coordinates = {
lat: rawContent.attributes.field_geofield.lat,
lon: rawContent.attributes.field_geofield.lon,
};
// adresse
this.content.adresse = rawContent.attributes.field_adresse;
// étape number
this.content.etape_number = rawContent.attributes.field_arret_numero;
// couleur
this.content.couleur = rawContent.attributes.field_couleur;
// dates
this.content.dates = {
start: this.getCleanDate(rawContent.attributes.field_dates.value),
end: this.getCleanDate(rawContent.attributes.field_dates.end_value),
}
}
// pageTitle
@ -353,74 +114,29 @@ export const useContentStore = defineStore('content', {
const partieType = partie.type.replace(/^paragraph--/, "");
let partieContent = { type: partieType };
switch(partieType) {
switch (partieType) {
case 'carte_sensible':
const carteSensiblePromise = this.fetchFromRelationships('field_image_carte', partie.relationships);
const carteSensibleData = await carteSensiblePromise;
if (carteSensibleData) {
partieContent.carteSensible = {
url: {
original: carteSensibleData.attributes.uri.url,
small: carteSensibleData.attributes.image_style_uri.content_small,
medium: carteSensibleData.attributes.image_style_uri.content_medium,
large: carteSensibleData.attributes.image_style_uri.content_large,
xlarge: carteSensibleData.attributes.image_style_uri.content_x_large,
},
alt: partie.relationships.field_image_carte.data.meta.alt,
};
}
partieContent.carteSensible = await getCarteSensible(partie);
break;
case 'titre_texte':
partieContent.titre = partie.attributes.field_titre;
partieContent.texte = partie.attributes.field_texte.value;
// get the resized images from the text
const imgRegex = /<img[^>]+>/g;
const uuidRegex = /data-entity-uuid="([^"]+)"/;
const imgTags = partieContent.texte.match(imgRegex);
if (imgTags) {
const imagePromises = imgTags.map(imgTag => {
const uuidMatch = imgTag.match(uuidRegex);
if (uuidMatch && uuidMatch[1]) {
return REST.get(`/jsonapi/file/file/${uuidMatch[1]}`)
.then(response => ({
originalTag: imgTag,
imageData: response.data.data
}));
}
});
const images = await Promise.all(imagePromises);
images.forEach(({originalTag, imageData}) => {
const newImgTag = originalTag
.replace(/src="[^"]+"/,`src="${imageData.attributes.image_style_uri.content_medium}"`)
.replace('>',' data-large-src="' + imageData.attributes.image_style_uri.content_large + '">');
partieContent.texte = partieContent.texte.replace(originalTag, newImgTag);
});
}
const { titre, texte } = await getTitreTexte(partie);
partieContent.titre = titre;
partieContent.texte = texte;
break;
case 'chiffres_cles':
const chiffresClesFetch = await this.fetchFromRelationships('field_chiffres_clefs', partie.relationships);
if (chiffresClesFetch) {
partieContent.chiffresCles = [];
for (let chiffre of chiffresClesFetch) {
partieContent.chiffresCles.push({
chiffre: chiffre.attributes.field_chiffre,
description: chiffre.attributes.field_description,
});
}
}
partieContent.chiffresCles = await getChiffresCles(partie);
break;
case 'diaporama':
partieContent.diaporama = await getDiaporama(partie);
break;
case 'entretien':
partieContent.entretien = await getEntretien(partie);
break;
case 'exergue':
partieContent.exergue = partie.attributes.field_texte_exergue.value;
break;
case 'video':
partieContent.videos = getVideos(partie);
break;
}
return partieContent;
@ -430,72 +146,32 @@ export const useContentStore = defineStore('content', {
}
// related étapes
if (contentType === 'etape') await Promise.all([previousEtapePromise, nextEtapePromise]);
console.log(this.content);
console.timeEnd('etape content promise processing');
if (contentType === 'etape') {
const [prevContent, nextContent] = await Promise.all([previousEtapePromise, nextEtapePromise]);
this.content.previous = prevContent;
this.content.next = nextContent;
}
} else {
// pages gouvernance (contact) et partenaire
// ont plusieurs items par pages
const intro = await REST.get(`/jsonapi/config_pages/intro_${this.contentType}/`);
const introContent = intro.data.data[0];
this.pageTitle =
this.pageTitle =
`${introContent.attributes.field_titre} ${introContent.attributes.metatag.find(tag => tag.tag === "meta")?.attributes.content}`;
this.content.contentTitle = introContent.attributes.field_titre;
this.content.intro = introContent.attributes.field_intro?.value;
const multiItemPageArray = [];
let multiItemPageArray = [];
if (this.contentType === 'partenaire') {
for (let item of rawContent) {
const logoFetch = await REST.get(item.relationships.field_logo.links.related.href);
multiItemPageArray.push({
title: item.attributes.title,
description: item.attributes.body.value,
weight: item.attributes.field_poid,
link_url: item.attributes.field_lien.uri ,
logo_alt: item.relationships.field_logo.data.meta.alt,
logo_url: {
original: logoFetch.data.data.attributes.uri.url,
small: logoFetch.data.data.attributes.image_style_uri.content_small,
medium: logoFetch.data.data.attributes.image_style_uri.content_medium,
large: logoFetch.data.data.attributes.image_style_uri.content_large,
},
});
}
multiItemPageArray = await getPartenaires(rawContent);
} else if (this.contentType === 'gouvernance') {
for (let item of rawContent) {
const personnesFetch = await REST.get(item.relationships.field_personne_s.links.related.href);
let personnes = [];
for (let personne of personnesFetch.data.data) {
const portraitFetch = await REST.get(personne.relationships.field_portrait.links.related.href);
personnes.push({
nom: personne.attributes.field_nom,
prenom: personne.attributes.field_prenom,
description: personne.attributes.field_description,
photo_meta: personne.relationships.field_portrait.data?.meta.alt,
photo_url: portraitFetch.data.data ? {
original: portraitFetch.data.data.attributes.uri.url,
small: portraitFetch.data.data.attributes.image_style_uri.content_small,
medium: portraitFetch.data.data.attributes.image_style_uri.content_medium,
large: portraitFetch.data.data.attributes.image_style_uri.content_large,
} : null
});
}
multiItemPageArray.push({
title: item.attributes.title,
weight: item.attributes.field_poid,
personnes: personnes,
});
}
multiItemPageArray = await getGouvernance(rawContent);
}
this.content[`${this.contentType}s`] = multiItemPageArray;
// console.log(this.content);
}
} catch (error) {
this.error = 'Failed to fetch data';
@ -504,107 +180,6 @@ export const useContentStore = defineStore('content', {
this.loading = false;
}
},
getCleanDate(date) {
return {
d: date.split('-')[2],
m: new Intl.DateTimeFormat('fr-FR', { month: 'long' }).format(new Date(date)),
y: date.split('-')[0],
}
},
async getRelatedEtape(direction, path) {
const getRelatedEtapeContent = async (relatedEtapeData) => {
if (relatedEtapeData) {
const vignetteFetch = await REST.get(relatedEtapeData.relationships.field_vignette.links.related.href);
if (vignetteFetch.data.data) {
this.content[direction] = {
url: relatedEtapeData.attributes.metatag.find(tag => tag.tag === "link")?.attributes.href,
couleur: relatedEtapeData.attributes.field_couleur,
title: relatedEtapeData.attributes.title,
postalCode: relatedEtapeData.attributes.field_adresse.postal_code,
dates: {
start: this.getCleanDate(relatedEtapeData.attributes.field_dates.value),
end: this.getCleanDate(relatedEtapeData.attributes.field_dates.end_value),
},
vignette: {
url: {
original: vignetteFetch.data.data.attributes.uri.url,
small: vignetteFetch.data.data.attributes.image_style_uri.content_small,
medium: vignetteFetch.data.data.attributes.image_style_uri.content_medium,
large: vignetteFetch.data.data.attributes.image_style_uri.content_large,
},
alt: relatedEtapeData.relationships.field_vignette.data.meta.alt,
},
}
}
}
}
const allEtapesData = await REST.get('/jsonapi/views/etapes/block_1/');
for (let [index, etape] of allEtapesData.data.data.entries()) {
if (etape.attributes.metatag.some(tag =>
tag.tag === "link" && tag.attributes.href === path
)) {
const relatedEtapeIndex = direction === 'next' ? index + 1 : index - 1;
await getRelatedEtapeContent(allEtapesData.data.data[relatedEtapeIndex]);
}
}
},
async getRelatedEtape(direction, path) {
const getRelatedEtapeContent = (relatedEtapeData) => {
if (relatedEtapeData) {
return this.fetchFromRelationships('field_vignette', relatedEtapeData.relationships)
.then(vignetteFetch => {
if (vignetteFetch) {
this.content[direction] = {
url: relatedEtapeData.attributes.metatag.find(tag => tag.tag === "link")?.attributes.href,
couleur: relatedEtapeData.attributes.field_couleur,
title: relatedEtapeData.attributes.title,
postalCode: relatedEtapeData.attributes.field_adresse.postal_code,
dates: {
start: this.getCleanDate(relatedEtapeData.attributes.field_dates.value),
end: this.getCleanDate(relatedEtapeData.attributes.field_dates.end_value),
},
vignette: {
url: {
original: vignetteFetch.attributes.uri.url,
small: vignetteFetch.attributes.image_style_uri.content_small,
medium: vignetteFetch.attributes.image_style_uri.content_medium,
large: vignetteFetch.attributes.image_style_uri.content_large,
},
alt: relatedEtapeData.relationships.field_vignette.data.meta.alt,
},
}
}
});
}
}
const allEtapesPromise = REST.get('/jsonapi/views/etapes/block_1/');
return allEtapesPromise.then(allEtapesData => {
for (let [index, etape] of allEtapesData.data.data.entries()) {
if (etape.attributes.metatag.some(tag =>
tag.tag === "link" && tag.attributes.href === path
)) {
const relatedEtapeIndex = direction === 'next' ? index + 1 : index - 1;
return getRelatedEtapeContent(allEtapesData.data.data[relatedEtapeIndex]);
}
}
});
},
async fetchFromRelationships(field, relationships) {
if (relationships[field].links) {
const contentLink = relationships[field].links.related.href;
return REST.get(contentLink)
.then(contentFetch => contentFetch.data.data)
.catch(error => {
this.error = 'Failed to fetch data';
console.error('Issue with getNodeData', error);
});
}
return null;
},
resetStore(forFrontDisplay) {
this.contentType = '';
this.pageTitle = '';

View File

@ -16,13 +16,14 @@ export const useMapStore = defineStore('mapState', {
animationDuration: 3,
}),
actions: {
zoomToPlace(lat, long) {
zoomToPlace(lat, long) {
if (useLayoutStore().isDesktop) long = long - 0.03;
this.map.flyTo(
[lat, long],
this.maxZoom,
{ animate: this.animationsAreEnabled, duration: this.animationDuration });
this.currentZoom = this.maxZoom;
this.lockMap();
},
resetMap(animate = this.animationsAreEnabled, duration = this.animationDuration) {
this.map.flyTo(
@ -30,6 +31,7 @@ export const useMapStore = defineStore('mapState', {
useLayoutStore().isDesktop ? this.defaultZoomDesktop : this.defaultZoomMobile,
{ animate, duration });
this.currentZoom = useLayoutStore().isDesktop ? this.defaultZoomDesktop : this.defaultZoomMobile;
this.unlockMap();
},
lockMap() {
setTimeout(() => {
@ -42,7 +44,7 @@ export const useMapStore = defineStore('mapState', {
this.map.scrollWheelZoom.disable();
this.map.boxZoom.disable();
this.map.keyboard.disable();
// map.tap.disable();
this.map._controlContainer.style.display = 'none';
},
unlockMap() {
this.map.options.minZoom = useLayoutStore().isDesktop ? this.defaultZoomDesktop : this.defaultZoomMobile;
@ -53,7 +55,7 @@ export const useMapStore = defineStore('mapState', {
this.map.scrollWheelZoom.enable();
this.map.boxZoom.enable();
this.map.keyboard.enable();
// map.tap.enable();
this.map._controlContainer.style.display = 'block';
},
toggleAnimation() {
this.animationsAreEnabled = !this.animationsAreEnabled;

View File

@ -0,0 +1,134 @@
import REST from '../../api/rest-axios';
import { fetchFromRelationships } from './contentFetchUtils';
export async function getCarteSensible(partie) {
const carteSensiblePromise = fetchFromRelationships('field_image_carte', partie.relationships);
const carteSensibleData = await carteSensiblePromise;
if (carteSensibleData) {
return {
url: {
original: carteSensibleData.attributes.uri.url,
small: carteSensibleData.attributes.image_style_uri.content_small,
medium: carteSensibleData.attributes.image_style_uri.content_medium,
large: carteSensibleData.attributes.image_style_uri.content_large,
xlarge: carteSensibleData.attributes.image_style_uri.content_x_large,
},
alt: partie.relationships.field_image_carte.data.meta.alt,
};
}
}
export async function getTitreTexte(partie) {
let titre = partie.attributes.field_titre;
let texte = partie.attributes.field_texte.value;
// get the resized images from the text
const imgRegex = /<img[^>]+>/g;
const uuidRegex = /data-entity-uuid="([^"]+)"/;
const imgTags = texte.match(imgRegex);
if (imgTags) {
const imagePromises = imgTags.map(imgTag => {
const uuidMatch = imgTag.match(uuidRegex);
if (uuidMatch && uuidMatch[1]) {
return REST.get(`/jsonapi/file/file/${uuidMatch[1]}`)
.then(response => ({
originalTag: imgTag,
imageData: response.data.data
}));
}
});
const images = await Promise.all(imagePromises);
images.forEach(({originalTag, imageData}) => {
const newImgTag = originalTag
.replace(/src="[^"]+"/,`src="${imageData.attributes.image_style_uri.content_medium}"`)
.replace('>',' data-large-src="' + imageData.attributes.image_style_uri.content_large + '">');
texte = texte.replace(originalTag, newImgTag);
});
}
return { titre, texte };
}
export async function getChiffresCles(partie) {
const chiffresClesFetch = await fetchFromRelationships('field_chiffres_clefs', partie.relationships);
if (chiffresClesFetch) {
let chiffresCles = [];
for (let chiffre of chiffresClesFetch) {
chiffresCles.push({
chiffre: chiffre.attributes.field_chiffre,
description: chiffre.attributes.field_description,
});
}
return chiffresCles;
}
}
export async function getDiaporama(partie) {
const diaporamaFetch = await fetchFromRelationships('field_diaporama', partie.relationships);
if (diaporamaFetch) {
const diaporamaPromises = diaporamaFetch.map((image, index) => {
return {
url: {
original: image.attributes.uri.url,
small: image.attributes.image_style_uri.content_small,
medium: image.attributes.image_style_uri.content_medium,
large: image.attributes.image_style_uri.content_large,
},
alt: partie.relationships.field_diaporama.data[index].meta.alt,
};
});
return await Promise.all(diaporamaPromises);
}
}
export async function getEntretien(partie) {
const [personnesFetch, questionsReponsesFetch] = await Promise.all([
fetchFromRelationships('field_personne_s', partie.relationships),
fetchFromRelationships('field_questions_reponses', partie.relationships)
]);
if (personnesFetch && questionsReponsesFetch) {
const personnesPromises = personnesFetch.map(async (personne) => {
const portraitFetch = await fetchFromRelationships('field_portrait', personne.relationships);
if (portraitFetch) {
return {
portrait: {
original: portraitFetch.attributes.uri.url,
small: portraitFetch.attributes.image_style_uri.content_small,
medium: portraitFetch.attributes.image_style_uri.content_medium,
large: portraitFetch.attributes.image_style_uri.content_large,
},
alt: personne.relationships.field_portrait.data.meta.alt,
description: personne.attributes.field_description,
};
}
});
const questionsReponses = questionsReponsesFetch.map(qr => ({
question: qr.attributes.field_question,
reponse: qr.attributes.field_reponse.value,
}));
return {
titre: partie.attributes.field_titre,
personnes: await Promise.all(personnesPromises),
questionsReponses: questionsReponses
}
}
}
export function getVideos(partie) {
let videos = [];
for (let video of partie.attributes.field_videos) {
const videoId = video.split('?v=')[1];
const videoUrl = `https://www.youtube.com/embed/${videoId}`;
videos.push(videoUrl);
}
return videos;
}

View File

@ -0,0 +1,68 @@
import REST from '../../api/rest-axios';
export async function fetchFromRelationships(field, relationships) {
field = relationships[field] ? field : `${field}_static`;
if (relationships[field].links) {
const contentLink = relationships[field].links.related.href;
return REST.get(contentLink)
.then(contentFetch => contentFetch.data.data)
.catch(error => {
this.error = 'Failed to fetch data';
console.error('Issue with getNodeData', error);
});
}
return null;
}
export function getCleanDate(date) {
return {
d: date.split('-')[2],
m: new Intl.DateTimeFormat('fr-FR', { month: 'long' }).format(new Date(date)),
y: date.split('-')[0],
}
}
export async function getRelatedEtape(direction, path) {
const getRelatedEtapeContent = (relatedEtapeData) => {
if (relatedEtapeData) {
return fetchFromRelationships('field_vignette', relatedEtapeData.relationships)
.then(vignetteFetch => {
if (vignetteFetch) {
return {
url: relatedEtapeData.attributes.metatag.find(tag => tag.tag === "link")?.attributes.href,
couleur: relatedEtapeData.attributes.field_couleur,
title: relatedEtapeData.attributes.title,
postalCode: relatedEtapeData.attributes.field_adresse.postal_code,
dates: {
start: getCleanDate(relatedEtapeData.attributes.field_dates.value),
end: getCleanDate(relatedEtapeData.attributes.field_dates.end_value),
},
vignette: {
url: {
original: vignetteFetch.attributes.uri.url,
small: vignetteFetch.attributes.image_style_uri.content_small,
medium: vignetteFetch.attributes.image_style_uri.content_medium,
large: vignetteFetch.attributes.image_style_uri.content_large,
},
alt: relatedEtapeData.relationships.field_vignette.data.meta.alt,
},
}
}
});
}
}
const allEtapesPromise = REST.get('/jsonapi/views/etapes/block_1/');
return allEtapesPromise.then(allEtapesData => {
for (let [index, etape] of allEtapesData.data.data.entries()) {
if (etape.attributes.metatag.some(tag =>
tag.tag === "link" && tag.attributes.href === path
)) {
const relatedEtapeIndex = direction === 'next' ? index + 1 : index - 1;
return getRelatedEtapeContent(allEtapesData.data.data[relatedEtapeIndex]);
}
}
});
}

View File

@ -0,0 +1,32 @@
import REST from '../../api/rest-axios';
export async function findContentByPath(contentTypes, path) {
for (let type of contentTypes) {
const response = await REST.get(`/jsonapi/node/${type}/`);
const content = response.data.data.find(content =>
content.attributes.metatag.some(tag =>
tag.tag === "link" && tag.attributes.href === path
)
);
if (content) {
return {
contentType: type,
rawContent: content,
};
}
// Handle special case for governance/partners (multiple items per page)
const pageRequested = window.location.href.split('/').pop().replace(/s?$/, '');
if (type === pageRequested
|| (type === 'gouvernance' && pageRequested === 'contact')
) {
return {
contentType: type,
rawContent: response.data.data,
};
}
}
return null;
}

View File

@ -0,0 +1,54 @@
import REST from '../../api/rest-axios';
export async function getPartenaires(rawContent) {
const logoPromises = rawContent.map(item =>
REST.get(item.relationships.field_logo.links.related.href)
.then(logoFetch => ({
title: item.attributes.title,
description: item.attributes.body.value,
weight: item.attributes.field_poid,
link_url: item.attributes.field_lien.uri,
logo_alt: item.relationships.field_logo.data.meta.alt,
logo_url: {
original: logoFetch.data.data.attributes.uri.url,
small: logoFetch.data.data.attributes.image_style_uri.content_small,
medium: logoFetch.data.data.attributes.image_style_uri.content_medium,
large: logoFetch.data.data.attributes.image_style_uri.content_large,
}
}))
);
return await Promise.all(logoPromises);
}
export async function getGouvernance(rawContent) {
const itemPromises = rawContent.map(item =>
REST.get(item.relationships.field_personne_s.links.related.href)
.then(async personnesFetch => {
const portraitPromises = personnesFetch.data.data.map(personne =>
REST.get(personne.relationships.field_portrait.links.related.href)
.then(portraitFetch => ({
nom: personne.attributes.field_nom,
prenom: personne.attributes.field_prenom,
description: personne.attributes.field_description,
photo_meta: personne.relationships.field_portrait.data?.meta.alt,
photo_url: portraitFetch.data.data ? {
original: portraitFetch.data.data.attributes.uri.url,
small: portraitFetch.data.data.attributes.image_style_uri.content_small,
medium: portraitFetch.data.data.attributes.image_style_uri.content_medium,
large: portraitFetch.data.data.attributes.image_style_uri.content_large,
} : null
}))
);
return Promise.all(portraitPromises)
.then(personnes => ({
title: item.attributes.title,
weight: item.attributes.field_poid,
personnes
}));
})
);
return await Promise.all(itemPromises);
}

View File

@ -22,12 +22,10 @@ export function handleClickableElements(clickableElements, store, router, baseUr
let href = link.href || link.dataset.href;
if (href.startsWith(baseUrl)) href = href.replace(baseUrl, '');
link.onclick = async function (e) {
console.log('click on link, route push');
router.push(href);
link.onclick = async function (e) {
if (href !== window.location.pathname) {
pageChange(href, store, siteName, mapStore, baseUrl);
router.push(href);
pageChange(href, store, siteName, mapStore, baseUrl);
}
}
}
@ -40,7 +38,6 @@ export async function handleBrowserNavigation(store, baseUrl, siteName, mapStore
}
export async function pageChange(href, store, siteName, mapStore, baseUrl) {
console.log('trigger page change');
if (href === '/') {
store.resetStore(true);
document.title = siteName;

View File

@ -4,6 +4,7 @@ export function processClickableElements() {
generalListLinks: processStaticLinks(),
logoLink: processLogoLink(),
mapIcons: processMapIcons(),
mapContainer: processMapContainer(),
};
}
@ -14,9 +15,9 @@ function processEtapeLinks() {
etape_link.addEventListener('click', (e) => e.preventDefault());
const couleur = etape_link.dataset.couleur;
li.dataset.href = etape_link.attributes.href.value;
const iconElements = li.querySelectorAll('.icone-arret > div');
const iconElements = li.querySelectorAll('.icone-arret');
for (let element of iconElements) {
element.style.backgroundColor = couleur;
element.style.backgroundColor = couleur;
}
});
@ -46,16 +47,10 @@ function processMapIcons() {
const hrefContainer = icon.querySelector('.url');
icon.dataset.href = hrefContainer.innerText;
hrefContainer.style.display = "none";
const colorContainer = icon.querySelector('.couleur');
let color = colorContainer.innerText;
colorContainer.style.display = "none";
const iconElements = icon.querySelectorAll('div');
for (let iconElement of iconElements) {
iconElement.style.backgroundColor = color;
}
icon.style.backgroundColor = color;
icon.addEventListener('mouseenter', () => {
icon.style.transform = `${icon.style.transform} scale(1.1)`;
@ -70,3 +65,11 @@ function processMapIcons() {
return icons;
}
function processMapContainer() {
let mapContainer = document.querySelector('.leaflet-layer');
mapContainer.style.height = "100vh";
mapContainer.style.width = "100vw";
mapContainer.dataset.href = "/";
return mapContainer;
}

View File

@ -5,12 +5,8 @@
</div>
<div v-if="contentType === 'etape' && (content.previous || content.next)" class="related-etape-links">
<div v-if="content.previous" class="card previous" @click="goToRelatedElement(content.previous.url)">
<div class="icon">
<div :style="{ backgroundColor: content.previous.couleur }"></div>
<div :style="{ backgroundColor: content.previous.couleur }"></div>
<div :style="{ backgroundColor: content.previous.couleur }"></div>
</div>
<div v-if="content.previous" class="card previous" :data-href="content.previous.url">
<div class="icon" :style="{ backgroundColor: content.previous.couleur }"></div>
<div class="card-content">
<div class="infos">
<div class="titre">{{ content.previous.title }} <span>({{ content.previous.postalCode.slice(0, 2) }})</span></div>
@ -21,12 +17,8 @@
</div>
</div>
</div>
<div v-if="content.next" class="card next" @click="goToRelatedElement(content.next.url)">
<div class="icon">
<div :style="{ backgroundColor: content.next.couleur }"></div>
<div :style="{ backgroundColor: content.next.couleur }"></div>
<div :style="{ backgroundColor: content.next.couleur }"></div>
</div>
<div v-if="content.next" class="card next" :data-href="content.next.url">
<div class="icon" :style="{ backgroundColor: content.next.couleur }"></div>
<div class="card-content">
<div class="infos">
<div class="titre">{{ content.next.title }} <span>({{ content.next.postalCode.slice(0, 2) }})</span></div>
@ -42,13 +34,18 @@
</template>
<script setup>
import { onMounted } from 'vue';
import router from '../../router/router';
import { useContentStore } from '../../stores/content';
import { pageChange } from '../../utils/handle-navigation.js';
import { useMapStore } from '../../stores/map';
import { handleClickableElements } from '../../utils/handle-navigation.js';
const brandColor = "#80c8bf";
const store = useContentStore();
const mapStore = useContentStore();
const mapStore = useMapStore();
const siteName = document.querySelector('#site_name').innerText;
@ -59,10 +56,9 @@ const props = defineProps({
map: Object,
});
async function goToRelatedElement(href) {
const baseUrl = window.location.protocol + "//" + window.location.host;
if (href.startsWith(baseUrl)) href = href.replace(baseUrl, '');
pageChange(href, store, siteName, mapStore, baseUrl)
}
onMounted(() => {
const relatedEtapesCards = document.querySelectorAll('.card');
const baseUrl = window.location.protocol + "//" + window.location.host;
handleClickableElements(relatedEtapesCards, store, router, baseUrl, siteName, mapStore);
});
</script>

View File

@ -0,0 +1 @@
<svg width="20" xmlns="http://www.w3.org/2000/svg" height="24" fill="none"><path d="M19.996,13.728L19.992,17.434L9.964,24.000L0.000,17.500L0.000,13.541L0.000,10.459L0.000,6.500L9.964,0.000L19.992,6.566L19.996,10.272L20.000,10.272L19.998,12.000L19.996,13.728ZL19.996,13.728ZL19.998,12.000" style="fill: rgb(0, 0, 0); fill-opacity: 1;" class="fills"/></svg>

After

Width:  |  Height:  |  Size: 355 B

View File

@ -15,6 +15,9 @@ $modale-width-desktop: 50vw;
$brand-pattern-height: 110px;
$xsm-font-size-mobile: 0.5rem;
$xsm-font-size-desktop: 0.6rem;
$sm-font-size-mobile: 0.6rem;
$sm-font-size-desktop: 0.8rem;
@ -163,7 +166,7 @@ body{
}
> #hamburger {
position: fixed;
height: 5vh;
height: max(5vh, 40px);
right: 0;
top: 0;
margin-right: $body-margin-x;
@ -343,27 +346,15 @@ body{
left: 0;
}
.leaflet-map-divicon {
width: 10px;
height: 30px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 20px !important;
height: 20px !important;
transition: transform 0.3s ease-out;
> div {
background-color: red;
display: block;
width: 20px;
height: 10px;
}
> div:first-of-type {
height: 8px;
clip-path: polygon(0 0, 100% 0, 50% 100%);
transform: rotate(180deg);
}
> div:nth-of-type(3) {
height: 8px;
clip-path: polygon(0 0, 100% 0, 50% 100%);
transform-origin: center;
mask-image: url("/themes/custom/caravane/assets/pictograms/hexagone.svg");
mask-size: contain;
mask-repeat: no-repeat;
> .url, .couleur {
display: none;
}
}
}
@ -689,24 +680,12 @@ body{
}
}
> .icone-arret {
width: 10px;
height: 30px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
> div {
display: block;
width: 20px;
height: 10px;
&:first-of-type, &:last-of-type {
height: 8px;
clip-path: polygon(0 0, 100% 0, 50% 100%);
}
&:first-of-type {
transform: rotate(180deg);
}
}
min-width: 20px;
height: 20px;
display: block;
mask-image: url("/themes/custom/caravane/assets/pictograms/hexagone.svg");
mask-size: contain;
mask-repeat: no-repeat;
}
}
> li:hover {
@ -926,6 +905,8 @@ body{
}
}
> main {
z-index: 1;
position: relative;
width: 100%;
padding: 0 $modale-x-padding;
padding-bottom: 5vh;
@ -1232,6 +1213,7 @@ body{
}
}
> footer {
position: relative;
z-index: 0;
.pattern-bottom {
mask-image: linear-gradient(to top, rgba(0,0,0,1), rgba(0,0,0,0));
@ -1287,24 +1269,12 @@ body{
}
> .icon {
z-index: 2;
width: 10px;
height: 30px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
> div {
display: block;
width: 20px;
height: 10px;
&:first-of-type, &:last-of-type {
height: 8px;
clip-path: polygon(0 0, 100% 0, 50% 100%);
}
&:first-of-type {
transform: rotate(180deg);
}
}
width: 25px;
height: 25px;
mask-image: url("/themes/custom/caravane/assets/pictograms/hexagone.svg");
mask-size: contain;
mask-repeat: no-repeat;
margin-right: -8px;
}
> .card-content {
z-index: 1;
@ -1318,21 +1288,21 @@ body{
padding: 1rem 0.5rem;
font-weight: bold;
font-family: 'Joost', sans-serif;
font-size: $m-font-size-mobile;
font-size: $labeur-font-size-mobile;
@media screen and (min-width: $desktop-min-width) {
font-size: $m-font-size-desktop;
font-size: $labeur-font-size-desktop;
}
> span {
font-weight: lighter;
}
}
> .date {
font-size: $sm-font-size-mobile;
font-size: $xsm-font-size-mobile;
font-family: 'Marianne', sans-serif;
font-weight: lighter;
padding-bottom: 1rem;
@media screen and (min-width: $desktop-min-width) {
font-size: $sm-font-size-desktop;
font-size: $xsm-font-size-desktop;
}
}
}

View File

@ -18,4 +18,4 @@ regions:
content: 'Content'
sidebar_first: 'Sidebar first'
sidebar_second: 'Sidebar second'
footer: 'Footer'
footer: 'Footer'

View File

@ -55,7 +55,4 @@
{%- endfor %}
</div>
<div class="icone-arret">
<div></div>
<div></div>
<div></div>
</div>