Add initial navbar
This includes all boards, as well as report counts if the user is an admin. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from django.conf import settings as django_settings
|
||||
from board.models import Board
|
||||
from board.models import Board, ReportRecord
|
||||
|
||||
|
||||
def settings(request):
|
||||
@@ -8,3 +8,24 @@ def settings(request):
|
||||
|
||||
def boards(request):
|
||||
return {"boards": Board.objects.filter(readonly=False)}
|
||||
|
||||
|
||||
def reports(request):
|
||||
user = request.user
|
||||
print("reports!")
|
||||
print("reports!")
|
||||
print("reports!")
|
||||
print("reports!")
|
||||
print("reports!")
|
||||
print("reports!")
|
||||
print("reports!")
|
||||
print("reports!")
|
||||
print("reports!")
|
||||
print("reports!")
|
||||
if user and user.has_perm("board.view_reportrecord"):
|
||||
return {
|
||||
"reports": ReportRecord.objects.all(),
|
||||
"reports_urgent": ReportRecord.objects.filter(urgent=True),
|
||||
}
|
||||
else:
|
||||
return {}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/* Nav */
|
||||
.nav_admin {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.nav_report_urgent {
|
||||
color: var(--error);
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
--activated: #888;
|
||||
--post-background: #d9d9d9;
|
||||
--reply-background: #eee;
|
||||
--error: #f00;
|
||||
}
|
||||
|
||||
body {
|
||||
@@ -169,6 +170,11 @@ th {
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
/* Nav */
|
||||
nav {
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
/* Misc */
|
||||
|
||||
a:link {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
{% block extrajs %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<nav>{% include "board/nav_snippet.html" %}</nav>
|
||||
<main>
|
||||
{% block content %}{% endblock content %}
|
||||
</main>
|
||||
|
||||
22
board/templates/board/nav_snippet.html
Normal file
22
board/templates/board/nav_snippet.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<div class="nav">
|
||||
<span class="nav_boards">
|
||||
[
|
||||
{% for board in boards %}
|
||||
<span class="nav_board">
|
||||
<a href="{% url 'board:board_detail' board.url %}">{{board.url}}</a>
|
||||
{% if not forloop.last %} / {% endif %}
|
||||
</span>
|
||||
{% endfor %}
|
||||
]
|
||||
</span>
|
||||
|
||||
{% if user and user.is_staff %}
|
||||
<span class="nav_admin">
|
||||
[
|
||||
<a href="{% url 'admin:board_reportrecord_changelist' %}">Reports</a>:
|
||||
{{reports.count}}
|
||||
(<span class="nav_report_urgent">{{reports_urgent.count}}</span>)
|
||||
]
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
Reference in New Issue
Block a user