Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dashboard_siae): fix du bug d'affichage des tabs pour compléter les données des siaes #1093

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions lemarche/static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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');
})
}

Expand Down
4 changes: 2 additions & 2 deletions lemarche/templates/dashboard/home_siae.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h1 class="s-title-01__title h1"><strong>Tableau de bord</strong></h1>
{% if user.siaeuser_set.count %}
<section class="s-tabs-01 mb-3 mb-lg-5">
<div class="s-tabs-01__container container">
<div class="s-tabs-01__row row">
<div id="siaes_tabs" class="s-tabs-01__row row">
<div class="s-tabs-01__col col-12">
<ul class="s-tabs-01__nav nav nav-tabs" role="tablist">
{% for siaeuser in user.siaeuser_set.all %}
Expand All @@ -53,7 +53,7 @@ <h1 class="s-title-01__title h1"><strong>Tableau de bord</strong></h1>
</li>
{% endfor %}
<li class="nav-item" role="presentation">
<a class="nav-link" id="add-siae-btn" href="{% url 'dashboard_siaes:siae_search_by_siret' %}" aria-selected="false">
<a class="nav-link nav-link-external" id="add-siae-btn" href="{% url 'dashboard_siaes:siae_search_by_siret' %}" aria-selected="false">
<i class="ri-add-line"></i>
<span>Ajouter une structure</span>
</a>
Expand Down
Loading