fix: remove notifications link from user menu, add view-all button to notification dropdown, fix admin link
This commit is contained in:
@@ -3300,4 +3300,21 @@ input[type="range"]::-moz-range-track {
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notif-view-all {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 10px 16px;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
color: var(--accent);
|
||||||
|
text-decoration: none;
|
||||||
|
border-top: 1px solid var(--border-color);
|
||||||
|
transition: background var(--transition);
|
||||||
|
}
|
||||||
|
|
||||||
|
.notif-view-all:hover {
|
||||||
|
background: var(--bg-hover);
|
||||||
|
color: var(--accent-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,14 +48,14 @@ function fetchNotifications() {
|
|||||||
list.innerHTML = '<div style="padding:40px 20px;text-align:center;color:var(--text-muted)">Could not load notifications.</div>';
|
list.innerHTML = '<div style="padding:40px 20px;text-align:center;color:var(--text-muted)">Could not load notifications.</div>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
renderNotifications(d.data || [], d.unread_count || 0);
|
renderNotifications(d.data || [], d.unread_count || 0, d.pagination?.total || 0);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
list.innerHTML = '<div style="padding:40px 20px;text-align:center;color:var(--danger)">Failed to load notifications.</div>';
|
list.innerHTML = '<div style="padding:40px 20px;text-align:center;color:var(--danger)">Failed to load notifications.</div>';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderNotifications(items, unreadCount) {
|
function renderNotifications(items, unreadCount, total) {
|
||||||
const list = document.getElementById('notifList');
|
const list = document.getElementById('notifList');
|
||||||
|
|
||||||
if (!items.length) {
|
if (!items.length) {
|
||||||
@@ -85,6 +85,13 @@ function renderNotifications(items, unreadCount) {
|
|||||||
+ (n.is_read ? '' : '<div class="notif-dot"></div>')
|
+ (n.is_read ? '' : '<div class="notif-dot"></div>')
|
||||||
+ '</div>';
|
+ '</div>';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (total > items.length) {
|
||||||
|
html += '<a href="/notifications" class="notif-view-all">'
|
||||||
|
+ 'View all notifications (' + total + ' total)'
|
||||||
|
+ '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
list.innerHTML = html;
|
list.innerHTML = html;
|
||||||
|
|
||||||
document.getElementById('markAllReadBtn').style.display = unreadCount > 0 ? 'inline-flex' : 'none';
|
document.getElementById('markAllReadBtn').style.display = unreadCount > 0 ? 'inline-flex' : 'none';
|
||||||
|
|||||||
@@ -169,11 +169,10 @@ if (!isset($user) || $user === null) {
|
|||||||
</div>
|
</div>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a href="/profile" class="dropdown-item"><i class="fas fa-user-cog"></i> My Account</a>
|
<a href="/profile" class="dropdown-item"><i class="fas fa-user-cog"></i> My Account</a>
|
||||||
<a href="/notifications" class="dropdown-item"><i class="fas fa-bell"></i> Notifications</a>
|
|
||||||
<?php if (is_admin() || is_super_admin()): ?>
|
<?php if (is_admin() || is_super_admin()): ?>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a href="/admin/audit" class="dropdown-item"><i class="fas fa-history"></i> Audit Log</a>
|
<a href="/admin/audit" class="dropdown-item"><i class="fas fa-history"></i> Audit Log</a>
|
||||||
<a href="/admin" class="dropdown-item"><i class="fas fa-cog"></i> Administration</a>
|
<a href="/admin/users" class="dropdown-item"><i class="fas fa-users-cog"></i> Administration</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<form method="POST" action="/logout" style="padding:0;margin:0">
|
<form method="POST" action="/logout" style="padding:0;margin:0">
|
||||||
|
|||||||
Reference in New Issue
Block a user