This commit is contained in:
2026-09-29 04:35:35 +02:00
parent 73c0659d4a
commit 6c813143eb
51 changed files with 3708 additions and 743 deletions
+8 -3
View File
@@ -13,6 +13,9 @@
@else
<button class="notif-page-tab active" data-tab="system">{{ t('nav.notif_tab_system') }}</button>
@endif
@if(session && session.admin)
<button class="notif-page-tab @if(activeTab === 'admin') active @endif" data-tab="admin">Admin</button>
@endif
</div>
<div id="notifications-container" class="posts notifications-list-full" data-page="{{ pagination.page }}" data-tab="{{ activeTab }}">
@include(snippets/notifications-list)
@@ -55,16 +58,18 @@
});
});
// Mark all read
// Mark all read (current tab only)
const btn = document.getElementById('mark-all-read-page');
if (btn) {
btn.onclick = async () => {
const res = await fetch('/api/notifications/read', { method: 'POST' });
const activeTabEl = document.querySelector('.notif-page-tab.active');
const tab = activeTabEl ? activeTabEl.dataset.tab : container.dataset.tab;
const res = await fetch('/api/notifications/read?tab=' + encodeURIComponent(tab), { method: 'POST' });
const data = await res.json();
if (data.success) {
document.querySelectorAll('.notif-item.unread').forEach(el => el.classList.remove('unread'));
if (window.NotificationSystemInstance) {
window.NotificationSystemInstance.markAllReadUI();
window.NotificationSystemInstance.markAllReadUI(tab);
}
}
};