Add in mark as reaad button to list view, use ajax to preform the action without page refresh.

This commit is contained in:
2025-11-02 09:11:48 +00:00
parent 61ad033520
commit f0fc70eac6
7 changed files with 212 additions and 27 deletions

View File

@@ -31,7 +31,8 @@
aria-expanded="false">
<i class="bi bi-bell fs-5 position-relative">
{{ if gt .NotificationCount 0 }}
<span class="position-absolute top-0 start-0 translate-middle badge rounded-pill bg-warning text-dark badge-small">
<span id="notification-count"
class="position-absolute top-0 start-0 translate-middle badge rounded-pill bg-warning text-dark badge-small">
{{ if gt .NotificationCount 15 }}15+{{ else }}{{ .NotificationCount }}{{ end }}
</span>
{{ end }}
@@ -41,7 +42,6 @@
aria-labelledby="notificationDropdown">
<li class="dropdown-header text-center fw-bold">Notifications</li>
<li><hr class="dropdown-divider"></li>
{{ $total := len .Notifications }}
{{ range $i, $n := .Notifications }}
<li class="px-3 py-2">
@@ -55,15 +55,11 @@
</div>
</a>
</li>
{{ if lt (add $i 1) $total }}
<li><hr class="dropdown-divider"></li>
{{ if lt (add $i 1) $total }}<li><hr class="dropdown-divider"></li>{{ end }}
{{ end }}
{{ end }}
{{ if not .Notifications }}
<li class="text-center text-muted py-2">No notifications</li>
{{ end }}
<li><hr class="dropdown-divider"></li>
<li class="text-center"><a href="/account/notifications" class="dropdown-item">View all notifications</a></li>
</ul>
@@ -75,7 +71,8 @@
aria-expanded="false">
<i class="bi bi-envelope fs-5 position-relative">
{{ if gt .MessageCount 0 }}
<span class="position-absolute top-0 start-0 translate-middle badge rounded-pill bg-danger text-dark badge-small">
<span id="message-count"
class="position-absolute top-0 start-0 translate-middle badge rounded-pill bg-danger text-dark badge-small">
{{ if gt .MessageCount 15 }}15+{{ else }}{{ .MessageCount }}{{ end }}
</span>
{{ end }}
@@ -85,7 +82,6 @@
aria-labelledby="messageDropdown">
<li class="dropdown-header text-center fw-bold">Messages</li>
<li><hr class="dropdown-divider"></li>
{{ if .Messages }}
{{ range $i, $m := .Messages }}
<li class="px-3 py-2">
@@ -103,15 +99,15 @@
{{ else }}
<li class="text-center text-muted py-2">No messages</li>
{{ end }}
<li><hr class="dropdown-divider"></li>
<li class="text-center"><a href="/account/messages" class="dropdown-item">View all messages</a></li>
</ul>
</div>
<!-- User Greeting/Dropdown -->
<!-- User Dropdown -->
<div class="dropdown">
<a class="nav-link dropdown-toggle text-dark" href="#" id="userDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<a class="nav-link dropdown-toggle text-dark" href="#" id="userDropdown" role="button"
data-bs-toggle="dropdown" aria-expanded="false">
Hello, {{ .User.Username }}
</a>
<ul class="dropdown-menu dropdown-menu-end shadow-sm" aria-labelledby="userDropdown">