Add toast notification system
Django CI/CD / test (push) Successful in 35s
Django CI/CD / build-and-push (push) Successful in 54s

Add more toast types
This commit is contained in:
2026-05-11 13:22:42 +02:00
parent 4e3b0ddb08
commit f82c61ef1e
18 changed files with 1026 additions and 109 deletions
@@ -8,17 +8,22 @@
this.status = newStatus;
this.status_display = newStatusDisplay;
this.saving = true;
fetch(`/api/games/{{ game.id }}/status`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': '{{ csrf_token }}'
},
body: JSON.stringify({ status: newStatus })
}).then(() => {
document.body.dispatchEvent(new CustomEvent('status-changed'));
})
.finally(() => this.saving = false);
// TODO: migrate to hx-post + hx-on::after-request for HTMX-native toast handling
fetchWithHtmxTriggers(`/api/games/{{ game.id }}/status`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': '{{ csrf_token }}'
},
body: JSON.stringify({ status: newStatus })
})
.then(() => {
document.body.dispatchEvent(new CustomEvent('status-changed'));
})
.catch(() => {
console.error('Failed to update status');
})
.finally(() => this.saving = false);
}
}"
>
@@ -41,5 +46,4 @@
</div>
</button>
</div>
<div x-show="saving" style="display: none;">Saving...</div>
</div>