Overview additions

Changed alert icon to a bell
reminder
Etzelia 2018-12-05 23:30:07 -06:00
parent b44f49239b
commit e2aa2a035c
3 changed files with 30 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import json
from datetime import datetime, timedelta
from django.conf import settings
from minecraft_manager.models import Application, Player, Ticket, Warning, IP
from django.contrib.auth.models import User
def overview_data():
@ -62,4 +63,13 @@ def overview_data():
'month': Player.objects.filter(last_seen__range=[month, now]).count()
}
# Admin
data['resolved'] = []
for user in User.objects.all().order_by('username'):
data['resolved'].append({
'active': user.is_active,
'username': user.username,
'tickets': Ticket.objects.filter(staff=user).count()
})
return data

View File

@ -6,6 +6,25 @@
{% endblock %}
{% block section %}
<div id="content">
{% if request.user.is_staff %}
<div class="panel panel-danger">
<div class="panel-body">
<h4><span class="label label-danger">Admin Area</span></h4>
<div class="row">
<div class="col-xs-9 col-md-6">
<h3>Resolved Tickets</h3>
{% for staff in data.resolved %}
<p><span class="label label-{% if staff.active %}success{% else %}danger{% endif %}">{% if staff.active %}Active{% else %}Inactive{% endif %}</span> {{ staff.username }}: {{ staff.tickets }}</p>
{% endfor %}
</div>
<div class="col-xs-9 col-md-6">
</div>
</div>
</div>
</div>
<hr/>
{% endif %}
<div class="row">
<div class="col-xs-9 col-md-6">
<h3>Applications: {{ data.total.application.all }}</h3>

View File

@ -17,7 +17,7 @@ def get_sidebar(current_app, request):
ret = '<li {}><a href="{}"><span class="glyphicon glyphicon-home"></span>&nbsp;&nbsp;Overview</a></li>'.format('class="active"' if current_app == 'overview' else "", reverse('overview'))
ret += '<li {}><a href="{}"><span class="glyphicon glyphicon-ban-circle"></span>&nbsp;&nbsp;Bans</a></li>'.format('class="active"' if current_app == 'ban' else '', reverse('ban'))
ret += '<li {}><a href="{}"><span class="glyphicon glyphicon-inbox"></span>&nbsp;&nbsp;Alerts{}</a></li>'.format('class="active"' if current_app == 'alert' else '', reverse('alert'), unseen_html)
ret += '<li {}><a href="{}"><span class="glyphicon glyphicon-bell"></span>&nbsp;&nbsp;Alerts{}</a></li>'.format('class="active"' if current_app == 'alert' else '', reverse('alert'), unseen_html)
# Models
ret += '<li {}><a href="{}"><span class="glyphicon glyphicon-file"></span>&nbsp;&nbsp;Applications</a></li>'.format('class="active"' if current_app == 'application' else '', reverse('application'))