From bc91e1070c5d9354b2fb5b563b69a2f9d51018f4 Mon Sep 17 00:00:00 2001 From: madjid-asa Date: Wed, 21 Feb 2024 10:53:30 +0100 Subject: [PATCH] =?UTF-8?q?fix(dashboard=5Fsiae):=20fix=20du=20bug=20d'aff?= =?UTF-8?q?ichage=20des=20tabs=20pour=20compl=C3=A9ter=20les=20donn=C3=A9e?= =?UTF-8?q?s=20des=20siaes=20(#1093)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(dashboard_siae) : fix du bug d'affichage des tabs pour compléter les données des siaes * fix edge case of external link --- lemarche/static/js/utils.js | 19 ++++++++++++------- lemarche/templates/dashboard/home_siae.html | 4 ++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lemarche/static/js/utils.js b/lemarche/static/js/utils.js index 4c4560ad1..76ee7c76e 100644 --- a/lemarche/static/js/utils.js +++ b/lemarche/static/js/utils.js @@ -23,7 +23,7 @@ window.addEventListener('DOMContentLoaded', function () { initModalMessages(); // reload click events and tooltip after htmx content loading as in semantic search - document.addEventListener('htmx:afterSwap', function(event) { + document.addEventListener('htmx:afterSwap', function (event) { initSuperBadges(); }); initSuperBadges(); @@ -79,17 +79,22 @@ const initSuperBadges = () => { }); }); - $('.s-tabs-01__nav .nav-item').on('click', function (event) { + $('#siaes_tabs .nav-item').on('click', function (event) { event.preventDefault() let tabContent = this.parentElement.parentElement.querySelector(".tab-content"); - let hasSuperBadgeTab = this.children[0].classList.contains("super-badge-tab"); + let childLink = this.children[0]; - if (hasSuperBadgeTab) { - tabContent.classList.add("super-badge-tab"); + if (childLink.classList.contains("nav-link-external")) { //edge case for external links + window.location = childLink.href; } else { - tabContent.classList.remove("super-badge-tab"); + let hasSuperBadgeTab = childLink.classList.contains("super-badge-tab"); + + if (hasSuperBadgeTab) { + tabContent.classList.add("super-badge-tab"); + } else { + tabContent.classList.remove("super-badge-tab"); + } } - $(this).tab('show'); }) } diff --git a/lemarche/templates/dashboard/home_siae.html b/lemarche/templates/dashboard/home_siae.html index 0af26e529..400c739f8 100644 --- a/lemarche/templates/dashboard/home_siae.html +++ b/lemarche/templates/dashboard/home_siae.html @@ -35,7 +35,7 @@

Tableau de bord

{% if user.siaeuser_set.count %}
-
+