aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/flatpages/help/ranks_permissions.md2
-rw-r--r--app/template_filters.py12
-rw-r--r--app/templates/base.html46
3 files changed, 46 insertions, 14 deletions
diff --git a/app/flatpages/help/ranks_permissions.md b/app/flatpages/help/ranks_permissions.md
index b03a7cd..1e1b8ef 100644
--- a/app/flatpages/help/ranks_permissions.md
+++ b/app/flatpages/help/ranks_permissions.md
@@ -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>
diff --git a/app/template_filters.py b/app/template_filters.py
index 574c1b1..39d3806 100644
--- a/app/template_filters.py
+++ b/app/template_filters.py
@@ -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)
diff --git a/app/templates/base.html b/app/templates/base.html
index 239cbe4..fabe2f6 100644
--- a/app/templates/base.html
+++ b/app/templates/base.html
@@ -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>