mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-08 22:17:34 +01:00
Add work queue icon to navigation bar
This commit is contained in:
parent
d76f10c312
commit
a3b3525b78
@ -163,7 +163,7 @@ title: Ranks and Permissions
|
||||
<td>Approve Release</td>
|
||||
<td></td> <!-- new -->
|
||||
<td></td>
|
||||
<td></td> <!-- member -->
|
||||
<td>✓</td> <!-- member -->
|
||||
<td></td>
|
||||
<td>✓</td> <!-- trusted member -->
|
||||
<td></td>
|
||||
|
@ -1,6 +1,7 @@
|
||||
from . import app
|
||||
from .models import Permission
|
||||
from .models import Permission, Package, PackageState, PackageRelease
|
||||
from .utils import abs_url_for, url_set_query
|
||||
from flask_user import current_user
|
||||
from urllib.parse import urlparse
|
||||
|
||||
@app.context_processor
|
||||
@ -12,6 +13,15 @@ def inject_functions():
|
||||
check_global_perm = Permission.checkPerm
|
||||
return dict(abs_url_for=abs_url_for, url_set_query=url_set_query, check_global_perm=check_global_perm)
|
||||
|
||||
@app.context_processor
|
||||
def inject_todo():
|
||||
todo_list_count = None
|
||||
if current_user.is_authenticated and current_user.canAccessTodoList():
|
||||
todo_list_count = Package.query.filter_by(state=PackageState.READY_FOR_REVIEW).count()
|
||||
todo_list_count += PackageRelease.query.filter_by(approved=False, task_id=None).count()
|
||||
|
||||
return dict(todo_list_count=todo_list_count)
|
||||
|
||||
@app.template_filter()
|
||||
def throw(err):
|
||||
raise Exception(err)
|
||||
|
@ -60,17 +60,39 @@
|
||||
</form>
|
||||
<ul class="navbar-nav ml-auto">
|
||||
{% if current_user.is_authenticated %}
|
||||
<li class="nav-item"><a class="nav-link notification-icon" href="{{ url_for('notifications.list_all') }}">
|
||||
{% if current_user.notifications %}
|
||||
<i class="fas fa-bell"></i>
|
||||
<span class="badge badge-pill badge-notify" style="font-size:10px;">{{ current_user.notifications | length }}</span>
|
||||
{% else %}
|
||||
<i class="fas fa-bell" ></i>
|
||||
{% endif %}
|
||||
</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('packages.create_edit') }}">
|
||||
<i class="fas fa-plus"></i>
|
||||
</a></li>
|
||||
{% if todo_list_count is not none %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link notification-icon"
|
||||
href="{{ url_for('todo.view') }}"
|
||||
title="{{ _('Work Queue') }}">
|
||||
{% if todo_list_count > 0 %}
|
||||
<i class="fas fa-inbox"></i>
|
||||
<span class="badge badge-pill badge-notify" style="font-size:10px;">{{ todo_list_count }}</span>
|
||||
{% else %}
|
||||
<i class="fas fa-inbox" ></i>
|
||||
{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link notification-icon"
|
||||
href="{{ url_for('notifications.list_all') }}"
|
||||
title="{{ _('Notifications') }}">
|
||||
{% if current_user.notifications %}
|
||||
<i class="fas fa-bell"></i>
|
||||
<span class="badge badge-pill badge-notify" style="font-size:10px;">{{ current_user.notifications | length }}</span>
|
||||
{% else %}
|
||||
<i class="fas fa-bell" ></i>
|
||||
{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link"
|
||||
href="{{ url_for('packages.create_edit') }}"
|
||||
title="{{ _('Add Package') }}">
|
||||
<i class="fas fa-plus"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle"
|
||||
data-toggle="dropdown"
|
||||
@ -87,8 +109,8 @@
|
||||
</li>
|
||||
{% if current_user.canAccessTodoList() %}
|
||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('todo.view') }}">{{ _("Work Queue") }}</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('users.list_all') }}">{{ _("User list") }}</a></li>
|
||||
{% endif %}
|
||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('users.list_all') }}">{{ _("User list") }}</a></li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('todo.topics') }}">{{ _("All unadded topics") }}</a>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user