Show count of layers to be reviewed next to Review link

Add a badge next to the Review link (when shown for users with the
publish permission) on all pages showing how many layers need to be
reviewed, if any.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2013-03-06 09:16:19 +00:00
parent fea42407fb
commit 46e579b6e6
3 changed files with 8 additions and 3 deletions

1
TODO
View File

@ -16,7 +16,6 @@ Later:
* Style/extend about page?
* Style recipe info page?
* Style machine list on detail
* Show count of layers to be reviewed next to review button
* Something to help with compatibility (although maybe this should just be handled using the existing versioned layer dependencies in layer.conf)
* Query backend service? i.e. special URL to query information for external apps/scripts
* Tool for finding/comparing duplicate recipes?

View File

@ -53,7 +53,12 @@
{% block submitlink %}<li><a href="{% url submit_layer %}">Submit layer</a></li>{% endblock %}
{% if user.is_authenticated %}
{% if perms.layeritem.publish_layer %}
<li><a href="{% url layer_list_review %}">Review</a></li>
<li><a href="{% url layer_list_review %}">
Review
{% if unpublished_count > 0 %}
<span class="badge badge-warning">{{ unpublished_count }}</span>
{% endif %}
</a></li>
{% endif %}
<li class="divider-vertical"></li>
<li class="dropdown">

View File

@ -4,7 +4,7 @@
#
# Licensed under the MIT license, see COPYING.MIT for details
from layerindex.models import Branch
from layerindex.models import Branch, LayerItem
def layerindex_context(request):
current_branch = request.session.get('branch', None)
@ -13,4 +13,5 @@ def layerindex_context(request):
return {
'all_branches': Branch.objects.all(),
'current_branch': current_branch,
'unpublished_count': LayerItem.objects.filter(status='N').count(),
}