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

Permet d'écrire des billets ou articles avec une structure de tutoriel #6550

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

Arnaud-D
Copy link
Contributor

Je continue à découper #6441.

Cette PR permet de créer des billets et articles avec des conteneurs imbriqués, comme pour les tutos. J'ajoute aussi les routes associées, histoire qu'on puisse effectivement lire tout ça. :D

Contrôle qualité

  • Créer des articles et billets avec une structure de tuto (parties, chapitres...).
  • Tester la publication, la dépublication, la validation, la mise en bêta, etc.
  • Se promener sur les pages publiques, brouillon, beta (pour les articles) et voir si on peut accéder à tout. Normalement seules les pages publiques ont des URL particulières (les autres sont en /contenus/).

@Arnaud-D Arnaud-D added C-Back Concerne le back-end Django hacktoberfest-accepted Pull request approuvée pour le Hacktoberfest labels Oct 28, 2023
@Arnaud-D Arnaud-D added this to En développement in Suivi des PR via automation Oct 28, 2023
@Arnaud-D Arnaud-D moved this from En développement to En attente de QA in Suivi des PR Oct 28, 2023
@coveralls
Copy link

coveralls commented Oct 28, 2023

Coverage Status

coverage: 88.825% (+0.004%) from 88.821%
when pulling f0faa76 on Arnaud-D:structure-tuto-pour-billet-et-article
into d3c7fee on zestedesavoir:dev.

Copy link
Member

@philippemilink philippemilink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le découpage que tu fais dans les fichiers zds/tutorialv2/urls/urls_opinions.py et zds/tutorialv2/urls/urls_articles.py est bien, mais par souci de cohérence, ce serait bien de le faire aussi dans zds/tutorialv2/urls/urls_tutorials.py.

@@ -1,6 +1,7 @@
import contextlib
import copy
from pathlib import Path
from typing import List
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'étais sceptique qu'on en ait besoin, et j'avais raison, tu ne t'en sers même pas :)

Apparemment, il n'y a plus de cet import depuis Python 3.9.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fait.

Suivi des PR automation moved this from En attente de QA to Modification demandée Nov 1, 2023
@Arnaud-D Arnaud-D force-pushed the structure-tuto-pour-billet-et-article branch 2 times, most recently from 8c1cd49 to 86b0dbf Compare December 9, 2023 18:15
@Arnaud-D
Copy link
Contributor Author

Arnaud-D commented Dec 9, 2023

J'ai fait les modifs.

@Arnaud-D Arnaud-D moved this from Modification demandée to En attente de QA in Suivi des PR Dec 9, 2023
@Arnaud-D Arnaud-D force-pushed the structure-tuto-pour-billet-et-article branch from 86b0dbf to 0c65fce Compare December 10, 2023 18:16
@Arnaud-D Arnaud-D force-pushed the structure-tuto-pour-billet-et-article branch from 0c65fce to 98a722c Compare February 24, 2024 06:33
@Arnaud-D Arnaud-D force-pushed the structure-tuto-pour-billet-et-article branch 3 times, most recently from f7e8396 to b11678f Compare March 9, 2024 09:58
@Arnaud-D Arnaud-D force-pushed the structure-tuto-pour-billet-et-article branch from b11678f to 8152adf Compare March 16, 2024 08:42
@Arnaud-D Arnaud-D force-pushed the structure-tuto-pour-billet-et-article branch from 8152adf to 7e1d037 Compare March 29, 2024 21:53
Copy link
Member

@philippemilink philippemilink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je n'ai pas testé, mais encore quelques petites remarques sur le code. Il faudrait aussi mettre à jour la documentation, par exemple ici.

@@ -265,8 +265,7 @@ def can_add_container(self):
"""
if not self.has_extracts():
if self.get_tree_depth() < settings.ZDS_APP["content"]["max_tree_depth"] - 1:
if not self.top_container().type in SINGLE_CONTAINER_CONTENT_TYPES:
return True
return True
return False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tout le contenu de cette fonction peut être remplacé par :

return not self.has_extracts() and self.get_tree_depth() < settings.ZDS_APP["content"]["max_tree_depth"] - 1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fait.

continuous_list.append(child) # it contains Extract, this is a chapter, so paginated
else: # Container is a part
for sub_child in child.children:
continuous_list.append(sub_child) # even if empty `sub_child.childreen`, it's chapter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
continuous_list.append(sub_child) # even if empty `sub_child.childreen`, it's chapter
continuous_list.append(sub_child) # even if empty `sub_child.children`, it's chapter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fait.

self.assert_can_be_reached(route, route_args)


@override_for_contents()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@override_for_contents()

Tu en as vraiment besoin ? Tu ne l'utilises pas pour OpinionDisplayRoutesTests et tu le définis pour la classe parente BasicRouteTests.

Copy link
Contributor Author

@Arnaud-D Arnaud-D Apr 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La ligne ne sert à rien, effectivement.

Par contre, le décorateur sert dès qu'on joue avec les contenus dans les tests. Sinon, ça pourrit l'environnement de développement et on se retrouve à devoir le reconstruire.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Même si je suppose que c'est testé ailleurs, aussi ajouter les tests équivalents pour les tutoriels ?

Copy link
Contributor Author

@Arnaud-D Arnaud-D Apr 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est testé dans les tests fort complexes auxquels on n'aime pas trop toucher. ^^

Je vais ajouter aussi l'équivalent pour les tutoriels, ça évitera de se poser trop de questions et ça facilitera le test des vues de redirections permanentes quand on changera les URL lors de la refonte des types de publication.

Suivi des PR automation moved this from En attente de QA to Modification demandée Apr 28, 2024
@Arnaud-D Arnaud-D force-pushed the structure-tuto-pour-billet-et-article branch from 7e1d037 to d8a2cc0 Compare April 28, 2024 18:43
@Arnaud-D Arnaud-D force-pushed the structure-tuto-pour-billet-et-article branch 2 times, most recently from 467f3e6 to aa38e15 Compare April 28, 2024 18:47
@Arnaud-D Arnaud-D moved this from Modification demandée to En attente de QA in Suivi des PR Apr 28, 2024
@Arnaud-D Arnaud-D force-pushed the structure-tuto-pour-billet-et-article branch from 6e3d1f5 to a863fb6 Compare April 28, 2024 19:18
@Arnaud-D Arnaud-D force-pushed the structure-tuto-pour-billet-et-article branch from a863fb6 to f0faa76 Compare April 28, 2024 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Back Concerne le back-end Django hacktoberfest-accepted Pull request approuvée pour le Hacktoberfest
Projects
Suivi des PR
  
En attente de QA
Development

Successfully merging this pull request may close these issues.

None yet

3 participants