Refactor notifications

This commit is contained in:
Skia
2016-12-10 00:06:17 +01:00
parent b53531c391
commit d92a706920
13 changed files with 203 additions and 114 deletions

View File

@ -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()">&#x1f514; ({{ user.notifications.count() }})</a>
<a href="#" onclick="display_notif()">&#x1f514; ({{ 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">

View 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 %}