forked from Minecraft/minecraft_manager
parent
b44f49239b
commit
e2aa2a035c
10
overview.py
10
overview.py
|
@ -3,6 +3,7 @@ import json
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from minecraft_manager.models import Application, Player, Ticket, Warning, IP
|
from minecraft_manager.models import Application, Player, Ticket, Warning, IP
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
|
||||||
def overview_data():
|
def overview_data():
|
||||||
|
@ -62,4 +63,13 @@ def overview_data():
|
||||||
'month': Player.objects.filter(last_seen__range=[month, now]).count()
|
'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
|
return data
|
||||||
|
|
|
@ -6,6 +6,25 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block section %}
|
{% block section %}
|
||||||
<div id="content">
|
<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="row">
|
||||||
<div class="col-xs-9 col-md-6">
|
<div class="col-xs-9 col-md-6">
|
||||||
<h3>Applications: {{ data.total.application.all }}</h3>
|
<h3>Applications: {{ data.total.application.all }}</h3>
|
||||||
|
|
|
@ -17,7 +17,7 @@ def get_sidebar(current_app, request):
|
||||||
|
|
||||||
ret = '<li {}><a href="{}"><span class="glyphicon glyphicon-home"></span> Overview</a></li>'.format('class="active"' if current_app == 'overview' else "", reverse('overview'))
|
ret = '<li {}><a href="{}"><span class="glyphicon glyphicon-home"></span> Overview</a></li>'.format('class="active"' if current_app == 'overview' else "", reverse('overview'))
|
||||||
ret += '<li {}><a href="{}"><span class="glyphicon glyphicon-ban-circle"></span> Bans</a></li>'.format('class="active"' if current_app == 'ban' else '', reverse('ban'))
|
ret += '<li {}><a href="{}"><span class="glyphicon glyphicon-ban-circle"></span> Bans</a></li>'.format('class="active"' if current_app == 'ban' else '', reverse('ban'))
|
||||||
ret += '<li {}><a href="{}"><span class="glyphicon glyphicon-inbox"></span> 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> Alerts{}</a></li>'.format('class="active"' if current_app == 'alert' else '', reverse('alert'), unseen_html)
|
||||||
|
|
||||||
# Models
|
# Models
|
||||||
ret += '<li {}><a href="{}"><span class="glyphicon glyphicon-file"></span> Applications</a></li>'.format('class="active"' if current_app == 'application' else '', reverse('application'))
|
ret += '<li {}><a href="{}"><span class="glyphicon glyphicon-file"></span> Applications</a></li>'.format('class="active"' if current_app == 'application' else '', reverse('application'))
|
||||||
|
|
Loading…
Reference in New Issue