Compare commits

..

2 Commits

Author SHA1 Message Date
Valentin f9c98d6941 essai de fix du pb de clic sur les liens statics 2024-10-11 11:51:02 +02:00
Valentin 9f8f9f3a62 fixed menu burger disappear when logged in 2024-10-11 11:32:45 +02:00
2 changed files with 22 additions and 11 deletions

View File

@ -53,6 +53,8 @@ import router from './router/router';
const mapStore = useMapStore();
app.mount('#content-modale');
setHamburgerWhenLogged();
Drupal.behaviors.customLeafletInteraction = {
attach: function(context, settings) {
$(context).on('leafletMapInit', function (e, settings, map, mapid, markers) {
@ -97,11 +99,13 @@ import router from './router/router';
function processStaticLinks(store, map) {
let general_link_fields = document.querySelectorAll('#menu > ul > li > a');
for (let field of general_link_fields) {
let general_link_href = field.getAttribute('href');
for (let i =1; i < general_link_fields.length; i ++) {
let general_link_href = general_link_fields[i].getAttribute('href');
const nid = general_link_href.charAt(general_link_href.length-1);
field.setAttribute('data-node-nid', parseInt(nid));
field.addEventListener('click', (e) => onClickContentLink(e, store, map, 'static'));
if (!isNaN(nid)) {
general_link_fields[i].setAttribute('data-node-nid', parseInt(nid));
general_link_fields[i].addEventListener('click', (e) => onClickContentLink(e, store, map, 'static'));
}
}
}
@ -162,6 +166,20 @@ import router from './router/router';
})
}
function setHamburgerWhenLogged() {
if (drupalSettings.user.uid != 0) {
const menuBurger = document.querySelector('#hamburger');
const menuTitle = document.querySelector('#menu-title');
const menuContainer = document.querySelector('#block-caravane-mainnavigation > #menu > ul');
const header = document.querySelector('.dialog-off-canvas-main-canvas');
const headerTop = header.getBoundingClientRect().top;
menuTitle.style.top = `${headerTop}px`;
menuBurger.style.top = `${headerTop}px`;
menuContainer.style.paddingTop = `${headerTop}px`;
}
}
function setupEtapeMapPopup(store, map) {
const icons = document.querySelectorAll('.leaflet-map-divicon');
for (let icon of icons) {

View File

@ -138,15 +138,8 @@ const handleMapMovement = () => {
watch(
() => href.value,
() => {
console.log("NEW HREF");
console.log(href.value);
isModaleEtape = !isObjectEmpty(etape.value);
console.log("CAS 1", !wasModaleEtape && isModaleEtape);
console.log("CAS 2", wasModaleEtape && isModaleEtape);
console.log("CAS 3", wasModaleEtape && !isModaleEtape);
if (!wasModaleEtape && isModaleEtape) {
document.documentElement.style.setProperty('--modale-enter-delay', `${duration.value}s`);
mapState.zoomToPlace(map.value, etape.value.coordinates.lat, etape.value.coordinates.lon);