From 9a464daf2ab072b7e897e50ce5dffceb44dc2217 Mon Sep 17 00:00:00 2001 From: Arnaud-D <35631001+Arnaud-D@users.noreply.github.com> Date: Tue, 17 Jan 2023 14:43:20 +0100 Subject: [PATCH] Refactorise les templates des publications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * mise à jour de l'organisation des différentes actions possibles * fusion des variantes en ligne et pas en ligne * configuration définie dans la vue pour adapter l'affichage * vues bien séparées pour bêta, brouillon, en ligne * nouvelle vue spécifique pour voir une version par son commit --- templates/base.html | 3 - .../includes/featured_request.part.html | 22 +- templates/tutorialv2/base.html | 9 - templates/tutorialv2/events/list.html | 8 - templates/tutorialv2/includes/child.part.html | 59 +- .../includes/child_online.part.html | 2 +- .../tutorialv2/includes/comments.part.html | 78 ++ .../includes/content/content.part.html | 112 +++ .../{ => content}/content_pager.part.html | 0 .../includes/content/online_content.part.html | 27 + .../{ => content}/warn_typo.part.html | 2 +- .../includes/editorialization.part.html | 58 -- .../includes/headline/authors.part.html | 31 + .../includes/headline/beta_info.part.html | 28 + .../includes/headline/categories.part.html | 15 + .../includes/headline/contributions.part.html | 21 + .../includes/{ => headline}/goals.part.html | 0 .../includes/headline/header.part.html | 33 + .../includes/headline/help_info.part.html | 22 + .../includes/headline/licence.part.html | 21 + .../headline/obsolescence_warning.part.html | 11 + .../opinion_moderation_warning.part.html | 7 + .../headline/opinion_promotion_info.part.html | 19 + .../includes/headline/reading_time.part.html | 8 + .../includes/headline/tags.part.html | 17 + .../includes/headline/update_date.part.html | 25 + .../headline/validation_info.part.html | 46 + .../includes/meta/dcmi_cards.part.html | 18 + .../includes/{ => meta}/image_illu.part.html | 0 .../includes/{ => meta}/opengraph.part.html | 0 .../sidebar/administration_actions.part.html | 71 ++ .../sidebar/authors_management.part.html | 42 + .../includes/sidebar/beta_actions.part.html | 100 ++ .../sidebar/contributors_management.part.html | 39 + .../includes/{ => sidebar}/delete.part.html | 0 .../includes/sidebar/delete_content.part.html | 45 + .../sidebar/editorialization.part.html | 86 ++ .../includes/{ => sidebar}/exports.part.html | 0 .../includes/sidebar/follow_links.part.html | 31 + .../includes/sidebar/helps.part.html | 51 + .../{ => sidebar}/list_of_exports.html | 1 + .../includes/sidebar/public_actions.part.html | 67 ++ .../includes/{ => sidebar}/summary.part.html | 0 .../includes/sidebar/validation.part.html | 179 ++++ .../includes/tags_authors.part.html | 108 --- templates/tutorialv2/validation/history.html | 6 - templates/tutorialv2/view/container.html | 484 +++++----- .../tutorialv2/view/container_online.html | 135 --- templates/tutorialv2/view/content.html | 904 +++--------------- templates/tutorialv2/view/content_online.html | 435 --------- templates/tutorialv2/view/diff.html | 2 - templates/tutorialv2/view/history.html | 9 +- zds/tutorialv2/mixins.py | 41 +- zds/tutorialv2/models/database.py | 39 +- zds/tutorialv2/models/versioned.py | 8 +- zds/tutorialv2/urls/urls_articles.py | 4 +- zds/tutorialv2/urls/urls_contents.py | 25 +- zds/tutorialv2/urls/urls_opinions.py | 4 +- zds/tutorialv2/urls/urls_tutorials.py | 8 +- zds/tutorialv2/views/alerts.py | 1 + zds/tutorialv2/views/archives.py | 1 - zds/tutorialv2/views/authors.py | 2 - zds/tutorialv2/views/beta.py | 1 - zds/tutorialv2/views/containers_extracts.py | 62 +- zds/tutorialv2/views/contents.py | 92 +- zds/tutorialv2/views/contributors.py | 2 - zds/tutorialv2/views/display.py | 894 ++++++++++++++--- zds/tutorialv2/views/editorialization.py | 2 - zds/tutorialv2/views/history.py | 1 - zds/tutorialv2/views/misc.py | 1 - zds/tutorialv2/views/validations_contents.py | 1 - 71 files changed, 2495 insertions(+), 2191 deletions(-) create mode 100644 templates/tutorialv2/includes/comments.part.html create mode 100644 templates/tutorialv2/includes/content/content.part.html rename templates/tutorialv2/includes/{ => content}/content_pager.part.html (100%) create mode 100644 templates/tutorialv2/includes/content/online_content.part.html rename templates/tutorialv2/includes/{ => content}/warn_typo.part.html (96%) delete mode 100644 templates/tutorialv2/includes/editorialization.part.html create mode 100644 templates/tutorialv2/includes/headline/authors.part.html create mode 100644 templates/tutorialv2/includes/headline/beta_info.part.html create mode 100644 templates/tutorialv2/includes/headline/categories.part.html create mode 100644 templates/tutorialv2/includes/headline/contributions.part.html rename templates/tutorialv2/includes/{ => headline}/goals.part.html (100%) create mode 100644 templates/tutorialv2/includes/headline/header.part.html create mode 100644 templates/tutorialv2/includes/headline/help_info.part.html create mode 100644 templates/tutorialv2/includes/headline/licence.part.html create mode 100644 templates/tutorialv2/includes/headline/obsolescence_warning.part.html create mode 100644 templates/tutorialv2/includes/headline/opinion_moderation_warning.part.html create mode 100644 templates/tutorialv2/includes/headline/opinion_promotion_info.part.html create mode 100644 templates/tutorialv2/includes/headline/reading_time.part.html create mode 100644 templates/tutorialv2/includes/headline/tags.part.html create mode 100644 templates/tutorialv2/includes/headline/update_date.part.html create mode 100644 templates/tutorialv2/includes/headline/validation_info.part.html create mode 100644 templates/tutorialv2/includes/meta/dcmi_cards.part.html rename templates/tutorialv2/includes/{ => meta}/image_illu.part.html (100%) rename templates/tutorialv2/includes/{ => meta}/opengraph.part.html (100%) create mode 100644 templates/tutorialv2/includes/sidebar/administration_actions.part.html create mode 100644 templates/tutorialv2/includes/sidebar/authors_management.part.html create mode 100644 templates/tutorialv2/includes/sidebar/beta_actions.part.html create mode 100644 templates/tutorialv2/includes/sidebar/contributors_management.part.html rename templates/tutorialv2/includes/{ => sidebar}/delete.part.html (100%) create mode 100644 templates/tutorialv2/includes/sidebar/delete_content.part.html create mode 100644 templates/tutorialv2/includes/sidebar/editorialization.part.html rename templates/tutorialv2/includes/{ => sidebar}/exports.part.html (100%) create mode 100644 templates/tutorialv2/includes/sidebar/follow_links.part.html create mode 100644 templates/tutorialv2/includes/sidebar/helps.part.html rename templates/tutorialv2/includes/{ => sidebar}/list_of_exports.html (99%) create mode 100644 templates/tutorialv2/includes/sidebar/public_actions.part.html rename templates/tutorialv2/includes/{ => sidebar}/summary.part.html (100%) create mode 100644 templates/tutorialv2/includes/sidebar/validation.part.html delete mode 100644 templates/tutorialv2/includes/tags_authors.part.html delete mode 100644 templates/tutorialv2/view/container_online.html delete mode 100644 templates/tutorialv2/view/content_online.html diff --git a/templates/base.html b/templates/base.html index 2759a79caa..670922f3c1 100644 --- a/templates/base.html +++ b/templates/base.html @@ -82,11 +82,8 @@ - - {# DCMI cards #} {% block DCMI_cards %}{% endblock %} - {# Stylesheets #} - - {% csrf_token %} +
-{% endif %} + + diff --git a/templates/tutorialv2/base.html b/templates/tutorialv2/base.html index 365b0b4b7f..429239775e 100644 --- a/templates/tutorialv2/base.html +++ b/templates/tutorialv2/base.html @@ -83,14 +83,5 @@- {{ content.licence }} -
- {% endif %} -- {% trans "Cette section est actuellement vide." %} + {% trans "Cette section est vide." %}
- {{ "Ce"|feminize:child.get_level_as_string }} {{ child.get_level_as_string|lower }} {% trans "est actuellement vide." %} -
- {% if can_add_something and not child.is_chapter %} -+ {{ "Ce"|feminize:child.get_level_as_string }} {{ child.get_level_as_string|lower }} {% trans "est vide." %} +
+ {% if not child.is_chapter %} +- {% trans "Cette section est actuellement vide." %} + {% trans "Cette section est vide." %}
{% else %}+ {% trans "Il n’y a pas d’introduction." %} + {% if can_add_something %} + {% trans "Vous pouvez " %}{% trans "en ajouter une" %}. + {% endif %} +
++ {% trans "Ce contenu est vide." %} {% trans "Vous pouvez :" %} +
++ {% trans "Ce contenu est vide." %} +
+{% trans "Cliquer sur ajouter pour rédiger une nouvelle section." %}
++ {% trans "Il n’y a pas de conclusion." %} + {% if display_config.draft_actions.enable_edit %} + {% trans "Vous pouvez " %}{% trans "en ajouter une" %}. + {% endif %} +
++ {% trans "Catégorie" %}{{ content.subcategory.all|pluralize }} : + + {% for category in content.subcategory.all %} + {% if forloop.first %}{% elif forloop.last %} {% trans "et" %}{% else %},{% endif %} + {% if content.is_opinion %} + {{ category.title }} + {% else %} + {{ category.title }} + {% endif %} + {% endfor %} +
diff --git a/templates/tutorialv2/includes/headline/contributions.part.html b/templates/tutorialv2/includes/headline/contributions.part.html new file mode 100644 index 0000000000..e81e93a469 --- /dev/null +++ b/templates/tutorialv2/includes/headline/contributions.part.html @@ -0,0 +1,21 @@ +{% load i18n %} +{% load pluralize_fr %} + +{% with count_contributions=contributions|length %} + {% if count_contributions > 0 %} ++ {% trans "Ce contenu a bénéficié des apports de" %} + {{ count_contributions }} {% trans "contributeur" %}{{ count_contributions|pluralize }} + +
{{ licence }}
+ + {% trans "Modifier la licence" %} + ++ Choisissez la licence de votre publication ! +
+ {% endif %} + + {% crispy form %} +{% elif licence %} + {{ licence }} +{% endif %} diff --git a/templates/tutorialv2/includes/headline/obsolescence_warning.part.html b/templates/tutorialv2/includes/headline/obsolescence_warning.part.html new file mode 100644 index 0000000000..26ed1623bc --- /dev/null +++ b/templates/tutorialv2/includes/headline/obsolescence_warning.part.html @@ -0,0 +1,11 @@ +{% load i18n %} + +{% if is_obsolete %} +{% trans "Temps de lecture estimé : " %}{{ reading_time|humanize_duration }}
+{% elif not is_part_or_chapter %} +{% trans "Temps de lecture estimé à moins d’une minute." %}
+{% endif %} diff --git a/templates/tutorialv2/includes/headline/tags.part.html b/templates/tutorialv2/includes/headline/tags.part.html new file mode 100644 index 0000000000..ce88293c26 --- /dev/null +++ b/templates/tutorialv2/includes/headline/tags.part.html @@ -0,0 +1,17 @@ +{% load captureas %} + +{% captureas tag_list_url %} + {% if content.is_opinion %} + {% url 'opinion:list' %} + {% else %} + {% url 'publication:list' %} + {% endif %} +{% endcaptureas %} + +{% if db_content.tags.all|length > 0 %} ++ {% if online_mode and update_date == public_object.publication_date %} + {% trans "Publié" %} + + {% else %} + {% trans "Dernière mise à jour" %} + + {% endif %} +
+{% endif %} diff --git a/templates/tutorialv2/includes/headline/validation_info.part.html b/templates/tutorialv2/includes/headline/validation_info.part.html new file mode 100644 index 0000000000..dd05864de8 --- /dev/null +++ b/templates/tutorialv2/includes/headline/validation_info.part.html @@ -0,0 +1,46 @@ +{% load i18n %} +{% load emarkdown %} +{% load captureas %} + +{% captureas validation_comment_from_authors %} + {% if validation.comment_authors %} ++ {% trans "Cette version est en cours de validation par" %} + {% include "misc/member_item.part.html" with member=validation.validator %}. +
+ {{ validation_comment_from_authors }} +{% endif %} + +{% if state.current_version_and_waiting_validator %} +{% trans "Cette version est en attente d’un validateur." %}
+ {{ validation_comment_from_authors }} +{% endif %} + +{% url "content:view-version" content.pk content.slug content.sha_validation as validation_version_url %} + +{% if state.other_version_and_reserved %} ++ + {% trans "Une autre version de cette publication" %} + + {% trans "est en cours de validation par" %} + {% include "misc/member_item.part.html" with member=validation.validator %}. +
+{% endif %} + +{% if state.other_version_and_waiting_validator %} ++ + {% trans "Une autre version de cette publication" %} + + {% trans "est en attente d’un validateur." %} +
+{% endif %} diff --git a/templates/tutorialv2/includes/meta/dcmi_cards.part.html b/templates/tutorialv2/includes/meta/dcmi_cards.part.html new file mode 100644 index 0000000000..d32427b56b --- /dev/null +++ b/templates/tutorialv2/includes/meta/dcmi_cards.part.html @@ -0,0 +1,18 @@ +{% load displayable_authors %} +{% load joinby %} + + + +{% for author in db_content|displayable_authors:is_online %} + +{% endfor %} + + + + +{% if content.meta_description %}{% endif %} + + +{% if content.source %}{% endif %} + + diff --git a/templates/tutorialv2/includes/image_illu.part.html b/templates/tutorialv2/includes/meta/image_illu.part.html similarity index 100% rename from templates/tutorialv2/includes/image_illu.part.html rename to templates/tutorialv2/includes/meta/image_illu.part.html diff --git a/templates/tutorialv2/includes/opengraph.part.html b/templates/tutorialv2/includes/meta/opengraph.part.html similarity index 100% rename from templates/tutorialv2/includes/opengraph.part.html rename to templates/tutorialv2/includes/meta/opengraph.part.html diff --git a/templates/tutorialv2/includes/sidebar/administration_actions.part.html b/templates/tutorialv2/includes/sidebar/administration_actions.part.html new file mode 100644 index 0000000000..2ae5450331 --- /dev/null +++ b/templates/tutorialv2/includes/sidebar/administration_actions.part.html @@ -0,0 +1,71 @@ +{% load i18n %} +{% load captureas %} +{% load crispy_forms_tags %} + +{% if administration_actions.show_block %} + +{% endif %} diff --git a/templates/tutorialv2/includes/sidebar/authors_management.part.html b/templates/tutorialv2/includes/sidebar/authors_management.part.html new file mode 100644 index 0000000000..32154d3345 --- /dev/null +++ b/templates/tutorialv2/includes/sidebar/authors_management.part.html @@ -0,0 +1,42 @@ +{% load i18n %} + + ++ Lorsque vous rédigez un tutoriel ou un article, il se peut que vous ayiez + besoin d'aide. La communauté est là pour vous ! En sélectionnant un des éléments + ci-dessous, votre contenu sera répertorié dans la page des aides + et la communauté pourra vous contacter. +
+ {% endblocktrans %} +- {{ content.licence }} -
- {% endif %} - -- {% trans "Il n’y a pas d’introduction." %} - {% if can_add_something %} - {% trans "Vous pouvez " %}{% trans "en ajouter une" %}. - {% endif %} -
-- {{ "Ce"|feminize:container.get_level_as_string }} {{ container.get_level_as_string|lower }} {% trans " est actuellement vide." %} + {% trans "Il n’y a pas d’introduction." %} + {% if can_add_something %} + {% trans "Vous pouvez " %}{% trans "en ajouter une" %}. + {% endif %}
- {% if container.can_add_extract and container.can_add_container and can_add_something %} -+ {{ "Ce"|feminize:container.get_level_as_string }} {{ container.get_level_as_string|lower }} {% trans " est vide." %} +
+ {% if container.can_add_extract and container.can_add_container and can_add_something %} +{% trans "Cliquer sur ajouter pour ajouter un nouveau chapitre." %}
{% trans "Cliquer sur ajouter pour ajouter un nouveau chapitre." %}
-{% trans "Cliquer sur ajouter pour rédiger une nouvelle section." %}
{% trans "Cliquer sur ajouter pour rédiger une nouvelle section." %}
-- {% trans "Il n’y a pas de conclusion." %} - {% if can_add_something %} - {% trans "Vous pouvez " %}{% trans "en ajouter une" %}. - {% endif %} -
-+ {% trans "Il n’y a pas de conclusion." %} + {% if can_add_something %} + {% trans "Vous pouvez " %}{% trans "en ajouter une" %}. + {% endif %} +
+- {{ content.licence }} -
- {% endif %} - -{{ content.licence }}
- - {% trans "Modifier la licence" %} - -- Choisissez la licence de votre publication ! -
- {% endif %} + {% include "tutorialv2/includes/headline/header.part.html" with show_thumbnail=True content=content title=content.title subtitle=content.description %} - {% crispy form_edit_license %} - {% elif content.licence %} - {{ content.licence }} - {% endif %} + {% include "tutorialv2/includes/headline/validation_info.part.html" with state=display_config.validation_info %} -- {% trans "Ce contenu est en attente d’un validateur." %} -
- {% elif validation.is_pending_valid %} -- {% trans "Ce contenu est en cours de validation par" %} - {% include "misc/member_item.part.html" with member=validation.validator %} -
- {% endif %} - {% if validation.comment_authors %} - - {% endif %} - {% else %} - {% if validation.is_pending %} -- - {% trans "Une autre version de ce contenu" %} - - {% trans "est en attente d’un validateur" %} -
- {% elif validation.is_pending_valid %} -- - {% trans "Une autre version de ce contenu" %} - - {% trans "est en cours de validation par" %} - {% include "misc/member_item.part.html" with member=validation.validator %} -
- {% endif %} - {% endif %} - {% endif %} + {% if display_config.online_config.show_obsolescence_warning %} + {% include "tutorialv2/includes/headline/obsolescence_warning.part.html" with is_obsolete=is_obsolete %} {% endif %} - {% if content.is_beta %} -- {% trans "Il n’y a pas d’introduction." %} - {% if can_add_something %} - {% trans "Vous pouvez " %}{% trans "en ajouter une" %}. - {% endif %} -
-- {% trans "Ce contenu est actuellement vide." %} {% trans "Vous pouvez :" %} -
-- {% trans "Ce contenu est actuellement vide." %} -
-{% trans "Cette partie n'est pas encore créée. Vous devez la créer avant de pouvoir y ajouter un élément." %}
-{% trans "Cliquer sur ajouter pour rédiger une nouvelle section." %}
-- {% trans "Il n’y a pas de conclusion." %} - {% if can_add_something %} - {% trans "Vous pouvez " %}{% trans "en ajouter une" %}. - {% endif %} -
-- Lorsque vous rédigez un tutoriel ou un article, il se peut que vous ayiez - besoin d'aide. La communauté est là pour vous ! En sélectionnant un des éléments - ci-dessous, votre contenu sera répertorié dans la page des aides - et la communauté pourra vous contacter. -
- {% endblocktrans %} -- {{ content.licence }} -
- {% endif %} -
{% trans "Le message suivant a été laissé à destination des validateurs" %} :
+ +