Skip to content

Commit

Permalink
QA de pierre-24
Browse files Browse the repository at this point in the history
  • Loading branch information
gllmc committed Feb 15, 2017
1 parent 14dc331 commit 0e92d1d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
14 changes: 14 additions & 0 deletions doc/source/front-end/template-tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,20 @@ Récupère la liste des alertes (si l'utilisateur possède les droits pour le fa
- ``alert.pubdate`` donne la date à laquelle l'alerte à été faite ;
- ``alert.topic`` donne le texte d'alerte.

``waiting_count``
---------------

Récupère le nombre de tutoriels ou d'articles dans la zone de validation n'ayant pas été réservés par un validateur.

.. sourcecode:: html

{% load interventions %}
{% with waiting_tutorials_count="TUTORIAL"|waiting_count waiting_articles_count="ARTICLE"|waiting_count %}
...
{% endwith %}
Le filtre doit être appelé sur ``"TUTORIAL"`` pour récupérer le nombre de tutoriels en attente et sur ``"ARTICLE"`` pour le nombre d'articles.

``humane_delta``
----------------

Expand Down
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@
</li>

{% if perms.tutorialv2.change_validation %}
{% with waiting_tutorials_count=user|waiting_tutorials_count waiting_articles_count=user|waiting_articles_count %}
{% with waiting_tutorials_count="TUTORIAL"|waiting_count waiting_articles_count="ARTICLE"|waiting_count %}
<li>
<a href="{% url "validation:list" %}?type=tuto">
{% trans "Validation des tutoriels" %}
Expand Down
14 changes: 3 additions & 11 deletions zds/utils/templatetags/interventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,9 @@ def alerts_list(user):
return {'alerts': total, 'nb_alerts': nb_alerts}


@register.filter(name='waiting_tutorials_count')
def waiting_tutorials_count(user):
@register.filter(name='waiting_count')
def waiting_count(content_type):
return Validation.objects.filter(
validator__isnull=True,
status='PENDING',
content__type='TUTORIAL').count()


@register.filter(name='waiting_articles_count')
def waiting_articles_count(user):
return Validation.objects.filter(
validator__isnull=True,
status='PENDING',
content__type='ARTICLE').count()
content__type=content_type).count()

0 comments on commit 0e92d1d

Please sign in to comment.