Front-end notification system

Currently only creates notifications for logging events
Addresses #75
This commit is contained in:
Adarnof
2016-02-13 21:53:43 +00:00
parent 1d99ef69d1
commit 5e2c828c3b
10 changed files with 152 additions and 27 deletions

View File

@@ -47,6 +47,15 @@
<!-- /.navbar-header -->
<ul class="nav navbar-top-links navbar-right">
{% if notifications %}
<li class="nav-link active"><a href="{% url 'auth_notification_list' %}">
<span class="glyphicon glyphicon-alert"></span></a>
</li>
{% else %}
<li class="nav-link"><a href="{% url 'auth_notification_list' %}">
<span class="glyphicon glyphicon-warning-sign"></span></a>
</li>
{% endif %}
{% if user.is_authenticated %}
<li><a href="{% url 'auth_logout_user' %}">Logout</a></li>
{% else %}

View File

@@ -0,0 +1,74 @@
{% extends "public/base.html" %}
{% load staticfiles %}
{% block title %}Notifications{% endblock %}
{% block content %}
<div class="col-lg-12">
<h1 class="page-header text-center">Notifications</h1>
<div class="col-lg-12 container" id="example">
<div class="row">
<div class="col-lg-12">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#unread">Unread <b>({{unread|length}})</b></a></li>
<li><a data-toggle="tab" href="#read">Read <b>({{read|length}})</b></a></li>
</ul>
<div class="tab-content">
<div id="unread" class="tab-pane fade in active">
<div class="panel-body">
<div class="table-responsive">
<table class="table table-condensed table-hover table-striped">
<tr>
<th class="text-center">Timestamp</th>
<th class="text-center">Title</th>
<th class="text-center">View</th>
</tr>
{% for notif in unread %}
<tr class="{{ notif.level }}">
<td class="text-center">{{ notif.timestamp }}</td>
<td class="text-center">{{ notif.title }}</td>
<td class="text-center">
<a href="{% url 'auth_notification_view' notif.id %}">
<button type="button" class="btn btn-success" title="View">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
</a>
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
</div>
<div id="read" class="tab-pane fade">
<div class="panel-body">
<div class="table-responsive">
<table class="table table-condensed table-hover table-striped">
<tr>
<th class="text-center">Timestamp</th>
<th class="text-center">Title</th>
<th class="text-center">View</th>
</tr>
{% for notif in read %}
<tr class="{{ notif.level }}">
<td class="text-center">{{ notif.timestamp }}</td>
<td class="text-center">{{ notif.title }}</td>
<td class="text-center">
<a href="{% url 'auth_notification_view' notif.id %}">
<button type="button" class="btn btn-success" title="View">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
</a>
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,22 @@
{% extends "public/base.html" %}
{% load staticfiles %}
{% block title %}View Notification{% endblock title %}
{% block page_title %}View Notification{% endblock page_title %}
{% block content %}
<div class="col-lg-12">
<h1 class="page-header text-center">View Notification</h1>
<div class="col-lg-12 container" id="example">
<div class="row">
<div class="col-lg-12">
<div class="panel panel-{{ notif.level }}">
<div class="panel-heading">{{ notif.timestamp }} {{ notif.title }}</div>
<div class="panel-body">{{ notif.message }}</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}