snapshot: preserve role-aware notification preferences and operational alerts

This commit is contained in:
Md Bayazid Bostame
2026-03-27 11:26:57 +01:00
parent fe3a8933fd
commit aa54f41731
25 changed files with 2958 additions and 633 deletions

View File

@@ -20,6 +20,58 @@
<a class="btn btn-secondary" href="/">{% trans "Zur Startseite" %}</a>
{% endif %}
{% if request.user.is_authenticated %}
<details class="app-notification-menu">
<summary class="app-notification-trigger" aria-label="{% trans 'Benachrichtigungen' %}">
<span class="app-notification-bell" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true">
<path d="M12 4.25a4.25 4.25 0 0 0-4.25 4.25v2.04c0 .83-.24 1.65-.69 2.35l-1.2 1.88a1.5 1.5 0 0 0 1.27 2.31h9.74a1.5 1.5 0 0 0 1.27-2.31l-1.2-1.88a4.34 4.34 0 0 1-.69-2.35V8.5A4.25 4.25 0 0 0 12 4.25Z" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M9.75 18.25a2.25 2.25 0 0 0 4.5 0" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</span>
{% if header_unread_notification_count %}
<span class="app-notification-count">{{ header_unread_notification_count }}</span>
{% endif %}
</summary>
<div class="app-notification-panel">
<div class="app-notification-panel-head">
<strong>{% trans "Benachrichtigungen" %}</strong>
{% if header_unread_notification_count %}
<form method="post" action="{% url 'mark_all_notifications_read' %}">
{% csrf_token %}
<input type="hidden" name="next" value="{{ request.get_full_path }}" />
<button type="submit">{% trans "Alle als gelesen" %}</button>
</form>
{% endif %}
</div>
{% if header_notifications %}
<div class="app-notification-list">
{% for notification in header_notifications %}
<article class="app-notification-item app-notification-{{ notification.level }}{% if notification.is_unread %} is-unread{% endif %}">
<div class="app-notification-copy">
<strong>{{ notification.title }}</strong>
{% if notification.body %}<p>{{ notification.body|truncatechars:140 }}</p>{% endif %}
<span>{{ notification.created_at|date:"d.m.Y H:i" }}</span>
</div>
<div class="app-notification-actions">
{% if notification.link_url %}
<a href="{{ notification.link_url }}">{% trans "Öffnen" %}</a>
{% endif %}
{% if notification.is_unread %}
<form method="post" action="{% url 'mark_notification_read' notification.id %}">
{% csrf_token %}
<input type="hidden" name="next" value="{{ request.get_full_path }}" />
<button type="submit">{% trans "Gelesen" %}</button>
</form>
{% endif %}
</div>
</article>
{% endfor %}
</div>
{% else %}
<div class="app-notification-empty">{% trans "Keine Benachrichtigungen vorhanden." %}</div>
{% endif %}
</div>
</details>
<details class="app-user-menu">
<summary class="app-user-trigger">
<span class="app-user-avatar" aria-hidden="true">