Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grise les boutons de comparaisons de versions si elles sont identiques #6181

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 42 additions & 15 deletions templates/tutorialv2/view/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -498,27 +498,54 @@ <h2>
{# END ONLINE VERSION #}

{% if content.sha_public %}
<li>
<a href="{% url "content:diff" content.pk content.slug_repository %}?from={{ content.sha_public }}&amp;to={% if version %}{{ version }}{% else %}{{ content.sha_draft }}{% endif %}" class="ico-after history blue">
{% trans "Comparer avec la version en ligne" %}
</a>
</li>
{# interpreted as: (version and (content.sha_public != version)) or ((not version) and (content.sha_public != content.sha_draft)) #}
{% if version and content.sha_public != version or not version and content.sha_public != content.sha_draft %}
<li>
<a href="{% url "content:diff" content.pk content.slug_repository %}?from={{ content.sha_public }}&amp;to={% if version %}{{ version }}{% else %}{{ content.sha_draft }}{% endif %}" class="ico-after history blue">
{% trans "Comparer avec la version en ligne" %}
</a>
</li>
{% else %}
<li class="inactive">
<span class="ico-after history disabled">
{% trans "Comparer avec la version en ligne (identique)" %}
</a>
</li>
{% endif %}
{% endif %}

{% if content.sha_beta %}
<li>
<a href="{% url "content:diff" content.pk content.slug_repository %}?from={{ content.sha_beta }}&amp;to={% if version %}{{ version }}{% else %}{{ content.sha_draft }}{% endif %}" class="ico-after history blue">
{% trans "Comparer avec la bêta" %}
</a>
</li>
{# interpreted as: (version and (content.sha_beta != version)) or ((not version) and (content.sha_beta != content.sha_draft)) #}
{% if version and content.sha_beta != version or not version and content.sha_beta != content.sha_draft %}
<li>
<a href="{% url "content:diff" content.pk content.slug_repository %}?from={{ content.sha_beta }}&amp;to={% if version %}{{ version }}{% else %}{{ content.sha_draft }}{% endif %}" class="ico-after history blue">
{% trans "Comparer avec la bêta" %}
</a>
</li>
{% else %}
<li class="inactive">
<span class="ico-after history disabled">
{% trans "Comparer avec la bêta (identique)" %}
</a>
</li>
{% endif %}
{% endif %}

{% if content.in_validation %}
<li>
<a href="{% url "content:diff" content.pk content.slug_repository %}?from={{ validation.version }}&amp;to={% if version %}{{ version }}{% else %}{{ content.sha_draft }}{% endif %}" class="ico-after history blue">
{% trans "Comparer avec la version en validation" %}
</a>
</li>
{# interpreted as: (version and (validation.version != version)) or ((not version) and (validation.version != content.sha_draft)) #}
{% if version and validation.version != version or not version and validation.version != content.sha_draft %}
<li>
<a href="{% url "content:diff" content.pk content.slug_repository %}?from={{ validation.version }}&amp;to={% if version %}{{ version }}{% else %}{{ content.sha_draft }}{% endif %}" class="ico-after history blue">
{% trans "Comparer avec la version en validation" %}
</a>
</li>
{% else %}
<li class="inactive">
<span class="ico-after history disabled">
{% trans "Comparer avec la version en validation (identique)" %}
</a>
</li>
{% endif %}
{% endif %}

{# HISTORY #}
Expand Down
2 changes: 1 addition & 1 deletion zds/tutorialv2/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def get_context_data(self, **kwargs):

class SingleContentDetailViewMixin(SingleContentViewMixin, DetailView):
"""
This enhanced DetailView ensure,
This enhanced DetailView ensures,
- by rewriting `get()`, that:
* `self.object` contains the result of `get_object()` (as it must be if `get()` is not rewritten)
Expand Down