Skip to content

Commit

Permalink
Ajoute un lien vers la modification des catégories
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud-D committed Apr 6, 2024
1 parent afa8ca3 commit eb78656
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
24 changes: 22 additions & 2 deletions templates/tutorialv2/includes/headline/categories.part.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{% load i18n %}
{% load pluralize_fr %}
{% load captureas %}

{% captureas categories_list %}
<p>
{% trans "Catégorie" %}{{ content.subcategory.all|pluralize }} :

{% trans "Dans" %}
{% for category in content.subcategory.all %}
{% if forloop.first %}{% elif forloop.last %} {% trans "et" %}{% else %},{% endif %}
{% if content.is_opinion %}
Expand All @@ -13,3 +14,22 @@
{% endif %}
{% endfor %}
</p>
{% endcaptureas %}

{% url "content:edit-categories" content.pk as edit_url %}

{% if show_form %}
{% if content.subcategory.all %}
<div class="editable-element">
{{ categories_list }}

{% if show_form %}
<a href="{{ edit_url }}" class="edit-button"><span class="visuallyhidden">{% trans "Modifier" %}</span></a>
{% endif %}
</div>
{% else %}
<a href="{{ edit_url }}">{% trans "Choisissez la catégorie !" %}</span></a>
{% endif %}
{% elif content.subcategory.all %}
{{ categories_list }}
{% endif %}
2 changes: 1 addition & 1 deletion templates/tutorialv2/includes/headline/header.part.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% include "tutorialv2/includes/headline/authors.part.html" with db_content=db_content edit_authors=display_config.draft_actions.show_authors_management online_mode=display_config.online_config.enable_authors_online_mode %}
{% include "tutorialv2/includes/headline/licence.part.html" with licence=content.licence show_form=display_config.draft_actions.show_license_edit form=form_edit_license %}
{% include "tutorialv2/includes/headline/contributions.part.html" %}
{% include "tutorialv2/includes/headline/categories.part.html" %}
{% include "tutorialv2/includes/headline/categories.part.html" with content=content show_form=display_config.draft_actions.show_categories_management %}
{% include "tutorialv2/includes/headline/goals.part.html" with goals=publishablecontent.goals.all %}
{% include "tutorialv2/includes/headline/labels.part.html" with labels=publishablecontent.labels.all %}

Expand Down
3 changes: 3 additions & 0 deletions zds/tutorialv2/views/display/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ def show_title_edit(self) -> bool:
def show_authors_management(self) -> bool:
return self.enabled and self.is_allowed

def show_categories_management(self) -> bool:
return self.enabled and self.is_allowed

def show_contributors_management(self) -> bool:
return self.enabled and self.is_allowed and self.requires_validation

Expand Down

0 comments on commit eb78656

Please sign in to comment.