diff --git a/app/templates/common/fragments/toasts.html b/app/templates/common/fragments/toasts.html index dc8c248..84727bc 100644 --- a/app/templates/common/fragments/toasts.html +++ b/app/templates/common/fragments/toasts.html @@ -1,22 +1,20 @@ {% load i18n %} {% load toast_bg %} {% if messages %} -
- {% for message in messages %} - - {% endfor %} -
+ {% for message in messages %} + + {% endfor %} {% endif %} diff --git a/app/templates/includes/toasts.html b/app/templates/includes/toasts.html index 9b12568..010ad5b 100644 --- a/app/templates/includes/toasts.html +++ b/app/templates/includes/toasts.html @@ -1,3 +1,6 @@ -
+
+
+ +
+ diff --git a/frontend/src/application/bootstrap.js b/frontend/src/application/bootstrap.js index 38b66ee..415c578 100644 --- a/frontend/src/application/bootstrap.js +++ b/frontend/src/application/bootstrap.js @@ -7,12 +7,15 @@ function initiateToasts() { const toastList = [...toastElList].map(toastEl => new bootstrap.Toast(toastEl)); // eslint-disable-line no-undef for (let i = 0; i < toastList.length; i++) { - toastList[i].show(); - toastList[i]._element.addEventListener('hidden.bs.toast', (event) => { - event.target.remove(); - }); + if (toastList[i].isShown() === false) { + toastList[i].show(); + toastList[i]._element.addEventListener('hidden.bs.toast', (event) => { + event.target.remove(); + }); + } } } +document.addEventListener('DOMContentLoaded', initiateToasts, false); document.addEventListener('htmx:afterSwap', initiateToasts, false); initiateToasts();