Skip to content

Commit

Permalink
Affiche les objectifs d'une publication dans son en-tête (et corrige …
Browse files Browse the repository at this point in the history
…un souci avec l'affichage des catégories) (#6440)

* Ajoute l'affichage des objectifs dans l'en-tête des publiations
* Corrige un problème d'espace dans l'affichage des catégories sur une publication
  • Loading branch information
Arnaud-D authored Jan 15, 2023
1 parent 7041043 commit 7e59f7a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
12 changes: 12 additions & 0 deletions templates/tutorialv2/includes/categories.part.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% load i18n %}

<p>
{% trans "Catégorie" %}{{ categories|pluralize }} :

{# Warning: whitespace in the lines below is crucial for rendering, despite ruining legibility. Change with care. #}
{% for category in categories %}{% if forloop.first %}{% elif forloop.last %} {% trans "et" %}{% else %},{% endif %}
{% if content.is_opinion %}
<a href="{% url 'opinion:list' %}?category={{ category.slug }}">{{ category.title }}</a>
{% else %}
<a href="{% url 'publication:list' %}?subcategory={{ category.slug }}">{{ category.title }}</a>{% endif %}{% endfor %}
</p>
12 changes: 12 additions & 0 deletions templates/tutorialv2/includes/goals.part.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% load i18n %}

{% if goals %}
<p>
{% trans "Objectif" %}{{ goals|pluralize }}{%trans " :" %}
{% comment %}
Warning: whitespace in the loop below is crucial to ensure correct rendering.
That's why it is written as a one-liner. Take care when modifying it.
{% endcomment %}
{% for goal in goals %}{% if not forloop.first %}, {% endif %}<a href="{% url "content:view-goals" %}?objectif_{{ goal.id }}">{{ goal }}</a>{% endfor %}
</p>
{% endif %}
13 changes: 2 additions & 11 deletions templates/tutorialv2/includes/tags_authors.part.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,9 @@
{% endif %}
{% endwith %}

<p>
{% trans "Catégorie" %}{{ content.subcategory.all|pluralize }} :
{% include "tutorialv2/includes/categories.part.html" with categories=content.subcategory.all %}

{% for category in content.subcategory.all %}
{% if forloop.first %}{% elif forloop.last %} {% trans "et" %}{% else %},{% endif %}
{% if content.is_opinion %}
<a href="{% url 'opinion:list' %}?category={{ category.slug }}">{{ category.title }}</a>
{% else %}
<a href="{% url 'publication:list' %}?subcategory={{ category.slug }}">{{ category.title }}</a>
{% endif %}
{% endfor %}
</p>
{% include "tutorialv2/includes/goals.part.html" with goals=publishablecontent.goals.all %}

{% if online and not is_part_or_chapter %}
<p>{% blocktrans with reading_time=reading_time|humanize_duration %}Temps de lecture estimé à {{ reading_time }}.{% endblocktrans %}</p>
Expand Down

0 comments on commit 7e59f7a

Please sign in to comment.