mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
Refactor notifications
This commit is contained in:
@ -39,17 +39,16 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<a href="{{ url('core:user_profile', user_id=user.id) }}">{{ user.get_display_name() }}</a>
|
||||
{% if user.notifications.exists() %}
|
||||
<a href="#" onclick="display_notif()">🔔 ({{ user.notifications.count() }})</a>
|
||||
<a href="#" onclick="display_notif()">🔔 ({{ user.notifications.filter(viewed=False).count() }})</a>
|
||||
<ul id="notif">
|
||||
{% for n in user.notifications.order_by('-id') %}
|
||||
{% for n in user.notifications.filter(viewed=False).order_by('-id') %}
|
||||
<li><a href="{{ url("core:notification", notif_id=n.id) }}">
|
||||
<span style="font-size: small; ">{{ n.date|date(DATE_FORMAT) }} {{
|
||||
n.date|time(DATETIME_FORMAT) }}</span><br>
|
||||
{{ n.text }}</a></li>
|
||||
{{ n }}</a></li>
|
||||
{% endfor %}
|
||||
<li><a href="{{ url('core:notification_list') }}">{% trans %}View more{% endtrans %}</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
<a href="{{ url('core:user_tools') }}">{% trans %}Tools{% endtrans %}</a>
|
||||
<a href="{{ url('core:logout') }}">{% trans %}Logout{% endtrans %}</a>
|
||||
<form action="{{ url('core:search') }}" method="GET">
|
||||
|
24
core/templates/core/notification_list.jinja
Normal file
24
core/templates/core/notification_list.jinja
Normal file
@ -0,0 +1,24 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}Notification list{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>{% trans %}Notification list{% endtrans %}</h3>
|
||||
<ul id="notifications">
|
||||
{% for n in notification_list %}
|
||||
{% if n.viewed %}
|
||||
<li>
|
||||
{% else %}
|
||||
<li style="background: lightgrey;">
|
||||
{% endif %}
|
||||
<a href="{{ url("core:notification", notif_id=n.id) }}">
|
||||
<span style="font-size: small; ">{{ n.date|date(DATE_FORMAT) }} {{
|
||||
n.date|time(DATETIME_FORMAT) }}</span><br>
|
||||
{{ n }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user