contenu des étapes
This commit is contained in:
@@ -3,6 +3,9 @@ import { createPinia } from 'pinia'
|
||||
import '../scss/main.scss'
|
||||
import Modale from './vuejs/Modale.vue'
|
||||
|
||||
import VueImageZoomer from 'vue-image-zoomer'
|
||||
import 'vue-image-zoomer/dist/style.css';
|
||||
|
||||
import { useContentStore } from './stores/content';
|
||||
import router from './router/router';
|
||||
|
||||
@@ -48,7 +51,9 @@ import router from './router/router';
|
||||
}
|
||||
|
||||
function initVueContentModale(){
|
||||
const app = createApp(Modale).use(createPinia()).use(router);
|
||||
const app = createApp(Modale)
|
||||
.use(createPinia()).use(router)
|
||||
.use(VueImageZoomer);
|
||||
const store = useContentStore();
|
||||
app.mount('#content-modale');
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
// query et traitement des contenus
|
||||
|
||||
import { defineStore } from 'pinia';
|
||||
import REST from '../api/rest-axios';
|
||||
|
||||
@@ -21,12 +23,15 @@ export const useContentStore = defineStore('content', {
|
||||
},
|
||||
},
|
||||
geofield: {},
|
||||
galeries: [],
|
||||
// galeries: [],
|
||||
parties: [],
|
||||
saison: {},
|
||||
thematiques: [],
|
||||
vignette: {},
|
||||
couleur: '',
|
||||
sensibleMap: {},
|
||||
previous: {},
|
||||
next: {},
|
||||
},
|
||||
page: {
|
||||
title: '',
|
||||
@@ -43,7 +48,7 @@ export const useContentStore = defineStore('content', {
|
||||
this.page = {};
|
||||
try {
|
||||
const response = await REST.get(`/jsonapi/node/etape/`);
|
||||
for (let etape of response.data.data) {
|
||||
for (let [index, etape] of response.data.data.entries()) {
|
||||
if (etape.attributes.drupal_internal__nid == nid) {
|
||||
for (let metatag of etape.attributes.metatag) {
|
||||
if (metatag.tag === "link") {
|
||||
@@ -53,34 +58,113 @@ export const useContentStore = defineStore('content', {
|
||||
this.etape.title = etape.attributes.title;
|
||||
this.etape.adresse = etape.attributes.field_adresse;
|
||||
this.etape.etape_number = etape.attributes.field_arret_numero;
|
||||
//this.etape.dates = etape.attributes.field_dates;
|
||||
this.etape.dates = {
|
||||
start: {
|
||||
d: etape.attributes.field_dates.value.split('-')[2],
|
||||
m: new Intl.DateTimeFormat('fr-FR', { month: 'long' }).format(new Date(etape.attributes.field_dates.value)),
|
||||
y: etape.attributes.field_dates.value.split('-')[0],
|
||||
},
|
||||
end: {
|
||||
d: etape.attributes.field_dates.end_value.split('-')[2],
|
||||
m: new Intl.DateTimeFormat('fr-FR', { month: 'long' }).format(new Date(etape.attributes.field_dates.end_value)),
|
||||
y: etape.attributes.field_dates.end_value.split('-')[0],
|
||||
|
||||
},
|
||||
start: this.getCleanDate(etape.attributes.field_dates.value),
|
||||
end: this.getCleanDate(etape.attributes.field_dates.end_value),
|
||||
}
|
||||
this.etape.geofield = etape.attributes.field_geofield;
|
||||
this.etape.galeries = await this.fetchEtapeContent('field_galleries', etape.relationships);
|
||||
// this.etape.galeries = await this.fetchEtapeContent('field_galleries', etape.relationships);
|
||||
const partiesFetch = await this.fetchEtapeContent('field_parties', etape.relationships);
|
||||
let partiesArray = []
|
||||
for (let partie of partiesFetch) {
|
||||
partiesArray.push({ title: partie.attributes.field_titre, text: partie.attributes.field_texte.value });
|
||||
|
||||
if (partiesFetch) {
|
||||
for (let partie of partiesFetch) {
|
||||
let partieContent = {
|
||||
title: partie.attributes.field_titre || '',
|
||||
text: partie.attributes.field_texte.value || '',
|
||||
diaporama: [],
|
||||
chiffresCles: [],
|
||||
videos: [],
|
||||
}
|
||||
|
||||
if (partie.relationships.field_diaporama) {
|
||||
const diaporama = await REST.get(partie.relationships.field_diaporama.links.related.href);
|
||||
|
||||
partie.relationships.field_diaporama.data.forEach((element, i) => {
|
||||
partieContent.diaporama[i] = {};
|
||||
partieContent.diaporama[i].alt = element.meta.alt;
|
||||
});
|
||||
|
||||
diaporama.data.data.forEach((element, i) => {
|
||||
partieContent.diaporama[i].url = element.attributes.uri.url;
|
||||
});
|
||||
}
|
||||
|
||||
if (partie.attributes.field_chiffres_cles) {
|
||||
for (let chiffre of partie.attributes.field_chiffres_cles) {
|
||||
partieContent.chiffresCles.push(chiffre.processed);
|
||||
}
|
||||
}
|
||||
|
||||
if (partie.attributes.field_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);
|
||||
}
|
||||
}
|
||||
|
||||
partiesArray.push(partieContent);
|
||||
}
|
||||
}
|
||||
|
||||
this.etape.parties = partiesArray;
|
||||
this.etape.saison = await this.fetchEtapeContent('field_saison', etape.relationships);
|
||||
this.etape.saison = await this.fetchEtapeContent('field_saison', etape.relationships);
|
||||
this.etape.thematiques = await this.fetchEtapeContent('field_thematiques', etape.relationships);
|
||||
const vignetteFetch = await this.fetchEtapeContent('field_vignette', etape.relationships);
|
||||
this.etape.vignette = { url: vignetteFetch.attributes.uri.url, alt: etape.attributes.field_vignette_alt };
|
||||
const sensibleMapFetch = await this.fetchEtapeContent('field_carte_sensible', etape.relationships);
|
||||
if (sensibleMapFetch) {
|
||||
this.etape.sensibleMap = { url: sensibleMapFetch.attributes.uri.url, alt: etape.relationships.field_carte_sensible.data.meta.alt };
|
||||
}
|
||||
this.etape.couleur = etape.attributes.field_couleur;
|
||||
|
||||
// get previous and next étape infos
|
||||
// the list from the json api /node is not ordered
|
||||
// and i need authentification to get the json view ordered list
|
||||
// so i get it from the displayed list in the page
|
||||
const orderedEtapesList = document.querySelectorAll('#etapes-liste li');
|
||||
|
||||
if (orderedEtapesList) {
|
||||
const processEtape = async (etapeItemNid, etapesList, key) => {
|
||||
for (let etape of etapesList) {
|
||||
if (etape.attributes.drupal_internal__nid == etapeItemNid) {
|
||||
const vignetteFetch = await REST.get(etape.relationships.field_vignette.links.related.href);
|
||||
this.etape[key] = {
|
||||
nid: etape.attributes.drupal_internal__nid,
|
||||
couleur: etape.attributes.field_couleur,
|
||||
title: etape.attributes.title,
|
||||
postalCode: etape.attributes.field_adresse.postal_code,
|
||||
dates: {
|
||||
start: this.getCleanDate(etape.attributes.field_dates.value),
|
||||
end: this.getCleanDate(etape.attributes.field_dates.end_value),
|
||||
},
|
||||
vignette: {
|
||||
url: vignetteFetch.data.data.attributes.uri.url,
|
||||
alt: etape.relationships.field_vignette.data.meta.alt,
|
||||
},
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (let li of orderedEtapesList) {
|
||||
if (li.querySelector('a').dataset.nodeNid === nid) {
|
||||
const previousEtapeItemNid = li.previousElementSibling?.querySelector('a').dataset.nodeNid;
|
||||
const nextEtapeItemNid = li.nextElementSibling?.querySelector('a').dataset.nodeNid;
|
||||
|
||||
if (previousEtapeItemNid) {
|
||||
await processEtape(previousEtapeItemNid, response.data.data, 'previous');
|
||||
}
|
||||
|
||||
if (nextEtapeItemNid) {
|
||||
await processEtape(nextEtapeItemNid, response.data.data, 'next');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setActiveItemInMenu();
|
||||
break;
|
||||
}
|
||||
@@ -171,6 +255,13 @@ export const useContentStore = defineStore('content', {
|
||||
console.error('Issue with getNodeData', error);
|
||||
}
|
||||
}
|
||||
},
|
||||
getCleanDate(date) {
|
||||
return {
|
||||
d: date.split('-')[2],
|
||||
m: new Intl.DateTimeFormat('fr-FR', { month: 'long' }).format(new Date(date)),
|
||||
y: date.split('-')[0],
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
93
web/themes/custom/caravane/assets/js/vuejs/ImageModale.vue
Normal file
93
web/themes/custom/caravane/assets/js/vuejs/ImageModale.vue
Normal file
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<transition name="fade">
|
||||
<div v-if="isOpen" class="image-viewer-wrapper">
|
||||
<div v-if="!swiperContent.length" class="img-modale simple-viewer">
|
||||
<figure class="img-wrapper">
|
||||
<img :src="image.src" :alt="image.alt">
|
||||
<figcaption>{{ image.alt }}</figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
<div v-else class="img-modale swiper-viewer">
|
||||
<div class="swiper-wrapper">
|
||||
<swiper-container
|
||||
:slidesPerView="1"
|
||||
:centeredSlides="true"
|
||||
:loop="true"
|
||||
:navigation="true"
|
||||
:pagination="true"
|
||||
:initialSlide="currentImgIndex"
|
||||
:injectStyles="[`
|
||||
.swiper-button-next, .swiper-button-prev {
|
||||
color: white;
|
||||
top: 50%;
|
||||
}
|
||||
.swiper-pagination-bullet:not(.swiper-pagination-bullet-active) {
|
||||
background: white;
|
||||
opacity: 0.8;
|
||||
}
|
||||
`]"
|
||||
>
|
||||
<swiper-slide v-for="media in swiperContent">
|
||||
<figure>
|
||||
<img :src="media.src" :alt="media.alt" class="popup-img">
|
||||
<figcaption>{{ media.alt }}</figcaption>
|
||||
</figure>
|
||||
</swiper-slide>
|
||||
</swiper-container>
|
||||
</div>
|
||||
</div>
|
||||
<button @click="close" class="close-button">
|
||||
<div></div>
|
||||
<div></div>
|
||||
</button>
|
||||
</div>
|
||||
</transition>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
const props = defineProps({
|
||||
isOpen: Boolean,
|
||||
image: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
swiperContent: {
|
||||
type: Array,
|
||||
required: true,
|
||||
}
|
||||
});
|
||||
|
||||
const currentImgIndex = ref(0);
|
||||
|
||||
watch(
|
||||
() => props.isOpen,
|
||||
() => {
|
||||
if (props.isOpen && props.swiperContent.length) {
|
||||
for (let i = 0; i < props.swiperContent.length; i++) {
|
||||
const currentImgSrc = props.image.src;
|
||||
const truncatedSrc = currentImgSrc.substring(currentImgSrc.indexOf("/sites"));
|
||||
if (props.swiperContent[i].src === truncatedSrc) {
|
||||
currentImgIndex.value = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['close']);
|
||||
|
||||
const close = () => {
|
||||
emit('close');
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fade-enter-active, .fade-leave-active {
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
.fade-enter-from, .fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
@@ -1,43 +1,129 @@
|
||||
<template>
|
||||
<Transition>
|
||||
<div v-if="isEtapeValid">
|
||||
<header>
|
||||
<div class="cover">
|
||||
<img :src="etape.vignette.url" :alt="etape.vignette.alt">
|
||||
</div>
|
||||
<div class="cartouche" :style="{ backgroundColor: etape.couleur }">
|
||||
<p>Étape n°{{etape.etape_number}}</p>
|
||||
<p>Du {{etape.dates.start.d}} {{etape.dates.start.m}} au {{ etape.dates.end.d }} {{ etape.dates.end.m }} {{ etape.dates.end.y }}</p>
|
||||
</div>
|
||||
<div class="brand-pattern" :style="{ backgroundColor: etape.couleur }">
|
||||
<div class="pattern"></div>
|
||||
</div>
|
||||
<div class="locality">
|
||||
<div class="top-triangle"></div>
|
||||
<div class="locality-title">
|
||||
<h1>{{etape.title}} <em>({{ etape.adresse.postal_code }})</em></h1>
|
||||
<div class="content-wrapper">
|
||||
<header>
|
||||
<div class="cover">
|
||||
<img :src="etape.vignette.url" :alt="etape.vignette.alt">
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<main>
|
||||
<div v-for="partie in etape.parties" class="partie">
|
||||
<div class="partie-title">
|
||||
<h3>
|
||||
<div class="underline" :style="{ backgroundColor: etape.couleur }"></div>
|
||||
<p v-html="partie.title"></p>
|
||||
</h3>
|
||||
<div class="cartouche" :style="{ backgroundColor: etape.couleur }">
|
||||
<p>Étape n°{{etape.etape_number}}</p>
|
||||
<p>Du {{etape.dates.start.d}} {{etape.dates.start.m}} au {{ etape.dates.end.d }} {{ etape.dates.end.m }} {{ etape.dates.end.y }}</p>
|
||||
</div>
|
||||
<p v-html="partie.text"></p>
|
||||
</div>
|
||||
</main>
|
||||
<div class="brand-pattern" :style="{ backgroundColor: etape.couleur }">
|
||||
<div class="pattern"></div>
|
||||
</div>
|
||||
<div class="locality">
|
||||
<div class="top-triangle"></div>
|
||||
<div class="locality-title">
|
||||
<h1>{{etape.title}} <em>({{ etape.adresse.postal_code }})</em></h1>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<main>
|
||||
<div v-if="etape.sensibleMap" id="sensible-map">
|
||||
<figure>
|
||||
<vue-image-zoomer
|
||||
:regular="etape.sensibleMap.url"
|
||||
:zoom="etape.sensibleMap.url"
|
||||
:zoom-amount="3.5"
|
||||
alt="Carte sensible du territoire"
|
||||
hover-message="Survolez pour zoomer dans la carte"
|
||||
/>
|
||||
<figcaption class="caption">{{ etape.sensibleMap.alt }}</figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
<div v-for="partie in etape.parties" class="partie" @click="handleImageClick">
|
||||
|
||||
<div v-if="Object.keys(partie.chiffresCles).length" class="chiffres-cles">
|
||||
<h3>
|
||||
<div class="underline" :style="{ backgroundColor: etape.couleur }"></div>
|
||||
<p>Chiffres clés</p>
|
||||
</h3>
|
||||
<div>
|
||||
<div v-for="chiffre in partie.chiffresCles">
|
||||
<div v-html="chiffre.split('<br />')[0]" class="chiffre" :style="{ borderLeft: `solid 10px ${etape.couleur}` }"></div>
|
||||
<p v-html="chiffre.split('<br />')[1]" class="chiffre-caption" :style="{ borderLeft: `solid 10px ${etape.couleur}` }"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="partie-title">
|
||||
<h3>
|
||||
<div class="underline" :style="{ backgroundColor: etape.couleur }"></div>
|
||||
<p v-html="partie.title"></p>
|
||||
</h3>
|
||||
</div>
|
||||
<div v-html="partie.text" v-alt class="partie-content"></div>
|
||||
<swiper-container
|
||||
v-if="partie.diaporama.length"
|
||||
class="diaporama"
|
||||
:slidesPerView="1.5"
|
||||
:centeredSlides="true"
|
||||
:loop="true"
|
||||
:navigation="true"
|
||||
:pagination="true"
|
||||
:injectStyles="[`.swiper-button-next, .swiper-button-prev { z-index: 11; }`]"
|
||||
>
|
||||
<swiper-slide v-for="image in partie.diaporama" style="width: 100%">
|
||||
<figure>
|
||||
<img :src="image.url" :alt="image.alt">
|
||||
<figcaption class="caption">{{ image.alt }}</figcaption>
|
||||
</figure>
|
||||
</swiper-slide>
|
||||
</swiper-container>
|
||||
<div v-if="partie.videos.length" class="videos">
|
||||
<iframe v-for="video in partie.videos" :src="video" frameborder="0" width="100%" style="aspect-ratio: 16 / 9;"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="brand-pattern pattern-bottom" :style="{ backgroundColor: etape.couleur }">
|
||||
<div class="pattern"></div>
|
||||
</div>
|
||||
|
||||
<div v-if="etape.previous || etape.next" class="related-etape-links">
|
||||
<div v-if="etape.previous" class="card previous" @click="store.fetchEtapeData(etape.previous.nid)">
|
||||
<div class="icon">
|
||||
<div :style="{ backgroundColor: etape.previous.couleur }"></div>
|
||||
<div :style="{ backgroundColor: etape.previous.couleur }"></div>
|
||||
<div :style="{ backgroundColor: etape.previous.couleur }"></div>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="infos">
|
||||
<div class="titre">{{ etape.previous.title }} <span>({{ etape.previous.postalCode }})</span></div>
|
||||
<div class="date">Du {{ etape.previous.dates.start.d }} {{ etape.previous.dates.start.m }}<br>au {{ etape.previous.dates.end.d }} {{ etape.previous.dates.end.m }} {{ etape.previous.dates.end.y }}</div>
|
||||
</div>
|
||||
<div class="vignette">
|
||||
<img :src="etape.previous.vignette.url" :alt="etape.previous.vignette.alt">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="etape.next" class="card next" @click="store.fetchEtapeData(etape.next.nid)">
|
||||
<div class="icon">
|
||||
<div :style="{ backgroundColor: etape.next.couleur }"></div>
|
||||
<div :style="{ backgroundColor: etape.next.couleur }"></div>
|
||||
<div :style="{ backgroundColor: etape.next.couleur }"></div>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="infos">
|
||||
<div class="titre">{{ etape.next.title }} <span>({{ etape.next.postalCode }})</span></div>
|
||||
<div class="date">Du {{ etape.next.dates.start.d }} {{ etape.next.dates.start.m }}<br>au {{ etape.next.dates.end.d }} {{ etape.next.dates.end.m }} {{ etape.next.dates.end.y }}</div>
|
||||
</div>
|
||||
<div class="vignette">
|
||||
<img :src="etape.next.vignette.url" :alt="etape.next.vignette.alt">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div v-if="loading">Loading...</div>
|
||||
<div v-if="error">{{ error }}</div>
|
||||
{{etape.adresse.locality}}
|
||||
-->
|
||||
|
||||
<div><pre>{{href}}</pre></div>
|
||||
|
||||
<!-- <div><pre>{{href}}</pre></div>
|
||||
|
||||
|
||||
<div><pre><b>GEOFIELD</b>{{etape.geofield}}</pre></div>
|
||||
@@ -46,12 +132,12 @@
|
||||
<div><pre><b>PARTIES</b>{{etape.parties}}</pre></div>
|
||||
<div><pre><b>SAISON</b>{{etape.saison}}</pre></div>
|
||||
<div><pre><b>THEMATIQUES</b>{{etape.thematiques}}</pre></div>
|
||||
|
||||
|
||||
<div>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
</Transition>
|
||||
|
||||
<ImageModale :isOpen="isModaleOpen" :image="currentImage" :swiperContent="swiperPopupContent" @close="closeImageModale" />
|
||||
|
||||
<Transition>
|
||||
<div v-if="isPageValid">
|
||||
<header>
|
||||
@@ -65,10 +151,19 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, onMounted } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useContentStore } from '../stores/content';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import ImageModale from './ImageModale.vue';
|
||||
|
||||
import { VueImageZoomer } from 'vue-image-zoomer'
|
||||
import 'vue-image-zoomer/dist/style.css';
|
||||
|
||||
// web element usage bc its 2024
|
||||
// (idk how it works but it does)
|
||||
import { register } from 'swiper/element/bundle';
|
||||
register();
|
||||
|
||||
const router = useRouter();
|
||||
const store = useContentStore();
|
||||
@@ -76,60 +171,126 @@ const route = useRoute();
|
||||
|
||||
const { loading, error, href, etape, page } = storeToRefs(store);
|
||||
|
||||
watch(() => route.params.id, (newId) => {
|
||||
if (!newId) {
|
||||
store.emptyAll();
|
||||
watch(
|
||||
() => route.params.id,
|
||||
(newId) => {
|
||||
if (!newId) {
|
||||
store.emptyAll();
|
||||
} else {
|
||||
store.fetchEtapeData(newId);
|
||||
if (!etape.value.data) {
|
||||
store.fetchStaticData(newId);
|
||||
if (!etape.value?.data) {
|
||||
store.fetchStaticData(newId);
|
||||
}
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
() => etape.value.couleur,
|
||||
(newColor) => {
|
||||
if (newColor) {
|
||||
document.documentElement.style.setProperty('--etape-couleur', etape.value.couleur);
|
||||
}
|
||||
window.scrollTo({top: 0, behavior: 'smooth'});
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
watch(() => href.value, (newHref) => {
|
||||
const relativePath = newHref.split('.fr')[1];
|
||||
if (relativePath && (relativePath !== '' || relativePath !== '/')) {
|
||||
router.push(relativePath);
|
||||
watch(
|
||||
() => href.value,
|
||||
(newHref) => {
|
||||
const relativePath = newHref.split('.fr')[1];
|
||||
if (relativePath && relativePath !== '' && relativePath !== '/') {
|
||||
router.push(relativePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
const isEtapeValid = computed(() => {
|
||||
return etape.value && !isObjectEmpty(etape.value);
|
||||
});
|
||||
const isObjectEmpty = (obj) => {
|
||||
if (!obj || typeof obj !== 'object') return true;
|
||||
|
||||
const isPageValid = computed(() => {
|
||||
return page.value && !isObjectEmpty(page.value);
|
||||
});
|
||||
return !Object.keys(obj).some((key) => {
|
||||
const value = obj[key];
|
||||
if (Array.isArray(value)) return value.length > 0;
|
||||
if (typeof value === 'object') return !isObjectEmpty(value);
|
||||
return value !== null && value !== undefined && value !== '';
|
||||
});
|
||||
};
|
||||
|
||||
// Utility function to check if an object and its children are empty
|
||||
function isObjectEmpty(obj) {
|
||||
if (obj === null || obj === undefined || typeof obj !== 'object') {
|
||||
return true;
|
||||
const isEtapeValid = computed(() => etape.value && !isObjectEmpty(etape.value));
|
||||
const isPageValid = computed(() => page.value && !isObjectEmpty(page.value));
|
||||
|
||||
const vAlt = {
|
||||
mounted : (el) => {
|
||||
const images = el.querySelectorAll('img');
|
||||
images.forEach((img) => {
|
||||
const altText = img.getAttribute('alt');
|
||||
if (altText) {
|
||||
const paragraph = document.createElement('p');
|
||||
paragraph.classList.add('caption');
|
||||
paragraph.textContent = altText;
|
||||
img.after(paragraph);
|
||||
}
|
||||
});
|
||||
}
|
||||
for (const key in obj) {
|
||||
if (Object.hasOwnProperty.call(obj, key)) {
|
||||
const value = obj[key];
|
||||
if (Array.isArray(value)) {
|
||||
if (value.length > 0) {
|
||||
return false;
|
||||
}
|
||||
} else if (typeof value === 'object') {
|
||||
if (!isObjectEmpty(value)) {
|
||||
return false;
|
||||
}
|
||||
} else if (value !== null && value !== undefined && value !== '') {
|
||||
return false;
|
||||
};
|
||||
|
||||
const isModaleOpen = ref(false);
|
||||
const currentImage = ref({ src: '', alt: '' });
|
||||
const swiperPopupContent = ref([]);
|
||||
|
||||
const body = document.querySelector('body');
|
||||
const hamburger = document.querySelector('#hamburger');
|
||||
const menu = document.querySelector('#menu');
|
||||
|
||||
const openImageModale = (src, alt, swiperMedia) => {
|
||||
currentImage.value = { src, alt };
|
||||
swiperPopupContent.value = swiperMedia;
|
||||
isModaleOpen.value = true;
|
||||
body.classList.add('no-scroll');
|
||||
hamburger.style.opacity = 0;
|
||||
menu.style.display = "none";
|
||||
};
|
||||
|
||||
const closeImageModale = () => {
|
||||
isModaleOpen.value = false;
|
||||
swiperPopupContent.value = [];
|
||||
body.classList.remove('no-scroll');
|
||||
menu.style.display = "flex";
|
||||
setTimeout(() => {
|
||||
hamburger.style.opacity = 1;
|
||||
}, 300);
|
||||
};
|
||||
|
||||
const handleImageClick = (event) => {
|
||||
const img = event.target;
|
||||
if (img.tagName === 'IMG') {
|
||||
const isSwiper = img.parentElement.parentElement.tagName === 'SWIPER-SLIDE';
|
||||
let swiperMedia = [];
|
||||
if (isSwiper) {
|
||||
const swiperEl = img.parentElement.parentElement.parentElement;
|
||||
for (let swiperSlide of swiperEl.children) {
|
||||
swiperMedia.push({src: swiperSlide.querySelector('img').getAttribute('src'), alt: swiperSlide.querySelector('figcaption')?.textContent});
|
||||
}
|
||||
}
|
||||
openImageModale(img.src, img.alt, swiperMedia);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
/*
|
||||
return {
|
||||
loading,
|
||||
error,
|
||||
etape,
|
||||
page,
|
||||
isEtapeValid,
|
||||
isPageValid
|
||||
};
|
||||
*/
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
<style scss>
|
||||
.v-enter-active,
|
||||
.v-leave-active {
|
||||
transition: all 0.3s ease;
|
||||
@@ -145,4 +306,23 @@ function isObjectEmpty(obj) {
|
||||
transform: translateY(0%);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
:root {
|
||||
--swiper-navigation-color: #1a1918; /* cf main.scss */
|
||||
--swiper-pagination-color: var(--etape-couleur);
|
||||
--swiper-navigation-top-offset: calc(100% - 1.5rem);
|
||||
--swiper-navigation-sides-offset: 5vw; /* cf main.scss */
|
||||
}
|
||||
|
||||
.diaporama {
|
||||
--swiper-navigation-size: 1.5rem;
|
||||
}
|
||||
|
||||
swiper-slide img:not(.popup-img) { /* cf main.scss */
|
||||
cursor: pointer;
|
||||
transition: transform 0.3s ease-out;
|
||||
&:hover {
|
||||
transform: scale(1.01);
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -4,6 +4,8 @@ $body-margin-x: 30px;
|
||||
$body-margin-y: 5px;
|
||||
$body-margin-bottom: 4vh;
|
||||
|
||||
$modale-x-padding: 5vw;
|
||||
|
||||
$sm-font-size: 0.8rem;
|
||||
$m-font-size: 1.4rem;
|
||||
$l-font-size: 1.8rem;
|
||||
@@ -23,6 +25,9 @@ body{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow-y: scroll;
|
||||
&.no-scroll {
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.layout-container {
|
||||
> header {
|
||||
z-index: 2;
|
||||
@@ -127,7 +132,7 @@ body{
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 2.4rem;
|
||||
transition: transform 0.3s ease-out;
|
||||
transition: transform 0.3s ease-out, opacity 0.3s ease-out;
|
||||
> div {
|
||||
width: 100%;
|
||||
height: 3px;
|
||||
@@ -469,15 +474,13 @@ body{
|
||||
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);
|
||||
}
|
||||
> div:first-of-type {
|
||||
height: 8px;
|
||||
clip-path: polygon(0 0, 100% 0, 50% 100%);
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
> div:last-of-type {
|
||||
height: 8px;
|
||||
clip-path: polygon(0 0, 100% 0, 50% 100%);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -503,127 +506,410 @@ body{
|
||||
}
|
||||
}
|
||||
}
|
||||
> #content-modale > div {
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
top: 15vh;
|
||||
left: 25vw;
|
||||
width: 50vw;
|
||||
background-color: white;
|
||||
img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
object-fit: cover;
|
||||
}
|
||||
> div {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
> header {
|
||||
margin-bottom: 3rem;
|
||||
> .cover {
|
||||
max-height: 60vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
> #content-modale {
|
||||
> div:not(.image-viewer-wrapper, .image-modale) {
|
||||
padding-bottom: 40vh;
|
||||
background-color: red;
|
||||
> .content-wrapper {
|
||||
left: 25vw;
|
||||
width: 50vw;
|
||||
top: 15vh;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
}
|
||||
> .cartouche {
|
||||
position: absolute;
|
||||
top: 2rem;
|
||||
padding: 1rem 1.5rem;
|
||||
background-color: $brand-color;
|
||||
z-index: 1;
|
||||
> p {
|
||||
margin-block-start: 0;
|
||||
margin-block-end: 0;
|
||||
}
|
||||
> p:last-of-type {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
> .brand-pattern {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 120px;
|
||||
> .pattern {
|
||||
display: block;
|
||||
background-color: white;
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url(/themes/custom/caravane/assets/imgs/motif-caravane-invert-tile.png);
|
||||
background-size: 300px;
|
||||
background-size: repeat;
|
||||
height: auto;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
> .locality {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 50%;
|
||||
margin-left: 25%;
|
||||
margin-top: -245px;
|
||||
> .top-triangle {
|
||||
display: block;
|
||||
> div {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
display: flex;
|
||||
clip-path: polygon(-1% 100%, 50% 0, 101% 100%);
|
||||
background-color: white;
|
||||
margin-bottom: -1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
> .locality-title {
|
||||
min-height: 115px;
|
||||
display: block;
|
||||
background-color: white;
|
||||
padding: 1rem 2rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
> h1 {
|
||||
> header {
|
||||
// margin-bottom: 3rem;
|
||||
> .cover {
|
||||
max-height: 60vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
}
|
||||
> .cartouche {
|
||||
position: absolute;
|
||||
top: 2rem;
|
||||
padding: 1rem 1.5rem;
|
||||
background-color: $brand-color;
|
||||
z-index: 1;
|
||||
> p {
|
||||
margin-block-start: 0;
|
||||
margin-block-end: 0;
|
||||
}
|
||||
> p:last-of-type {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
> .locality {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 50%;
|
||||
margin-left: 25%;
|
||||
margin-top: -245px;
|
||||
> .top-triangle {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
display: flex;
|
||||
clip-path: polygon(-1% 100%, 50% 0, 101% 100%);
|
||||
background-color: white;
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
> .locality-title {
|
||||
min-height: 115px;
|
||||
display: block;
|
||||
background-color: white;
|
||||
padding: 1rem 2rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
> h1 {
|
||||
width: 100%;
|
||||
font-size: $xl-font-size;
|
||||
margin-block-start: 0;
|
||||
margin-block-end: 0;
|
||||
font-family: 'Joost', sans-serif;
|
||||
text-align: center;
|
||||
> em {
|
||||
font-style: normal;
|
||||
font-weight: lighter;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
> main {
|
||||
width: 100%;
|
||||
padding: 0 $modale-x-padding;
|
||||
box-sizing: border-box;
|
||||
> #sensible-map {
|
||||
width: calc(100% + $modale-x-padding);
|
||||
margin-left: calc(($modale-x-padding / 2) * -1);
|
||||
margin-top: calc($modale-x-padding / 2);
|
||||
> figure {
|
||||
margin: 0;
|
||||
.vh--message {
|
||||
font-size: $sm-font-size;
|
||||
top: 1rem;
|
||||
left: 1rem;
|
||||
bottom: unset;
|
||||
background-color: rgba(255, 255, 255, 0.6);
|
||||
color: $main-color-light;
|
||||
}
|
||||
> figcaption {
|
||||
margin-left: calc($modale-x-padding / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
> .partie {
|
||||
width: 100%;
|
||||
font-size: $xl-font-size;
|
||||
margin-block-start: 0;
|
||||
margin-block-end: 0;
|
||||
font-family: 'Joost', sans-serif;
|
||||
text-align: center;
|
||||
> em {
|
||||
font-style: normal;
|
||||
font-weight: lighter;
|
||||
display: inline-block;
|
||||
> .partie-title,
|
||||
> .chiffres-cles {
|
||||
> h3 {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
> p {
|
||||
display: inline-block;
|
||||
font-size: $l-font-size;
|
||||
font-family: 'Joost', sans-serif;
|
||||
margin: 0;
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
padding: 0 0.5rem;
|
||||
}
|
||||
> .underline {
|
||||
z-index: 0;
|
||||
left: 0;
|
||||
top: 1.4rem;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
height: 0.8rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
> .chiffres-cles {
|
||||
> div {
|
||||
display: grid;
|
||||
gap: 2rem;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
align-content: flex-start;
|
||||
margin: 2rem 0;
|
||||
> div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
> .chiffre {
|
||||
padding-left: 1rem;
|
||||
font-size: $xl-font-size;
|
||||
font-weight: bold;
|
||||
font-family: 'Joost', sans-serif;
|
||||
margin: 0;
|
||||
> p {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
> .chiffre-caption {
|
||||
padding-left: 1rem;
|
||||
font-size: $sm-font-size;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
> .partie-content {
|
||||
img {
|
||||
margin-top: 2rem;
|
||||
cursor: pointer;
|
||||
transition: transform 0.3s ease-out;
|
||||
&:hover {
|
||||
transform: scale(1.01);
|
||||
}
|
||||
}
|
||||
}
|
||||
> .diaporama {
|
||||
width: calc(100% + 2 * #{$modale-x-padding});
|
||||
margin-top: 5rem;
|
||||
margin-bottom: 3rem;
|
||||
margin-left: -$modale-x-padding;
|
||||
figure {
|
||||
margin: 0 calc(#{$modale-x-padding} / 2);
|
||||
> img {
|
||||
width: 100%;
|
||||
}
|
||||
> figcaption {
|
||||
padding-bottom: 2rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
> .videos iframe {
|
||||
margin: 2rem 0;
|
||||
}
|
||||
}
|
||||
.caption {
|
||||
font-size: $sm-font-size;
|
||||
color: $main-color-light;
|
||||
margin-top: 0.2rem;
|
||||
margin-bottom: 1.8rem;
|
||||
}
|
||||
}
|
||||
.brand-pattern {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 120px;
|
||||
> .pattern {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url(/themes/custom/caravane/assets/imgs/motif-caravane-invert-tile.png);
|
||||
background-size: 300px;
|
||||
background-size: repeat;
|
||||
}
|
||||
}
|
||||
.pattern-bottom {
|
||||
width: calc(100% + $modale-x-padding * 2);
|
||||
margin-left: -$modale-x-padding;
|
||||
height: 180px;
|
||||
margin-top: -90px;
|
||||
}
|
||||
.related-etape-links {
|
||||
position: absolute;
|
||||
margin-top: -3rem;
|
||||
width: calc(100% - $modale-x-padding);
|
||||
margin-left: -$modale-x-padding;
|
||||
padding: 0 calc($modale-x-padding / 2);
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
> .card {
|
||||
width: 80%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
transition: transform 0.3s ease-out;
|
||||
&:hover {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
&.next {
|
||||
grid-column: 2 / span 1;
|
||||
justify-self: flex-end;
|
||||
}
|
||||
> .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);
|
||||
}
|
||||
}
|
||||
}
|
||||
> .card-content {
|
||||
z-index: 1;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
> .infos {
|
||||
width: 60%;
|
||||
text-align: center;
|
||||
> .titre {
|
||||
padding: 1rem 0.5rem;
|
||||
font-weight: bold;
|
||||
font-family: 'Joost', sans-serif;
|
||||
font-size: $m-font-size;
|
||||
> span {
|
||||
font-weight: lighter;
|
||||
}
|
||||
}
|
||||
> .date {
|
||||
font-size: $sm-font-size;
|
||||
font-family: 'Marianne', sans-serif;
|
||||
font-weight: lighter;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
}
|
||||
> .vignette {
|
||||
width: 40%;
|
||||
position: relative;
|
||||
> img {
|
||||
top: 0;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
> main {
|
||||
> .image-viewer-wrapper {
|
||||
backdrop-filter: blur(3px);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding: 0 5vw;
|
||||
box-sizing: border-box;
|
||||
> .partie {
|
||||
display: inline-block;
|
||||
> .partie-title {
|
||||
> h3 {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
> p {
|
||||
display: inline-block;
|
||||
font-size: $l-font-size;
|
||||
font-family: 'Joost', sans-serif;
|
||||
margin: 0;
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
padding: 0 0.5rem;
|
||||
}
|
||||
> .underline {
|
||||
z-index: 0;
|
||||
left: 0;
|
||||
top: 1.4rem;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
height: 1rem;
|
||||
height: 100%;
|
||||
z-index: 100;
|
||||
> .img-modale {
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
> .simple-viewer {
|
||||
> .img-wrapper {
|
||||
max-width: 60%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
> img {
|
||||
width: 100%;
|
||||
}
|
||||
> figcaption {
|
||||
margin: 0;
|
||||
background-color: white;
|
||||
font-size: $sm-font-size;
|
||||
padding: 0.5rem 1.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
> .swiper-viewer {
|
||||
z-index: 1;
|
||||
> .swiper-wrapper {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
swiper-container {
|
||||
height: 95%;
|
||||
swiper-slide {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
figure {
|
||||
margin-top: 3%;
|
||||
max-width: 60%;
|
||||
height: 80%;
|
||||
img {
|
||||
height: -webkit-fill-available;
|
||||
max-width: 100%;
|
||||
margin-bottom: -5px;
|
||||
object-fit: cover;
|
||||
}
|
||||
figcaption {
|
||||
margin: 0;
|
||||
background-color: white;
|
||||
font-size: $sm-font-size;
|
||||
padding: 0.5rem 1.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
> .close-button {
|
||||
position: fixed;
|
||||
top: 2rem;
|
||||
right: $body-margin-x;
|
||||
background-color: unset;
|
||||
border: none;
|
||||
display: block;
|
||||
height: 3rem;
|
||||
width: 3rem;
|
||||
border-radius: 1.5rem;
|
||||
cursor: pointer;
|
||||
background-color: white;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 2;
|
||||
> div {
|
||||
display: block;
|
||||
height: 2px;
|
||||
border-radius: 4px;
|
||||
width: 60%;
|
||||
background-color: $main-color;
|
||||
position: absolute;
|
||||
transition: transform 0.3s ease;
|
||||
&:nth-of-type(1) {
|
||||
transform: rotate(45deg) scale(1);
|
||||
}
|
||||
&:nth-of-type(2) {
|
||||
transform: rotate(-45deg) scale(1);
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
> div:nth-of-type(1) {
|
||||
transform: rotate(45deg) scale(1.1);
|
||||
}
|
||||
> div:nth-of-type(2) {
|
||||
transform: rotate(-45deg) scale(1.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user