show only one flask fixed message

This commit is contained in:
Jordan Blasenhauer 2024-02-15 10:53:56 +01:00
parent 1aa86da116
commit 3db316490d
3 changed files with 10 additions and 3 deletions

View file

@ -222,6 +222,15 @@ class FlashMsg {
//animate message button if message + never opened
window.addEventListener("load", (e) => {
if (Number(this.flashCount.textContent) > 0) this.animeBtn();
// display only one fixed flash message
const flashFixedEls = document.querySelectorAll(
"[data-flash-message-fixed]",
);
if (flashFixedEls.length > 1) {
flashFixedEls.forEach((el, i) => {
if (i > 0) el.remove();
});
}
});
//stop animate if clicked once
this.openBtn.addEventListener("click", (e) => {

View file

@ -314,7 +314,6 @@ class ServiceModal {
}
setIsDraft(isDraft, method) {
console.log(isDraft, method);
const draftVal = isDraft ? "yes" : "no";
document.querySelectorAll('input[name="is_draft"]').forEach((inp) => {
@ -322,8 +321,6 @@ class ServiceModal {
inp.value = draftVal;
});
console.log("f");
//Update draft button
const btn = document.querySelector("button[data-toggle-draft-btn]");

View file

@ -49,6 +49,7 @@
role="alert"
aria-description="login message alert"
data-flash-message
data-flash-message-fixed
class="{% if category == 'error' %} bg-red-500 {%else%} bg-green-500 {%endif %} p-4 mb-1 md:mb-3 md:mr-3 z-[1001] flex flex-col fixed bottom-0 right-0 w-full md:w-1/2 max-w-[300px] min-h-20 my-2 border rounded-lg hover:scale-102 transition shadow-md break-words dark:brightness-90"
>
<div class="flex justify-between align-top items-start">