Commit 80e000c4 by Kálmán Viktor

dashboard: notifications on all pages

parent ec135334
......@@ -171,6 +171,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
'dashboard.context_processors.notifications',
)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
......
def notifications(request):
count = (request.user.notification_set.filter(status="new").count()
if request.user.is_authenticated() else None)
return {
'NEW_NOTIFICATIONS_COUNT': count
}
......@@ -33,8 +33,14 @@
</div><!-- .navbar-header -->
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav pull-right">
{% block navbar-ul %}
{% endblock %}
<li class="dropdown" id="notification-button">
<a href="{% url "dashboard.views.notifications" %}" style="color: white; font-size: 12px;" class="dropdown-toggle" data-toggle="dropdown">
{% trans "Notifications" %}{% if NEW_NOTIFICATIONS_COUNT > 0 %} <span class="badge">{{ NEW_NOTIFICATIONS_COUNT }}</span>{% endif %}
</a>
<ul class="dropdown-menu notification-messages">
<li>{% trans "Loading..." %}</li>
</ul>
</li>
</ul>
{% if user.is_authenticated %}
<a class="navbar-brand pull-right" href="{% url "logout" %}?next={% url "login" %}" style="color: white; font-size: 10px;"><i class="icon-signout icon-sign-out"></i> {% trans "Log out" %}</a>
......
......@@ -3,17 +3,6 @@
{% block title-page %}{% trans "Dashboard" %}{% endblock %}
{% block navbar-ul %}
<li class="dropdown" id="notification-button">
<a href="{% url "dashboard.views.notifications" %}" style="color: white; font-size: 12px;" class="dropdown-toggle" data-toggle="dropdown">
{% trans "Notifications" %}{% if new_notifications %} <span class="badge">{{ new_notifications }}</span>{% endif %}
</a>
<ul class="dropdown-menu notification-messages">
<li>{% trans "Loading..." %}</li>
</ul>
</li>
{% endblock %}
{% block content %}
<div class="body-content dashboard-index">
<div class="row">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment