diff --git a/templatetags/sidebar.py b/templatetags/sidebar.py
index 5468f34..8d07aec 100644
--- a/templatetags/sidebar.py
+++ b/templatetags/sidebar.py
@@ -15,55 +15,24 @@ def get_sidebar(current_app, request):
if len(unseen_alerts) > 0:
unseen_html = "
" + str(len(unseen_alerts)) + ""
-
- ret = ""
- if current_app == 'overview':
- ret += "
Overview"
- else:
- ret += "
Overview"
- if current_app == 'ban':
- ret += "
Bans"
- else:
- ret += "
Bans"
- if current_app == 'alert':
- ret += "
Alerts{0}".format(unseen_html)
- else:
- ret += "
Alerts{0}".format(unseen_html)
+ ret = '
Overview'.format('class="active"' if current_app == 'overview' else "", reverse('overview'))
+ ret += '
Bans'.format('class="active"' if current_app == 'ban' else '', reverse('ban'))
+ ret += '
Alerts{}'.format('class="active"' if current_app == 'alert' else '', reverse('alert'), unseen_html)
# Models
- if current_app == 'application':
- ret += "
Applications"
- else:
- ret += "
Applications"
- if current_app == 'player':
- ret += "
Players"
- else:
- ret += "
Players"
- if current_app == 'ticket':
- ret += "
Tickets"
- else:
- ret += "
Tickets"
- if current_app == 'warning':
- ret += "
Warnings"
- else:
- ret += "
Warnings"
+ ret += '
Applications'.format('class="active"' if current_app == 'application' else '', reverse('application'))
+ ret += '
Players'.format('class="active"' if current_app == 'player' else '', reverse('player'))
+ ret += '
Tickets'.format('class="active"' if current_app == 'ticket' else '', reverse('ticket'))
+ ret += '
Warnings'.format('class="active"' if current_app == 'warning' else '', reverse('warning'))
# Split up MCM and "other"
ret += "
"
- if current_app == 'report':
- ret += "
Report"
- else:
- ret += "
Report"
+ ret += '
Report'.format('class="active"' if current_app == 'report' else '', reverse('report'))
+
show_chat = True if getattr(settings, 'GLOBAL_LOG', None) is not None else False
if show_chat and request.user.has_perm('auth.chat'):
- if current_app == 'chat':
- ret += "
Chat"
- else:
- ret += "
Chat"
+ ret += '
Chat'.format('class="active"' if current_app == 'chat' else '', reverse('chat'))
if request.user.has_perm('auth.bots'):
- if current_app == 'bots':
- ret += "
Bots"
- else:
- ret += "
Bots"
+ ret += '
Bots'.format('class="active"' if current_app == 'bots' else '', reverse('bots'))
return ret