Skip to content

Commit

Permalink
Améliore l'ergonomie version validation/draft tutos
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-D committed Jul 27, 2014
1 parent c4a7c91 commit d9113f1
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 32 deletions.
81 changes: 51 additions & 30 deletions templates/tutorial/tutorial/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,43 @@ <h2 class="subtitle">

{% if user in tutorial.authors.all or perms.tutorial.change_tutorial %}
{% if tutorial.in_validation %}
{% if validation.is_pending %}
<p class="content-wrapper alert-box alert">
Ce tutoriel est en attente d'un validateur
</p>
{% elif validation.is_pending_valid %}
<p class="content-wrapper alert-box info">
Le tutoriel est en cours de validation par
{% include "misc/member_item.part.html" with member=validation.validator %}
</p>
{% endif %}
{% if validation.comment_authors %}
<div class="content-wrapper comment-author">
<p>
Le message suivant a été laissé à destination des validateurs :
{% if validation.version == version %}
{% if validation.is_pending %}
<p class="content-wrapper alert-box alert">
Ce tutoriel est en attente d'un validateur
</p>
{% elif validation.is_pending_valid %}
<p class="content-wrapper alert-box info">
Le tutoriel est en cours de validation par
{% include "misc/member_item.part.html" with member=validation.validator %}
</p>
{% endif %}
{% if validation.comment_authors %}
<div class="content-wrapper comment-author">
<p>
Le message suivant a été laissé à destination des validateurs :
</p>

<blockquote>
{{ validation.comment_authors }}
</blockquote>
</div>
<blockquote>
{{ validation.comment_authors }}
</blockquote>
</div>
{% endif %}
{% else %}
{% if validation.is_pending %}
<p class="content-wrapper alert-box info">
<a href="{{ tutorial.get_absolute_url }}?version={{ validation.version }}">
Une autre version de ce tutoriel</a>
est en attente d'un validateur
</p>
{% elif validation.is_pending_valid %}
<p class="content-wrapper alert-box info">
<a href="{{ tutorial.get_absolute_url }}?version={{ validation.version }}">
Une autre version de ce tutoriel</a>
est en cours de validation par
{% include "misc/member_item.part.html" with member=validation.validator %}
</p>
{% endif %}
{% endif %}
{% endif %}
{% endif %}
Expand Down Expand Up @@ -130,22 +147,26 @@ <h2>

{% block sidebar_new %}
{% if user in tutorial.authors.all or perms.tutorial.change_tutorial %}
{% if not tutorial.is_mini %}
<a href="{% url "zds.tutorial.views.add_part" %}?tutoriel={{ tutorial.pk }}" class="ico-after more blue new-btn">
Ajouter une partie
</a>
{% else %}
<a href="{% url "zds.tutorial.views.add_extract" %}?chapitre={{ tutorial.get_chapter.pk }}" class="ico-after more blue new-btn">
Ajouter un extrait
</a>
{% endif %}

{% if tutorial.sha_draft = version %}
{% if not tutorial.is_mini %}
<a href="{% url "zds.tutorial.views.add_part" %}?tutoriel={{ tutorial.pk }}" class="ico-after more blue new-btn">
Ajouter une partie
</a>
{% else %}
<a href="{% url "zds.tutorial.views.add_extract" %}?chapitre={{ tutorial.get_chapter.pk }}" class="ico-after more blue new-btn">
Ajouter un extrait
</a>
{% endif %}

<a href="{% url "zds.tutorial.views.edit_tutorial" %}?tutoriel={{ tutorial.pk }}" class="ico-after edit blue new-btn">
Éditer
</a>
{% else %}
<a href="{{ tutorial.get_absolute_url }}" class="ico-after arrow-right blue new-btn">
Version brouillon
</a>
{% endif %}
{% endif %}
{% endif %}
{% endblock %}


Expand Down Expand Up @@ -290,7 +311,7 @@ <h2>
<div id="ask-validation" class="modal modal-medium">
{% crispy formAskValidation %}
</div>
{% endif %}
{% endif %}
{% endblock %}


Expand Down
3 changes: 1 addition & 2 deletions zds/tutorial/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,7 @@ def view_tutorial(request, tutorial_pk, tutorial_slug):
cpt_e += 1
cpt_c += 1
cpt_p += 1
validation = Validation.objects.filter(tutorial__pk=tutorial.pk,
version=sha)\
validation = Validation.objects.filter(tutorial__pk=tutorial.pk)\
.order_by("-date_proposition")\
.first()
formAskValidation = AskValidationForm()
Expand Down

0 comments on commit d9113f1

Please sign in to comment.