From 5a1f5d39265e94265c123e7e204e0ae0f4d68778 Mon Sep 17 00:00:00 2001 From: Arnaud-D <35631001+Arnaud-D@users.noreply.github.com> Date: Tue, 27 Dec 2022 12:31:34 +0100 Subject: [PATCH] WIP refacto content.html et content_online.html --- .../tutorialv2/includes/comments.part.html | 79 +++++++++++++ .../includes/editorialization.part.html | 104 +++++++++--------- templates/tutorialv2/view/content.html | 4 +- templates/tutorialv2/view/content_online.html | 80 +------------- 4 files changed, 135 insertions(+), 132 deletions(-) create mode 100644 templates/tutorialv2/includes/comments.part.html diff --git a/templates/tutorialv2/includes/comments.part.html b/templates/tutorialv2/includes/comments.part.html new file mode 100644 index 0000000000..ca1787afe2 --- /dev/null +++ b/templates/tutorialv2/includes/comments.part.html @@ -0,0 +1,79 @@ +{% load captureas %} +{% load set %} +{% load i18n %} +{% load pluralize_fr %} + +

+ {% if content.get_note_count > 0 %} + + {{ content.get_note_count }} + + {% trans "commentaire" %}{{ content.get_note_count|pluralize_fr }} + {% else %} + {% trans "Aucun commentaire" %} + {% endif %} +

+ +{% include "misc/paginator.html" with position="top" topic=content is_online=True anchor="comments" %} + +{% set perms.tutorialv2.change_contentreaction as is_staff %} + +{% for message in reactions %} + + {% captureas edit_link %} + {% url "content:update-reaction" %}?message={{ message.pk }}&pk={{ content.pk }} + {% endcaptureas %} + + {% captureas cite_link %} + {% url "content:add-reaction" %}?cite={{ message.pk }}&pk={{ content.pk }} + {% endcaptureas %} + + {% captureas karma_link %} + {% url "api:content:reaction-karma" message.pk %} + {% endcaptureas %} + + {% captureas alerts_solve_link %} + {% url "content:resolve-reaction" %} + {% endcaptureas %} + {% captureas alert_link %} + {% url "content:alert-reaction" message.pk %} + {% endcaptureas %} + {% captureas hide_link %} + {% url "content:hide-reaction" message.pk%} + {% endcaptureas %} + + {% captureas show_link %} + {% url "content:show-reaction" message.pk %} + {% endcaptureas %} + + {% if forloop.first and page_obj.number > 1 %} + {% set True as is_repeated_message %} + {% else %} + {% set False as is_repeated_message %} + {% endif %} + + {% if user == message.author or is_staff %} + {% set True as can_view_history %} + {% else %} + {% set False as can_view_history %} + {% endif %} + + {% include "misc/message.part.html" with perms_change=is_staff topic=object %} +{% endfor %} + + +{% include "misc/paginator.html" with position="bottom" topic=content is_online=True anchor="comments" %} + + + +{% captureas form_action %} + {% url 'content:add-reaction' %}?pk={{ content.pk }} +{% endcaptureas %} + +{% if object.last_note %} + {% captureas last_note_pk %} + {{ object.last_note.pk }} + {% endcaptureas %} +{% endif %} + +{% include "misc/message_form.html" with member=user topic=content is_antispam=is_antispam %} diff --git a/templates/tutorialv2/includes/editorialization.part.html b/templates/tutorialv2/includes/editorialization.part.html index c3636daa84..c66654697d 100644 --- a/templates/tutorialv2/includes/editorialization.part.html +++ b/templates/tutorialv2/includes/editorialization.part.html @@ -1,58 +1,60 @@ {% load i18n %} {% load crispy_forms_tags %} -

Éditorialisation

- + diff --git a/templates/tutorialv2/view/content.html b/templates/tutorialv2/view/content.html index 25e133d74a..bd762668e0 100644 --- a/templates/tutorialv2/view/content.html +++ b/templates/tutorialv2/view/content.html @@ -743,9 +743,7 @@

{{ content.is_opinion|yesno:_("Modération,Validation") }}

{% endif %} {% if is_staff or can_edit %} - + {% include "tutorialv2/includes/editorialization.part.html" %} {% endif %} {% if can_edit and not content.is_opinion %} diff --git a/templates/tutorialv2/view/content_online.html b/templates/tutorialv2/view/content_online.html index a5175aeb6b..74254181f3 100644 --- a/templates/tutorialv2/view/content_online.html +++ b/templates/tutorialv2/view/content_online.html @@ -348,88 +348,12 @@

{% blocktrans %}Administration{% endblocktrans %}< {% endif %} {% if is_staff or is_author %} - + {% include "tutorialv2/includes/editorialization.part.html" %} {% endif %} {% include "misc/social_buttons.part.html" with link=content.get_absolute_url_online text=content.title %} {% endblock %} {% block content_after %} {% include "tutorialv2/includes/content_suggestion.part.html" with content=content content_suggestions=content_suggestions_random %} -

- {% if content.get_note_count > 0 %} - - {{ content.get_note_count }} - - {% trans "commentaire" %}{{ content.get_note_count|pluralize_fr }} - {% else %} - {% trans "Aucun commentaire" %} - {% endif %} -

- - - {% include "misc/paginator.html" with position="top" topic=content is_online=True anchor="comments" %} - - {% set perms.tutorialv2.change_contentreaction as is_staff %} - - {% for message in reactions %} - - {% captureas edit_link %} - {% url "content:update-reaction" %}?message={{ message.pk }}&pk={{ content.pk }} - {% endcaptureas %} - - {% captureas cite_link %} - {% url "content:add-reaction" %}?cite={{ message.pk }}&pk={{ content.pk }} - {% endcaptureas %} - - {% captureas karma_link %} - {% url "api:content:reaction-karma" message.pk %} - {% endcaptureas %} - - {% captureas alerts_solve_link %} - {% url "content:resolve-reaction" %} - {% endcaptureas %} - {% captureas alert_link %} - {% url "content:alert-reaction" message.pk %} - {% endcaptureas %} - {% captureas hide_link %} - {% url "content:hide-reaction" message.pk%} - {% endcaptureas %} - - {% captureas show_link %} - {% url "content:show-reaction" message.pk %} - {% endcaptureas %} - - {% if forloop.first and page_obj.number > 1 %} - {% set True as is_repeated_message %} - {% else %} - {% set False as is_repeated_message %} - {% endif %} - - {% if user == message.author or is_staff %} - {% set True as can_view_history %} - {% else %} - {% set False as can_view_history %} - {% endif %} - - {% include "misc/message.part.html" with perms_change=is_staff topic=object %} - {% endfor %} - - - {% include "misc/paginator.html" with position="bottom" topic=content is_online=True anchor="comments" %} - - - - {% captureas form_action %} - {% url 'content:add-reaction' %}?pk={{ content.pk }} - {% endcaptureas %} - - {% if object.last_note %} - {% captureas last_note_pk %} - {{ object.last_note.pk }} - {% endcaptureas %} - {% endif %} - - {% include "misc/message_form.html" with member=user topic=content is_antispam=is_antispam %} + {% include "tutorialv2/includes/comments.part.html" with content=content reactions=reactions %} {% endblock %}