FreedomBox/plinth/templates/notifications.html
Fioddor Superconcentrado 9cde408c86
notifications: i18n: Mark app names and extra data for translation
Helps: 1938.

Testing:
- Yapf applied.
- Flake8 without errors or warnings for changed files.
- (Unit) tests run without errors.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Translate app_name with 'translate:' prefix]
[sunil: Also mark additional data]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-20 11:57:17 -07:00

61 lines
2.0 KiB
HTML

{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}
{# Template to display notifications under the navbar #}
{% load i18n %}
{% load static %}
{% if notifications %}
<div class="notifications dropdown">
<ul class="dropdown-menu" role="menu">
{% for note in notifications %}
<li class="notification notification-{{ note.severity }}">
{% if note.data.app_name %}
<div class="app-name">
{% if note.data.app_icon %}
<div class="app-icon fa {{ note.data.app_icon }}"></div>
{% elif note.data.app_icon_filename %}
<img src="{% static 'theme/icons/' %}{{ note.data.app_icon_filename }}.svg"
alt="{{ note.data.app_name }}"
class="notification-icon" />
{% endif %}
{{ note.data.app_name }}
</div>
{% endif %}
{% if note.body %}
{{ note.body.content.decode|safe }}
{% else %}
<div class="notification-title">{{ note.title }}</div>
{% if note.message %}
<p>{{ note.message }}</p>
{% endif %}
{% if note.actions %}
<p>
{% for action in note.actions %}
{% if action.type == "dismiss" %}
<a href="{% url 'notification_dismiss' id=note.id %}?next={{ request.path|iriencode }}"
role="button" class="btn btn-default">
{% trans "Dismiss" %}
</a>
{% else %}
<a href="{% url action.url %}" role="button"
class="btn btn-{{ action.class|default:'default' }}">
{{ action.text }}
</a>
{% endif %}
{% endfor %}
</p>
{% endif %}
{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% endif %}