FreedomBox/plinth/templates/operation-notification.html
Joseph Nuthalapati 13a575017c
ui: Dismiss notifications without page reload
- Delete only the <li> of the notification using HTMX.
- Notifications list stays open. User can dismiss another notification.
- Decrement notification counter using JavaScript after removing
  notification from the list.
- Added HTMX to every kind of notification.
- Tested dismissing notifications from the top, middle and bottom of the
  list.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil: Update comment format in .js file]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2026-02-03 14:16:55 -08:00

30 lines
749 B
HTML

{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}
{% load i18n %}
{% load static %}
<p>
{% if data.state == "waiting" %}
<span class="fa fa-clock-o"></span>
{% elif data.state == "running" %}
<span class="fa fa-refresh fa-spin processing"></span>
{% elif data.state == "completed" %}
{% endif %}
{{ message }}
</p>
{% if data.state == "completed" %}
<div class="btn-toolbar">
<a href="{% url 'notification_dismiss' id=id %}?next={{ request.path|iriencode }}"
hx-get="{% url 'notification_dismiss' id=id %}"
hx-target="#notification-{{ id }}"
hx-swap="delete swap:300ms"
role="button" class="btn btn-default">
{% trans "Dismiss" %}
</a>
</div>
{% endif %}