From 2cf1b0d727d3fb1ef0c9ed7f9bc4007ff2ddc421 Mon Sep 17 00:00:00 2001 From: Sylvain Boissel Date: Mon, 27 Nov 2023 11:16:56 +0100 Subject: [PATCH 1/9] Added the userbar, removed a warning --- config/settings.py | 2 +- dashboard/__init__.py | 0 dashboard/admin.py | 4 ++++ dashboard/apps.py | 6 ++++++ dashboard/migrations/__init__.py | 0 dashboard/models.py | 4 ++++ .../templates/wagtailadmin/userbar/base.html | 15 +++++++++++++++ dashboard/tests.py | 4 ++++ dashboard/views.py | 3 +++ templates/base.html | 12 ++++++++---- 10 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 dashboard/__init__.py create mode 100644 dashboard/admin.py create mode 100644 dashboard/apps.py create mode 100644 dashboard/migrations/__init__.py create mode 100644 dashboard/models.py create mode 100644 dashboard/templates/wagtailadmin/userbar/base.html create mode 100644 dashboard/tests.py create mode 100644 dashboard/views.py diff --git a/config/settings.py b/config/settings.py index 603730ee..881ad335 100644 --- a/config/settings.py +++ b/config/settings.py @@ -41,6 +41,7 @@ INSTALLED_APPS = [ "storages", + "dashboard", "wagtail.contrib.redirects", "wagtail.contrib.settings", "wagtail.embeds", @@ -51,7 +52,6 @@ "wagtail.admin", "wagtail.search", "wagtail", - "wagtail.contrib.modeladmin", "wagtailmenus", "taggit", "django.contrib.auth", diff --git a/dashboard/__init__.py b/dashboard/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/dashboard/admin.py b/dashboard/admin.py new file mode 100644 index 00000000..a011d19b --- /dev/null +++ b/dashboard/admin.py @@ -0,0 +1,4 @@ +from django.contrib import admin + + +# Register your models here. diff --git a/dashboard/apps.py b/dashboard/apps.py new file mode 100644 index 00000000..db15b459 --- /dev/null +++ b/dashboard/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class DashboardConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "dashboard" diff --git a/dashboard/migrations/__init__.py b/dashboard/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/dashboard/models.py b/dashboard/models.py new file mode 100644 index 00000000..c389f5d7 --- /dev/null +++ b/dashboard/models.py @@ -0,0 +1,4 @@ +from django.db import models + + +# Create your models here. diff --git a/dashboard/templates/wagtailadmin/userbar/base.html b/dashboard/templates/wagtailadmin/userbar/base.html new file mode 100644 index 00000000..9982f4a8 --- /dev/null +++ b/dashboard/templates/wagtailadmin/userbar/base.html @@ -0,0 +1,15 @@ +{% extends "wagtailadmin/userbar/base.html" %} + +{% load wagtailadmin_tags i18n %} + +{% block branding_logo %} +
+ + + {% include "wagtailadmin/icons/edit.svg" %} + + +
+ + {% icon name="edit" class_name="w-userbar-icon" %} +{% endblock %} diff --git a/dashboard/tests.py b/dashboard/tests.py new file mode 100644 index 00000000..7c72b39d --- /dev/null +++ b/dashboard/tests.py @@ -0,0 +1,4 @@ +from django.test import TestCase + + +# Create your tests here. diff --git a/dashboard/views.py b/dashboard/views.py new file mode 100644 index 00000000..91ea44a2 --- /dev/null +++ b/dashboard/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/templates/base.html b/templates/base.html index 0da253d6..b2a13755 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,4 +1,4 @@ -{% load static dsfr_tags wagtailsettings_tags %} +{% load static dsfr_tags wagtailuserbar wagtailsettings_tags %} {% get_settings %} @@ -23,11 +23,15 @@ {% block skiplinks %} {% dsfr_skiplinks skiplinks %} {% endblock skiplinks %} + {% include "blocks/header.html" %} {% dsfr_theme_modale %} -
- {% block content %}{% endblock content %} -
+ {% wagtailuserbar %} + +
+ {% block content %}{% endblock content %} +
+ {% include "blocks/footer.html" %} {% dsfr_js nonce=request.csp_nonce %} From b2aff2b1704320e290e86483d360afd802e95d3b Mon Sep 17 00:00:00 2001 From: Sylvain Boissel Date: Mon, 27 Nov 2023 11:32:55 +0100 Subject: [PATCH 2/9] Vertically align top of image and text in text and image block --- .../templates/content_manager/blocks/imageandtext.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content_manager/templates/content_manager/blocks/imageandtext.html b/content_manager/templates/content_manager/blocks/imageandtext.html index 37f0b523..b9898118 100644 --- a/content_manager/templates/content_manager/blocks/imageandtext.html +++ b/content_manager/templates/content_manager/blocks/imageandtext.html @@ -4,7 +4,7 @@
-
{% image block.value.image original class="fr-responsive-img" %}
+
{% image block.value.image original class="fr-responsive-img" %}
{{ block.value.text|richtext }} From b0e5a2c90fe679fcb8d2659635f187ac88fb4ce7 Mon Sep 17 00:00:00 2001 From: Sylvain Boissel Date: Mon, 27 Nov 2023 14:54:32 +0100 Subject: [PATCH 3/9] Add tests for dashboard --- content_manager/tests/test_views.py | 6 +-- dashboard/admin.py | 4 -- dashboard/models.py | 4 -- .../templates/wagtailadmin/userbar/base.html | 2 +- dashboard/tests.py | 4 -- dashboard/tests/__init__.py | 0 dashboard/tests/test_views.py | 38 +++++++++++++++++++ dashboard/views.py | 2 - 8 files changed, 42 insertions(+), 18 deletions(-) delete mode 100644 dashboard/admin.py delete mode 100644 dashboard/models.py delete mode 100644 dashboard/tests.py create mode 100644 dashboard/tests/__init__.py create mode 100644 dashboard/tests/test_views.py diff --git a/content_manager/tests/test_views.py b/content_manager/tests/test_views.py index 0ee2b228..d455c4e6 100644 --- a/content_manager/tests/test_views.py +++ b/content_manager/tests/test_views.py @@ -8,13 +8,13 @@ class ContentPageTestCase(WagtailPageTestCase): def setUp(self): home = Page.objects.get(slug="home") - self.user = User.objects.create_superuser("test", "test@test.test", "pass") - self.user.save() + self.admin = User.objects.create_superuser("test", "test@test.test", "pass") + self.admin.save() self.content_page = home.add_child( instance=ContentPage( title="Page de contenu", slug="content-page", - owner=self.user, + owner=self.admin, ) ) self.content_page.save() diff --git a/dashboard/admin.py b/dashboard/admin.py deleted file mode 100644 index a011d19b..00000000 --- a/dashboard/admin.py +++ /dev/null @@ -1,4 +0,0 @@ -from django.contrib import admin - - -# Register your models here. diff --git a/dashboard/models.py b/dashboard/models.py deleted file mode 100644 index c389f5d7..00000000 --- a/dashboard/models.py +++ /dev/null @@ -1,4 +0,0 @@ -from django.db import models - - -# Create your models here. diff --git a/dashboard/templates/wagtailadmin/userbar/base.html b/dashboard/templates/wagtailadmin/userbar/base.html index 9982f4a8..53b39864 100644 --- a/dashboard/templates/wagtailadmin/userbar/base.html +++ b/dashboard/templates/wagtailadmin/userbar/base.html @@ -11,5 +11,5 @@
- {% icon name="edit" class_name="w-userbar-icon" %} + {% icon name="edit" classname="w-userbar-icon" %} {% endblock %} diff --git a/dashboard/tests.py b/dashboard/tests.py deleted file mode 100644 index 7c72b39d..00000000 --- a/dashboard/tests.py +++ /dev/null @@ -1,4 +0,0 @@ -from django.test import TestCase - - -# Create your tests here. diff --git a/dashboard/tests/__init__.py b/dashboard/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/dashboard/tests/test_views.py b/dashboard/tests/test_views.py new file mode 100644 index 00000000..6268c5b0 --- /dev/null +++ b/dashboard/tests/test_views.py @@ -0,0 +1,38 @@ +from django.contrib.auth.models import User +from wagtail.models import Page +from wagtail.test.utils import WagtailPageTestCase + +from content_manager.models import ContentPage + + +class DashboardTestCase(WagtailPageTestCase): + def setUp(self): + home = Page.objects.get(slug="home") + self.admin = User.objects.create_superuser("test", "test@test.test", "pass") + self.admin.save() + + self.content_page = home.add_child( + instance=ContentPage( + title="Page de contenu", + slug="content-page", + owner=self.admin, + ) + ) + self.content_page.save() + + def test_userbar_is_present_when_logged_in(self): + url = self.content_page.url + response = self.client.get(url) + self.assertNotContains( + response, + '', + html=True, + ) + + self.client.force_login(self.admin) + response = self.client.get(url) + self.assertContains( + response, + '', + html=True, + ) diff --git a/dashboard/views.py b/dashboard/views.py index 91ea44a2..60f00ef0 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -1,3 +1 @@ -from django.shortcuts import render - # Create your views here. From 0b14c614dfc1b306cd64ef8cbb77e289ff0ae3be Mon Sep 17 00:00:00 2001 From: Sylvain Boissel Date: Mon, 27 Nov 2023 15:20:46 +0100 Subject: [PATCH 4/9] Update django-dsfr --- poetry.lock | 8 ++++---- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/poetry.lock b/poetry.lock index 72bb1a55..47b4d891 100644 --- a/poetry.lock +++ b/poetry.lock @@ -389,13 +389,13 @@ django = ">=4.2" [[package]] name = "django-dsfr" -version = "0.16.2" +version = "0.16.3" description = "Integrate the French government Design System into a Django app" optional = false python-versions = ">=3.8,<4.0" files = [ - {file = "django_dsfr-0.16.2-py3-none-any.whl", hash = "sha256:79d04b59892be29e72b50e992a873f5ea2799c87c29ed1283d60580ee6c18996"}, - {file = "django_dsfr-0.16.2.tar.gz", hash = "sha256:c6f6ae381366092108085b3b4b62b7e62611a240e22e52d8e01aa429d6b88660"}, + {file = "django_dsfr-0.16.3-py3-none-any.whl", hash = "sha256:f47dfc3e94c04a3ac568a238bf157517e583c6519662c868c3ace78707d6eb32"}, + {file = "django_dsfr-0.16.3.tar.gz", hash = "sha256:c2016703f6965fd0150aa4ecd4189e2eb41343e0d057831d2e2e2789a8955733"}, ] [package.dependencies] @@ -1650,4 +1650,4 @@ testing = ["Pillow (>=9.1.0,<11.0.0)", "Wand (>=0.6,<1.0)", "black (==22.3.0)", [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "c1262c1684b441db158e4162af80d90c4d92247a86c58a38f58827c98827f0bc" +content-hash = "a60540e2441b750108f79bdb7b82ecbaa11da02f7bbb2f33f2885b6a34582439" diff --git a/pyproject.toml b/pyproject.toml index bae13fc8..d93321fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ readme = "README.md" python = "^3.10" django = "^4.2.7" wagtail = "^5.2.1" -django-dsfr = "^0.16.2" +django-dsfr = "^0.16.3" psycopg2-binary = "^2.9.9" python-dotenv = "^1.0.0" dj-database-url = "^2.1.0" From 16bd14c0365908e081aba252eadbc73f0356b365 Mon Sep 17 00:00:00 2001 From: Sylvain Boissel Date: Mon, 27 Nov 2023 15:27:47 +0100 Subject: [PATCH 5/9] Moved the blocks to blocks.py --- content_manager/blocks.py | 201 +++++++++++++++++++++++++++++++++++ content_manager/models.py | 216 +++----------------------------------- 2 files changed, 215 insertions(+), 202 deletions(-) create mode 100644 content_manager/blocks.py diff --git a/content_manager/blocks.py b/content_manager/blocks.py new file mode 100644 index 00000000..990258f1 --- /dev/null +++ b/content_manager/blocks.py @@ -0,0 +1,201 @@ +from wagtail import blocks +from wagtail.documents.blocks import DocumentChooserBlock +from wagtail.images.blocks import ImageChooserBlock + + +# Wagtail Block Documentation : https://docs.wagtail.org/en/stable/reference/streamfield/blocks.html + + +## Basic blocks +class AccordionBlock(blocks.StructBlock): + title = blocks.CharBlock(label="Titre") + content = blocks.RichTextBlock(label="Contenu") + + +class AccordionsBlock(blocks.StreamBlock): + title = blocks.CharBlock(label="Titre") + accordion = AccordionBlock(label="Accordéon", min_num=1, max_num=15) + + +level_choices = [ + ("error", "Erreur"), + ("success", "Succès"), + ("info", "Information"), + ("warning", "Attention"), +] + + +class AlertBlock(blocks.StructBlock): + title = blocks.CharBlock(label="Titre du message", required=False) + description = blocks.TextBlock(label="Texte du message", required=False) + level = blocks.ChoiceBlock(label="Type de message", choices=level_choices) + + +badge_level_choices = [ + ("error", "Erreur"), + ("success", "Succès"), + ("info", "Information"), + ("warning", "Attention"), + ("new", "Nouveau"), + ("grey", "Gris"), + ("green-emeraude", "Vert"), + ("blue-ecume", "Bleu"), +] + + +class BadgeBlock(blocks.StructBlock): + text = blocks.CharBlock(label="Texte du badge", required=False) + color = blocks.ChoiceBlock(label="Couleur de badge", choices=badge_level_choices, required=False) + hide_icon = blocks.BooleanBlock(label="Masquer l'icon du badge", required=False) + + +class BadgesListBlock(blocks.StreamBlock): + badge = BadgeBlock(label="Badge") + + +class CalloutBlock(blocks.StructBlock): + title = blocks.CharBlock(label="Titre de la mise en vant", required=False) + text = blocks.TextBlock(label="Texte mis en avant", required=False) + + +class CardBlock(blocks.StructBlock): + title = blocks.CharBlock(label="Titre") + description = blocks.TextBlock(label="Texte") + image = ImageChooserBlock(label="Image") + url = blocks.URLBlock(label="Lien", required=False) + document = DocumentChooserBlock( + label="ou Document", + help_text=( + "Sélectionnez un document pour rendre la carte cliquable vers " + "celui ci (si le champ `Lien` n'est pas renseigné)." + ), + required=False, + ) + + +class HeroBlock(blocks.StructBlock): + bg_image = ImageChooserBlock(label="Image d'arrière plan") + bg_color = blocks.RegexBlock( + label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", + regex=r"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", + error_messages={"invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe"}, + required=False, + ) + title = blocks.CharBlock(label="Titre") + text = blocks.CharBlock(label="Texte", required=False) + cta_label = blocks.CharBlock(label="Texte du bouton", required=False) + cta_link = blocks.URLBlock(label="Lien du bouton", required=False) + + +class IframeBlock(blocks.StructBlock): + title = blocks.CharBlock( + label="Titre", + help_text="Accessibilité : Le titre doit décrire, de façon claire et concise, le contenu embarqué.", + ) + url = blocks.URLBlock( + label="Lien du cadre intégré", + help_text="Exemple pour Tally : https://tally.so/embed/w2jMRa", + ) + height = blocks.IntegerBlock(label="Hauteur en pixels") + + +class ImageAndTextBlock(blocks.StructBlock): + image = ImageChooserBlock(label="Illustration (à gauche)") + image_ratio = blocks.ChoiceBlock( + label="Largeur de l'image", + choices=[ + ("3", "3/12"), + ("5", "5/12"), + ("6", "6/12"), + ], + ) + text = blocks.RichTextBlock(label="Texte avec mise en forme (à droite)") + link_label = blocks.CharBlock( + label="Titre du lien", + help_text="Le lien apparait en bas du bloc de droite, avec une flèche", + required=False, + ) + link_url = blocks.URLBlock(label="Lien", required=False) + + +class ImageBlock(blocks.StructBlock): + title = blocks.CharBlock(label="Titre", required=False) + image = ImageChooserBlock(label="Illustration") + alt = blocks.CharBlock(label="Texte alternatif (description textuelle de l'image)", required=False) + caption = blocks.CharBlock(label="Légende", required=False) + url = blocks.URLBlock(label="Lien", required=False) + + +class QuoteBlock(blocks.StructBlock): + image = ImageChooserBlock(label="Illustration (à gauche)", required=False) + quote = blocks.CharBlock(label="Citation") + author_name = blocks.CharBlock(label="Nom de l'auteur") + author_title = blocks.CharBlock(label="Titre de l'auteur") + + +class SeparatorBlock(blocks.StructBlock): + top_margin = blocks.IntegerBlock(label="Espacement au dessus", min_value=0, max_value=15, default=3) + bottom_margin = blocks.IntegerBlock(label="Espacement en dessous", min_value=0, max_value=15, default=3) + + +class StepBlock(blocks.StructBlock): + title = blocks.CharBlock(label="Titre de l'étape") + detail = blocks.TextBlock(label="Détail") + + +class StepsListBlock(blocks.StreamBlock): + step = StepBlock(label="Étape") + + +class StepperBlock(blocks.StructBlock): + title = blocks.CharBlock(label="Titre") + total = blocks.IntegerBlock(label="Nombre d'étape") + current = blocks.IntegerBlock(label="Étape en cours") + steps = StepsListBlock(label="Les étapes") + + +class TextAndCTA(blocks.StructBlock): + text = blocks.RichTextBlock(label="Texte avec mise en forme", required=False) + cta_label = blocks.CharBlock( + label="Titre de l'appel à l'action", + help_text="Le lien apparait comme un bouton sous le bloc de texte", + required=False, + ) + cta_url = blocks.CharBlock(label="Lien", required=False) + + +class TitleBlock(blocks.StructBlock): + title = blocks.CharBlock(label="Titre") + large = blocks.BooleanBlock(label="Large", required=False) + + +class VideoBlock(blocks.StructBlock): + title = blocks.CharBlock(label="Titre", required=False) + caption = blocks.CharBlock(label="Légende") + url = blocks.URLBlock( + label="Lien de la vidéo", + help_text="URL au format 'embed' (Ex. : https://www.youtube.com/embed/gLzXOViPX-0)", + ) + + +## Multi-column blocks +class MultiColumnsBlock(blocks.StreamBlock): + text = blocks.RichTextBlock(label="Texte avec mise en forme") + image = ImageBlock(label="Image") + video = VideoBlock(label="Vidéo") + card = CardBlock(label="Carte") + quote = QuoteBlock(label="Citation") + text_cta = TextAndCTA(label="Texte et appel à l'action") + iframe = IframeBlock(label="Cadre intégré") + + +class MultiColumnsWithTitleBlock(blocks.StructBlock): + bg_image = ImageChooserBlock(label="Image d'arrière plan", required=False) + bg_color = blocks.RegexBlock( + label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", + regex=r"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", + error_messages={"invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe"}, + required=False, + ) + title = blocks.CharBlock(label="Titre", required=False) + columns = MultiColumnsBlock(label="Multi-colonnes") diff --git a/content_manager/models.py b/content_manager/models.py index 541688f8..2dd29720 100644 --- a/content_manager/models.py +++ b/content_manager/models.py @@ -3,212 +3,24 @@ from wagtail import blocks from wagtail.admin.panels import FieldPanel, MultiFieldPanel from wagtail.contrib.settings.models import BaseSiteSetting, register_setting -from wagtail.documents.blocks import DocumentChooserBlock from wagtail.fields import StreamField -from wagtail.images.blocks import ImageChooserBlock from wagtail.models import Page from wagtail.search import index - -# Wagtail Block Documentation : https://docs.wagtail.org/en/stable/reference/streamfield/blocks.html -class HeroBlock(blocks.StructBlock): - bg_image = ImageChooserBlock(label="Image d'arrière plan") - bg_color = blocks.RegexBlock( - label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", - regex=r"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", - error_messages={"invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe"}, - required=False, - ) - title = blocks.CharBlock(label="Titre") - text = blocks.CharBlock(label="Texte", required=False) - cta_label = blocks.CharBlock(label="Texte du bouton", required=False) - cta_link = blocks.URLBlock(label="Lien du bouton", required=False) - - -class TitleBlock(blocks.StructBlock): - title = blocks.CharBlock(label="Titre") - large = blocks.BooleanBlock(label="Large", required=False) - - -class ImageBlock(blocks.StructBlock): - title = blocks.CharBlock(label="Titre", required=False) - image = ImageChooserBlock(label="Illustration") - alt = blocks.CharBlock(label="Texte alternatif (description textuelle de l'image)", required=False) - caption = blocks.CharBlock(label="Légende", required=False) - url = blocks.URLBlock(label="Lien", required=False) - - -class ImageAndTextBlock(blocks.StructBlock): - image = ImageChooserBlock(label="Illustration (à gauche)") - image_ratio = blocks.ChoiceBlock( - label="Largeur de l'image", - choices=[ - ("3", "3/12"), - ("5", "5/12"), - ("6", "6/12"), - ], - ) - text = blocks.RichTextBlock(label="Texte avec mise en forme (à droite)") - link_label = blocks.CharBlock( - label="Titre du lien", - help_text="Le lien apparait en bas du bloc de droite, avec une flèche", - required=False, - ) - link_url = blocks.URLBlock(label="Lien", required=False) - - -level_choices = [ - ("error", "Erreur"), - ("success", "Succès"), - ("info", "Information"), - ("warning", "Attention"), -] - - -class AlertBlock(blocks.StructBlock): - title = blocks.CharBlock(label="Titre du message", required=False) - description = blocks.TextBlock(label="Texte du message", required=False) - level = blocks.ChoiceBlock(label="Type de message", choices=level_choices) - - -color_choices = [ - ("", "Bleu/Gris"), - ("fr-callout--brown-caramel", "Marron"), - ("fr-callout--green-emeraude", "Vert"), -] - - -class CalloutBlock(blocks.StructBlock): - title = blocks.CharBlock(label="Titre de la mise en vant", required=False) - text = blocks.TextBlock(label="Texte mis en avant", required=False) - - -class QuoteBlock(blocks.StructBlock): - image = ImageChooserBlock(label="Illustration (à gauche)", required=False) - quote = blocks.CharBlock(label="Citation") - author_name = blocks.CharBlock(label="Nom de l'auteur") - author_title = blocks.CharBlock(label="Titre de l'auteur") - - -class VideoBlock(blocks.StructBlock): - title = blocks.CharBlock(label="Titre", required=False) - caption = blocks.CharBlock(label="Légende") - url = blocks.URLBlock( - label="Lien de la vidéo", - help_text="URL au format 'embed' (Ex. : https://www.youtube.com/embed/gLzXOViPX-0)", - ) - - -badge_level_choices = [ - ("error", "Erreur"), - ("success", "Succès"), - ("info", "Information"), - ("warning", "Attention"), - ("new", "Nouveau"), - ("grey", "Gris"), - ("green-emeraude", "Vert"), - ("blue-ecume", "Bleu"), -] - - -class CardBlock(blocks.StructBlock): - title = blocks.CharBlock(label="Titre") - description = blocks.TextBlock(label="Texte") - image = ImageChooserBlock(label="Image") - url = blocks.URLBlock(label="Lien", required=False) - document = DocumentChooserBlock( - label="ou Document", - help_text=( - "Sélectionnez un document pour rendre la carte cliquable vers " - "celui ci (si le champ `Lien` n'est pas renseigné)." - ), - required=False, - ) - - -class BadgeBlock(blocks.StructBlock): - text = blocks.CharBlock(label="Texte du badge", required=False) - color = blocks.ChoiceBlock(label="Couleur de badge", choices=badge_level_choices, required=False) - hide_icon = blocks.BooleanBlock(label="Masquer l'icon du badge", required=False) - - -class BadgesListBlock(blocks.StreamBlock): - badge = BadgeBlock(label="Badge") - - -class TextAndCTA(blocks.StructBlock): - text = blocks.RichTextBlock(label="Texte avec mise en forme", required=False) - cta_label = blocks.CharBlock( - label="Titre de l'appel à l'action", - help_text="Le lien apparait comme un bouton sous le bloc de texte", - required=False, - ) - cta_url = blocks.CharBlock(label="Lien", required=False) - - -class IframeBlock(blocks.StructBlock): - title = blocks.CharBlock( - label="Titre", - help_text="Accessibilité : Le titre doit décrire, de façon claire et concise, le contenu embarqué.", - ) - url = blocks.URLBlock( - label="Lien du cadre intégré", - help_text="Exemple pour Tally : https://tally.so/embed/w2jMRa", - ) - height = blocks.IntegerBlock(label="Hauteur en pixels") - - -class MultiColumnsBlock(blocks.StreamBlock): - text = blocks.RichTextBlock(label="Texte avec mise en forme") - image = ImageBlock(label="Image") - video = VideoBlock(label="Vidéo") - card = CardBlock(label="Carte") - quote = QuoteBlock(label="Citation") - text_cta = TextAndCTA(label="Texte et appel à l'action") - iframe = IframeBlock(label="Cadre intégré") - - -class MultiColumnsWithTitleBlock(blocks.StructBlock): - bg_image = ImageChooserBlock(label="Image d'arrière plan", required=False) - bg_color = blocks.RegexBlock( - label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", - regex=r"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", - error_messages={"invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe"}, - required=False, - ) - title = blocks.CharBlock(label="Titre", required=False) - columns = MultiColumnsBlock(label="Multi-colonnes") - - -class AccordionBlock(blocks.StructBlock): - title = blocks.CharBlock(label="Titre") - content = blocks.RichTextBlock(label="Contenu") - - -class AccordionsBlock(blocks.StreamBlock): - title = blocks.CharBlock(label="Titre") - accordion = AccordionBlock(label="Accordéon", min_num=1, max_num=15) - - -class StepBlock(blocks.StructBlock): - title = blocks.CharBlock(label="Titre de l'étape") - detail = blocks.TextBlock(label="Détail") - - -class StepsListBlock(blocks.StreamBlock): - step = StepBlock(label="Étape") - - -class StepperBlock(blocks.StructBlock): - title = blocks.CharBlock(label="Titre") - total = blocks.IntegerBlock(label="Nombre d'étape") - current = blocks.IntegerBlock(label="Étape en cours") - steps = StepsListBlock(label="Les étapes") - - -class SeparatorBlock(blocks.StructBlock): - top_margin = blocks.IntegerBlock(label="Espacement au dessus", min_value=0, max_value=15, default=3) - bottom_margin = blocks.IntegerBlock(label="Espacement en dessous", min_value=0, max_value=15, default=3) +from content_manager.blocks import ( + AccordionsBlock, + AlertBlock, + CalloutBlock, + HeroBlock, + ImageAndTextBlock, + ImageBlock, + MultiColumnsWithTitleBlock, + QuoteBlock, + SeparatorBlock, + StepperBlock, + TitleBlock, + VideoBlock, +) class ContentPage(Page): From 289cbae281b0fae9b3c591f908159aafb2ab77e2 Mon Sep 17 00:00:00 2001 From: Sylvain Boissel Date: Mon, 27 Nov 2023 15:52:42 +0100 Subject: [PATCH 6/9] Add a heading_tag parameter to the callout block to resolve an accessibility issue --- .pre-commit-config.yaml | 1 + content_manager/blocks.py | 11 + .../migrations/0008_alter_contentpage_body.py | 438 ++++++++++++++++++ .../content_manager/blocks/callout.html | 8 + .../content_manager/content_page.html | 8 +- 5 files changed, 459 insertions(+), 7 deletions(-) create mode 100644 content_manager/migrations/0008_alter_contentpage_body.py create mode 100644 content_manager/templates/content_manager/blocks/callout.html diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2821c449..f70815b4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,6 +9,7 @@ repos: rev: 6.1.0 hooks: - id: flake8 + exclude: /migrations/ - repo: https://github.com/pycqa/isort rev: 5.12.0 hooks: diff --git a/content_manager/blocks.py b/content_manager/blocks.py index 990258f1..ea2a4eb9 100644 --- a/content_manager/blocks.py +++ b/content_manager/blocks.py @@ -53,9 +53,20 @@ class BadgesListBlock(blocks.StreamBlock): badge = BadgeBlock(label="Badge") +heading_choices = [ + ("h2", "En-tête 2"), + ("h3", "En-tête 3"), + ("h4", "En-tête 4"), + ("h5", "En-tête 5"), + ("h6", "En-tête 6"), + ("p", "Paragraphe"), +] + + class CalloutBlock(blocks.StructBlock): title = blocks.CharBlock(label="Titre de la mise en vant", required=False) text = blocks.TextBlock(label="Texte mis en avant", required=False) + heading_tag = blocks.ChoiceBlock(label="Niveau de titre", choices=heading_choices, default="h3") class CardBlock(blocks.StructBlock): diff --git a/content_manager/migrations/0008_alter_contentpage_body.py b/content_manager/migrations/0008_alter_contentpage_body.py new file mode 100644 index 00000000..37b8e4cb --- /dev/null +++ b/content_manager/migrations/0008_alter_contentpage_body.py @@ -0,0 +1,438 @@ +# Generated by Django 4.2.7 on 2023-11-27 14:45 + +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("content_manager", "0007_cmsdsfrconfig"), + ] + + operations = [ + migrations.AlterField( + model_name="contentpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ("bg_image", wagtail.images.blocks.ImageChooserBlock(label="Image d'arrière plan")), + ( + "bg_color", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" + }, + label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", + regex="^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("text", wagtail.blocks.CharBlock(label="Texte", required=False)), + ("cta_label", wagtail.blocks.CharBlock(label="Texte du bouton", required=False)), + ("cta_link", wagtail.blocks.URLBlock(label="Lien du bouton", required=False)), + ], + label="Section promotionnelle", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("large", wagtail.blocks.BooleanBlock(label="Large", required=False)), + ], + label="Titre de page", + ), + ), + ("paragraph", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme")), + ("paragraphlarge", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (large)")), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre", required=False)), + ("image", wagtail.images.blocks.ImageChooserBlock(label="Illustration")), + ( + "alt", + wagtail.blocks.CharBlock( + label="Texte alternatif (description textuelle de l'image)", required=False + ), + ), + ("caption", wagtail.blocks.CharBlock(label="Légende", required=False)), + ("url", wagtail.blocks.URLBlock(label="Lien", required=False)), + ] + ), + ), + ( + "imageandtext", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock(label="Illustration (à gauche)")), + ( + "image_ratio", + wagtail.blocks.ChoiceBlock( + choices=[("3", "3/12"), ("5", "5/12"), ("6", "6/12")], + label="Largeur de l'image", + ), + ), + ("text", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (à droite)")), + ( + "link_label", + wagtail.blocks.CharBlock( + help_text="Le lien apparait en bas du bloc de droite, avec une flèche", + label="Titre du lien", + required=False, + ), + ), + ("link_url", wagtail.blocks.URLBlock(label="Lien", required=False)), + ], + label="Bloc image à gauche et texte à droite", + ), + ), + ( + "alert", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre du message", required=False)), + ("description", wagtail.blocks.TextBlock(label="Texte du message", required=False)), + ( + "level", + wagtail.blocks.ChoiceBlock( + choices=[ + ("error", "Erreur"), + ("success", "Succès"), + ("info", "Information"), + ("warning", "Attention"), + ], + label="Type de message", + ), + ), + ], + label="Message d'alerte", + ), + ), + ( + "callout", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre de la mise en vant", required=False)), + ("text", wagtail.blocks.TextBlock(label="Texte mis en avant", required=False)), + ( + "heading_tag", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "En-tête 2"), + ("h3", "En-tête 3"), + ("h4", "En-tête 4"), + ("h5", "En-tête 5"), + ("h6", "En-tête 6"), + ("p", "Paragraphe"), + ], + label="Niveau de titre", + ), + ), + ], + label="Texte mise en avant", + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration (à gauche)", required=False + ), + ), + ("quote", wagtail.blocks.CharBlock(label="Citation")), + ("author_name", wagtail.blocks.CharBlock(label="Nom de l'auteur")), + ("author_title", wagtail.blocks.CharBlock(label="Titre de l'auteur")), + ], + label="Citation", + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre", required=False)), + ("caption", wagtail.blocks.CharBlock(label="Légende")), + ( + "url", + wagtail.blocks.URLBlock( + help_text="URL au format 'embed' (Ex. : https://www.youtube.com/embed/gLzXOViPX-0)", + label="Lien de la vidéo", + ), + ), + ], + label="Vidéo", + ), + ), + ( + "multicolumns", + wagtail.blocks.StructBlock( + [ + ( + "bg_image", + wagtail.images.blocks.ImageChooserBlock( + label="Image d'arrière plan", required=False + ), + ), + ( + "bg_color", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" + }, + label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", + regex="^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(label="Titre", required=False)), + ( + "columns", + wagtail.blocks.StreamBlock( + [ + ("text", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme")), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(label="Titre", required=False), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration" + ), + ), + ( + "alt", + wagtail.blocks.CharBlock( + label="Texte alternatif (description textuelle de l'image)", + required=False, + ), + ), + ( + "caption", + wagtail.blocks.CharBlock(label="Légende", required=False), + ), + ("url", wagtail.blocks.URLBlock(label="Lien", required=False)), + ], + label="Image", + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(label="Titre", required=False), + ), + ("caption", wagtail.blocks.CharBlock(label="Légende")), + ( + "url", + wagtail.blocks.URLBlock( + help_text="URL au format 'embed' (Ex. : https://www.youtube.com/embed/gLzXOViPX-0)", + label="Lien de la vidéo", + ), + ), + ], + label="Vidéo", + ), + ), + ( + "card", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("description", wagtail.blocks.TextBlock(label="Texte")), + ( + "image", + wagtail.images.blocks.ImageChooserBlock(label="Image"), + ), + ("url", wagtail.blocks.URLBlock(label="Lien", required=False)), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + help_text="Sélectionnez un document pour rendre la carte cliquable vers celui ci (si le champ `Lien` n'est pas renseigné).", + label="ou Document", + required=False, + ), + ), + ], + label="Carte", + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration (à gauche)", required=False + ), + ), + ("quote", wagtail.blocks.CharBlock(label="Citation")), + ( + "author_name", + wagtail.blocks.CharBlock(label="Nom de l'auteur"), + ), + ( + "author_title", + wagtail.blocks.CharBlock(label="Titre de l'auteur"), + ), + ], + label="Citation", + ), + ), + ( + "text_cta", + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.RichTextBlock( + label="Texte avec mise en forme", required=False + ), + ), + ( + "cta_label", + wagtail.blocks.CharBlock( + help_text="Le lien apparait comme un bouton sous le bloc de texte", + label="Titre de l'appel à l'action", + required=False, + ), + ), + ( + "cta_url", + wagtail.blocks.CharBlock(label="Lien", required=False), + ), + ], + label="Texte et appel à l'action", + ), + ), + ( + "iframe", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Accessibilité : Le titre doit décrire, de façon claire et concise, le contenu embarqué.", + label="Titre", + ), + ), + ( + "url", + wagtail.blocks.URLBlock( + help_text="Exemple pour Tally : https://tally.so/embed/w2jMRa", + label="Lien du cadre intégré", + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock(label="Hauteur en pixels"), + ), + ], + label="Cadre intégré", + ), + ), + ], + label="Multi-colonnes", + ), + ), + ], + label="Multi-colonnes", + ), + ), + ( + "accordions", + wagtail.blocks.StreamBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ( + "accordion", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("content", wagtail.blocks.RichTextBlock(label="Contenu")), + ], + label="Accordéon", + max_num=15, + min_num=1, + ), + ), + ], + label="Accordéons", + ), + ), + ( + "stepper", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("total", wagtail.blocks.IntegerBlock(label="Nombre d'étape")), + ("current", wagtail.blocks.IntegerBlock(label="Étape en cours")), + ( + "steps", + wagtail.blocks.StreamBlock( + [ + ( + "step", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre de l'étape")), + ("detail", wagtail.blocks.TextBlock(label="Détail")), + ], + label="Étape", + ), + ) + ], + label="Les étapes", + ), + ), + ], + label="Étapes", + ), + ), + ( + "separator", + wagtail.blocks.StructBlock( + [ + ( + "top_margin", + wagtail.blocks.IntegerBlock( + default=3, label="Espacement au dessus", max_value=15, min_value=0 + ), + ), + ( + "bottom_margin", + wagtail.blocks.IntegerBlock( + default=3, label="Espacement en dessous", max_value=15, min_value=0 + ), + ), + ], + label="Séparateur", + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + ] diff --git a/content_manager/templates/content_manager/blocks/callout.html b/content_manager/templates/content_manager/blocks/callout.html new file mode 100644 index 00000000..ced06d81 --- /dev/null +++ b/content_manager/templates/content_manager/blocks/callout.html @@ -0,0 +1,8 @@ +{% load dsfr_tags wagtailcore_tags %} +
+
+
+ {% dsfr_callout title=block.value.title text=block.value.text heading_tag=block.value.heading_tag %} +
+
+
diff --git a/content_manager/templates/content_manager/content_page.html b/content_manager/templates/content_manager/content_page.html index 59ccf983..b7febbd4 100644 --- a/content_manager/templates/content_manager/content_page.html +++ b/content_manager/templates/content_manager/content_page.html @@ -56,13 +56,7 @@

{{ block.value.title }}

{% elif block.block_type == 'callout' %} -
-
-
- {% dsfr_callout title=block.value.title text=block.value.text %} -
-
-
+ {% include "content_manager/blocks/callout.html" %} {% elif block.block_type == 'quote' %}
From 1d694e3bb771263bad598595cc8b1eaedee9fa27 Mon Sep 17 00:00:00 2001 From: Sylvain Boissel Date: Mon, 27 Nov 2023 17:29:56 +0100 Subject: [PATCH 7/9] Add a new setting to add the theme toggle to the footer --- config/settings.py | 1 + ...dsfrconfig_footer_theme_modale_and_more.py | 444 ++++++++++++++++++ ...odale_cmsdsfrconfig_theme_modale_button.py | 17 + content_manager/models.py | 5 +- poetry.lock | 20 +- pyproject.toml | 1 + templates/blocks/footer.html | 7 + 7 files changed, 493 insertions(+), 2 deletions(-) create mode 100644 content_manager/migrations/0009_cmsdsfrconfig_footer_theme_modale_and_more.py create mode 100644 content_manager/migrations/0010_rename_footer_theme_modale_cmsdsfrconfig_theme_modale_button.py diff --git a/config/settings.py b/config/settings.py index 881ad335..19e5f794 100644 --- a/config/settings.py +++ b/config/settings.py @@ -53,6 +53,7 @@ "wagtail.search", "wagtail", "wagtailmenus", + "wagtail_modeladmin", "taggit", "django.contrib.auth", "django.contrib.contenttypes", diff --git a/content_manager/migrations/0009_cmsdsfrconfig_footer_theme_modale_and_more.py b/content_manager/migrations/0009_cmsdsfrconfig_footer_theme_modale_and_more.py new file mode 100644 index 00000000..40500453 --- /dev/null +++ b/content_manager/migrations/0009_cmsdsfrconfig_footer_theme_modale_and_more.py @@ -0,0 +1,444 @@ +# Generated by Django 4.2.7 on 2023-11-27 16:21 + +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("content_manager", "0008_alter_contentpage_body"), + ] + + operations = [ + migrations.AddField( + model_name="cmsdsfrconfig", + name="footer_theme_modale", + field=models.BooleanField(default=False, verbose_name="Choix du thème clair/sombre"), + ), + migrations.AlterField( + model_name="contentpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ("bg_image", wagtail.images.blocks.ImageChooserBlock(label="Image d'arrière plan")), + ( + "bg_color", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" + }, + label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", + regex="^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("text", wagtail.blocks.CharBlock(label="Texte", required=False)), + ("cta_label", wagtail.blocks.CharBlock(label="Texte du bouton", required=False)), + ("cta_link", wagtail.blocks.URLBlock(label="Lien du bouton", required=False)), + ], + label="Section promotionnelle", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("large", wagtail.blocks.BooleanBlock(label="Large", required=False)), + ], + label="Titre de page", + ), + ), + ("paragraph", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme")), + ("paragraphlarge", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (large)")), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre", required=False)), + ("image", wagtail.images.blocks.ImageChooserBlock(label="Illustration")), + ( + "alt", + wagtail.blocks.CharBlock( + label="Texte alternatif (description textuelle de l'image)", required=False + ), + ), + ("caption", wagtail.blocks.CharBlock(label="Légende", required=False)), + ("url", wagtail.blocks.URLBlock(label="Lien", required=False)), + ] + ), + ), + ( + "imageandtext", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock(label="Illustration (à gauche)")), + ( + "image_ratio", + wagtail.blocks.ChoiceBlock( + choices=[("3", "3/12"), ("5", "5/12"), ("6", "6/12")], + label="Largeur de l'image", + ), + ), + ("text", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (à droite)")), + ( + "link_label", + wagtail.blocks.CharBlock( + help_text="Le lien apparait en bas du bloc de droite, avec une flèche", + label="Titre du lien", + required=False, + ), + ), + ("link_url", wagtail.blocks.URLBlock(label="Lien", required=False)), + ], + label="Bloc image à gauche et texte à droite", + ), + ), + ( + "alert", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre du message", required=False)), + ("description", wagtail.blocks.TextBlock(label="Texte du message", required=False)), + ( + "level", + wagtail.blocks.ChoiceBlock( + choices=[ + ("error", "Erreur"), + ("success", "Succès"), + ("info", "Information"), + ("warning", "Attention"), + ], + label="Type de message", + ), + ), + ], + label="Message d'alerte", + ), + ), + ( + "callout", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre de la mise en vant", required=False)), + ("text", wagtail.blocks.TextBlock(label="Texte mis en avant", required=False)), + ( + "heading_tag", + wagtail.blocks.ChoiceBlock( + choices=[ + ("h2", "En-tête 2"), + ("h3", "En-tête 3"), + ("h4", "En-tête 4"), + ("h5", "En-tête 5"), + ("h6", "En-tête 6"), + ("p", "Paragraphe"), + ], + help_text="À adapter à la structure de la page. Par défaut en-tête 3.", + label="Niveau de titre", + ), + ), + ], + label="Texte mise en avant", + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration (à gauche)", required=False + ), + ), + ("quote", wagtail.blocks.CharBlock(label="Citation")), + ("author_name", wagtail.blocks.CharBlock(label="Nom de l'auteur")), + ("author_title", wagtail.blocks.CharBlock(label="Titre de l'auteur")), + ], + label="Citation", + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre", required=False)), + ("caption", wagtail.blocks.CharBlock(label="Légende")), + ( + "url", + wagtail.blocks.URLBlock( + help_text="URL au format 'embed' (Ex. : https://www.youtube.com/embed/gLzXOViPX-0)", + label="Lien de la vidéo", + ), + ), + ], + label="Vidéo", + ), + ), + ( + "multicolumns", + wagtail.blocks.StructBlock( + [ + ( + "bg_image", + wagtail.images.blocks.ImageChooserBlock( + label="Image d'arrière plan", required=False + ), + ), + ( + "bg_color", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" + }, + label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", + regex="^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(label="Titre", required=False)), + ( + "columns", + wagtail.blocks.StreamBlock( + [ + ("text", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme")), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(label="Titre", required=False), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration" + ), + ), + ( + "alt", + wagtail.blocks.CharBlock( + label="Texte alternatif (description textuelle de l'image)", + required=False, + ), + ), + ( + "caption", + wagtail.blocks.CharBlock(label="Légende", required=False), + ), + ("url", wagtail.blocks.URLBlock(label="Lien", required=False)), + ], + label="Image", + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(label="Titre", required=False), + ), + ("caption", wagtail.blocks.CharBlock(label="Légende")), + ( + "url", + wagtail.blocks.URLBlock( + help_text="URL au format 'embed' (Ex. : https://www.youtube.com/embed/gLzXOViPX-0)", + label="Lien de la vidéo", + ), + ), + ], + label="Vidéo", + ), + ), + ( + "card", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("description", wagtail.blocks.TextBlock(label="Texte")), + ( + "image", + wagtail.images.blocks.ImageChooserBlock(label="Image"), + ), + ("url", wagtail.blocks.URLBlock(label="Lien", required=False)), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + help_text="Sélectionnez un document pour rendre la carte cliquable vers celui ci (si le champ `Lien` n'est pas renseigné).", + label="ou Document", + required=False, + ), + ), + ], + label="Carte", + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration (à gauche)", required=False + ), + ), + ("quote", wagtail.blocks.CharBlock(label="Citation")), + ( + "author_name", + wagtail.blocks.CharBlock(label="Nom de l'auteur"), + ), + ( + "author_title", + wagtail.blocks.CharBlock(label="Titre de l'auteur"), + ), + ], + label="Citation", + ), + ), + ( + "text_cta", + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.RichTextBlock( + label="Texte avec mise en forme", required=False + ), + ), + ( + "cta_label", + wagtail.blocks.CharBlock( + help_text="Le lien apparait comme un bouton sous le bloc de texte", + label="Titre de l'appel à l'action", + required=False, + ), + ), + ( + "cta_url", + wagtail.blocks.CharBlock(label="Lien", required=False), + ), + ], + label="Texte et appel à l'action", + ), + ), + ( + "iframe", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Accessibilité : Le titre doit décrire, de façon claire et concise, le contenu embarqué.", + label="Titre", + ), + ), + ( + "url", + wagtail.blocks.URLBlock( + help_text="Exemple pour Tally : https://tally.so/embed/w2jMRa", + label="Lien du cadre intégré", + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock(label="Hauteur en pixels"), + ), + ], + label="Cadre intégré", + ), + ), + ], + label="Multi-colonnes", + ), + ), + ], + label="Multi-colonnes", + ), + ), + ( + "accordions", + wagtail.blocks.StreamBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ( + "accordion", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("content", wagtail.blocks.RichTextBlock(label="Contenu")), + ], + label="Accordéon", + max_num=15, + min_num=1, + ), + ), + ], + label="Accordéons", + ), + ), + ( + "stepper", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("total", wagtail.blocks.IntegerBlock(label="Nombre d'étape")), + ("current", wagtail.blocks.IntegerBlock(label="Étape en cours")), + ( + "steps", + wagtail.blocks.StreamBlock( + [ + ( + "step", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre de l'étape")), + ("detail", wagtail.blocks.TextBlock(label="Détail")), + ], + label="Étape", + ), + ) + ], + label="Les étapes", + ), + ), + ], + label="Étapes", + ), + ), + ( + "separator", + wagtail.blocks.StructBlock( + [ + ( + "top_margin", + wagtail.blocks.IntegerBlock( + default=3, label="Espacement au dessus", max_value=15, min_value=0 + ), + ), + ( + "bottom_margin", + wagtail.blocks.IntegerBlock( + default=3, label="Espacement en dessous", max_value=15, min_value=0 + ), + ), + ], + label="Séparateur", + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + ] diff --git a/content_manager/migrations/0010_rename_footer_theme_modale_cmsdsfrconfig_theme_modale_button.py b/content_manager/migrations/0010_rename_footer_theme_modale_cmsdsfrconfig_theme_modale_button.py new file mode 100644 index 00000000..c0d2b031 --- /dev/null +++ b/content_manager/migrations/0010_rename_footer_theme_modale_cmsdsfrconfig_theme_modale_button.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.7 on 2023-11-27 16:23 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("content_manager", "0009_cmsdsfrconfig_footer_theme_modale_and_more"), + ] + + operations = [ + migrations.RenameField( + model_name="cmsdsfrconfig", + old_name="footer_theme_modale", + new_name="theme_modale_button", + ), + ] diff --git a/content_manager/models.py b/content_manager/models.py index 2dd29720..d9635725 100644 --- a/content_manager/models.py +++ b/content_manager/models.py @@ -108,7 +108,7 @@ class Meta: ] -@register_setting(icon="code") +@register_setting(icon="cog") class CmsDsfrConfig(BaseSiteSetting): class Meta: verbose_name = "Configuration du site" @@ -161,6 +161,8 @@ class Meta: blank=True, help_text="Balises HTML autorisés", ) + + theme_modale_button = models.BooleanField("Choix du thème clair/sombre", default=False) mourning = models.BooleanField("Mise en berne", default=False) panels = [ @@ -172,4 +174,5 @@ class Meta: FieldPanel("site_tagline"), FieldPanel("footer_description"), FieldPanel("mourning"), + FieldPanel("theme_modale_button"), ] diff --git a/poetry.lock b/poetry.lock index 47b4d891..2949ca25 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1596,6 +1596,24 @@ Willow = {version = ">=1.6.2,<1.7", extras = ["heif"]} docs = ["Sphinx (>=1.5.2)", "myst-parser (==0.18.1)", "pyenchant (>=3.1.1,<4)", "sphinx-autobuild (>=0.6.0)", "sphinx-copybutton (>=0.5,<1.0)", "sphinx-wagtail-theme (==6.1.1)", "sphinxcontrib-spelling (>=5.4.0,<6)"] testing = ["Jinja2 (>=3.0,<3.2)", "azure-mgmt-cdn (>=12.0,<13.0)", "azure-mgmt-frontdoor (>=1.0,<1.1)", "black (==22.3.0)", "boto3 (>=1.28,<2)", "coverage (>=3.7.0)", "curlylint (==0.13.1)", "django-pattern-library (>=0.7,<0.8)", "djhtml (==1.5.2)", "doc8 (==0.8.1)", "factory-boy (>=3.2)", "freezegun (>=0.3.8)", "polib (>=1.1,<2.0)", "python-dateutil (>=2.7)", "pytz (>=2014.7)", "ruff (==0.0.290)", "semgrep (==1.40.0)", "tblib (>=2.0,<3.0)"] +[[package]] +name = "wagtail-modeladmin" +version = "1.0.0" +description = "Add any model in your project to the Wagtail admin. Formerly wagtail.contrib.modeladmin." +optional = false +python-versions = ">=3.8" +files = [ + {file = "wagtail_modeladmin-1.0.0-py3-none-any.whl", hash = "sha256:0d92dd012e17dd5b5d5058792c8549594884c87da7ef794e8f1765bb245a5340"}, + {file = "wagtail_modeladmin-1.0.0.tar.gz", hash = "sha256:da545ba34747bff01c942b8306e20ac17d8a64d1873734cc8cf7303716af93fc"}, +] + +[package.dependencies] +Wagtail = ">=5.0" + +[package.extras] +docs = ["Sphinx (>=6.0)", "myst_parser (>=0.18.1,<1.0)", "pyenchant (>=3.1.1,<4)", "sphinx-autobuild (>=0.6.0)", "sphinx-wagtail-theme (==6.0.0)", "sphinx_copybutton (>=0.5)", "sphinxcontrib-spelling (>=8.0,<9.0)"] +testing = ["dj-database-url (>=2.0.0)", "pre-commit (<3.0)"] + [[package]] name = "wagtailmenus" version = "3.1.9" @@ -1650,4 +1668,4 @@ testing = ["Pillow (>=9.1.0,<11.0.0)", "Wand (>=0.6,<1.0)", "black (==22.3.0)", [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "a60540e2441b750108f79bdb7b82ecbaa11da02f7bbb2f33f2885b6a34582439" +content-hash = "3d6e6cb1261e6245e15f6ebef5611688839ca1fe77033b06c951c7c75a95e8db" diff --git a/pyproject.toml b/pyproject.toml index d93321fe..a4413d7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ dj-static = "^0.0.6" wagtailmenus = "^3.1.9" boto3 = "^1.29.1" django-storages = "^1.14.2" +wagtail-modeladmin = "^1.0.0" [tool.poetry.group.dev.dependencies] diff --git a/templates/blocks/footer.html b/templates/blocks/footer.html index 0f1d06fc..019eff68 100644 --- a/templates/blocks/footer.html +++ b/templates/blocks/footer.html @@ -13,4 +13,11 @@ {% block footer_links %} {% flat_menu handle="footer" template="menus/custom_flat_menu_footer.html" %} + {% if settings.content_manager.CmsDsfrConfig.theme_modale_button %} + + {% endif %} {% endblock footer_links %} From 637e2232efee67386f212de0a60b19186dda19a0 Mon Sep 17 00:00:00 2001 From: Sylvain Boissel Date: Tue, 28 Nov 2023 12:00:56 +0100 Subject: [PATCH 8/9] Add help text --- content_manager/blocks.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/content_manager/blocks.py b/content_manager/blocks.py index ea2a4eb9..1f489c26 100644 --- a/content_manager/blocks.py +++ b/content_manager/blocks.py @@ -66,7 +66,12 @@ class BadgesListBlock(blocks.StreamBlock): class CalloutBlock(blocks.StructBlock): title = blocks.CharBlock(label="Titre de la mise en vant", required=False) text = blocks.TextBlock(label="Texte mis en avant", required=False) - heading_tag = blocks.ChoiceBlock(label="Niveau de titre", choices=heading_choices, default="h3") + heading_tag = blocks.ChoiceBlock( + label="Niveau de titre", + choices=heading_choices, + default="h3", + help_text="À adapter à la structure de la page. Par défaut en-tête 3.", + ) class CardBlock(blocks.StructBlock): From bec899360684f4671db23b5044d479b4ef40b0ab Mon Sep 17 00:00:00 2001 From: Sylvain Boissel Date: Tue, 28 Nov 2023 17:56:18 +0100 Subject: [PATCH 9/9] Merged migrations --- config/settings.py | 2 +- .../migrations/0008_alter_contentpage_body.py | 438 ------------------ ...sfrconfig_theme_modale_button_and_more.py} | 6 +- ...odale_cmsdsfrconfig_theme_modale_button.py | 17 - 4 files changed, 4 insertions(+), 459 deletions(-) delete mode 100644 content_manager/migrations/0008_alter_contentpage_body.py rename content_manager/migrations/{0009_cmsdsfrconfig_footer_theme_modale_and_more.py => 0008_cmsdsfrconfig_theme_modale_button_and_more.py} (99%) delete mode 100644 content_manager/migrations/0010_rename_footer_theme_modale_cmsdsfrconfig_theme_modale_button.py diff --git a/config/settings.py b/config/settings.py index 19e5f794..7e9d8e16 100644 --- a/config/settings.py +++ b/config/settings.py @@ -52,8 +52,8 @@ "wagtail.admin", "wagtail.search", "wagtail", - "wagtailmenus", "wagtail_modeladmin", + "wagtailmenus", "taggit", "django.contrib.auth", "django.contrib.contenttypes", diff --git a/content_manager/migrations/0008_alter_contentpage_body.py b/content_manager/migrations/0008_alter_contentpage_body.py deleted file mode 100644 index 37b8e4cb..00000000 --- a/content_manager/migrations/0008_alter_contentpage_body.py +++ /dev/null @@ -1,438 +0,0 @@ -# Generated by Django 4.2.7 on 2023-11-27 14:45 - -import wagtail.blocks -import wagtail.documents.blocks -import wagtail.fields -import wagtail.images.blocks -from django.db import migrations - - -class Migration(migrations.Migration): - dependencies = [ - ("content_manager", "0007_cmsdsfrconfig"), - ] - - operations = [ - migrations.AlterField( - model_name="contentpage", - name="body", - field=wagtail.fields.StreamField( - [ - ( - "hero", - wagtail.blocks.StructBlock( - [ - ("bg_image", wagtail.images.blocks.ImageChooserBlock(label="Image d'arrière plan")), - ( - "bg_color", - wagtail.blocks.RegexBlock( - error_messages={ - "invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" - }, - label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", - regex="^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", - required=False, - ), - ), - ("title", wagtail.blocks.CharBlock(label="Titre")), - ("text", wagtail.blocks.CharBlock(label="Texte", required=False)), - ("cta_label", wagtail.blocks.CharBlock(label="Texte du bouton", required=False)), - ("cta_link", wagtail.blocks.URLBlock(label="Lien du bouton", required=False)), - ], - label="Section promotionnelle", - ), - ), - ( - "title", - wagtail.blocks.StructBlock( - [ - ("title", wagtail.blocks.CharBlock(label="Titre")), - ("large", wagtail.blocks.BooleanBlock(label="Large", required=False)), - ], - label="Titre de page", - ), - ), - ("paragraph", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme")), - ("paragraphlarge", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (large)")), - ( - "image", - wagtail.blocks.StructBlock( - [ - ("title", wagtail.blocks.CharBlock(label="Titre", required=False)), - ("image", wagtail.images.blocks.ImageChooserBlock(label="Illustration")), - ( - "alt", - wagtail.blocks.CharBlock( - label="Texte alternatif (description textuelle de l'image)", required=False - ), - ), - ("caption", wagtail.blocks.CharBlock(label="Légende", required=False)), - ("url", wagtail.blocks.URLBlock(label="Lien", required=False)), - ] - ), - ), - ( - "imageandtext", - wagtail.blocks.StructBlock( - [ - ("image", wagtail.images.blocks.ImageChooserBlock(label="Illustration (à gauche)")), - ( - "image_ratio", - wagtail.blocks.ChoiceBlock( - choices=[("3", "3/12"), ("5", "5/12"), ("6", "6/12")], - label="Largeur de l'image", - ), - ), - ("text", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (à droite)")), - ( - "link_label", - wagtail.blocks.CharBlock( - help_text="Le lien apparait en bas du bloc de droite, avec une flèche", - label="Titre du lien", - required=False, - ), - ), - ("link_url", wagtail.blocks.URLBlock(label="Lien", required=False)), - ], - label="Bloc image à gauche et texte à droite", - ), - ), - ( - "alert", - wagtail.blocks.StructBlock( - [ - ("title", wagtail.blocks.CharBlock(label="Titre du message", required=False)), - ("description", wagtail.blocks.TextBlock(label="Texte du message", required=False)), - ( - "level", - wagtail.blocks.ChoiceBlock( - choices=[ - ("error", "Erreur"), - ("success", "Succès"), - ("info", "Information"), - ("warning", "Attention"), - ], - label="Type de message", - ), - ), - ], - label="Message d'alerte", - ), - ), - ( - "callout", - wagtail.blocks.StructBlock( - [ - ("title", wagtail.blocks.CharBlock(label="Titre de la mise en vant", required=False)), - ("text", wagtail.blocks.TextBlock(label="Texte mis en avant", required=False)), - ( - "heading_tag", - wagtail.blocks.ChoiceBlock( - choices=[ - ("h2", "En-tête 2"), - ("h3", "En-tête 3"), - ("h4", "En-tête 4"), - ("h5", "En-tête 5"), - ("h6", "En-tête 6"), - ("p", "Paragraphe"), - ], - label="Niveau de titre", - ), - ), - ], - label="Texte mise en avant", - ), - ), - ( - "quote", - wagtail.blocks.StructBlock( - [ - ( - "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration (à gauche)", required=False - ), - ), - ("quote", wagtail.blocks.CharBlock(label="Citation")), - ("author_name", wagtail.blocks.CharBlock(label="Nom de l'auteur")), - ("author_title", wagtail.blocks.CharBlock(label="Titre de l'auteur")), - ], - label="Citation", - ), - ), - ( - "video", - wagtail.blocks.StructBlock( - [ - ("title", wagtail.blocks.CharBlock(label="Titre", required=False)), - ("caption", wagtail.blocks.CharBlock(label="Légende")), - ( - "url", - wagtail.blocks.URLBlock( - help_text="URL au format 'embed' (Ex. : https://www.youtube.com/embed/gLzXOViPX-0)", - label="Lien de la vidéo", - ), - ), - ], - label="Vidéo", - ), - ), - ( - "multicolumns", - wagtail.blocks.StructBlock( - [ - ( - "bg_image", - wagtail.images.blocks.ImageChooserBlock( - label="Image d'arrière plan", required=False - ), - ), - ( - "bg_color", - wagtail.blocks.RegexBlock( - error_messages={ - "invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" - }, - label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", - regex="^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", - required=False, - ), - ), - ("title", wagtail.blocks.CharBlock(label="Titre", required=False)), - ( - "columns", - wagtail.blocks.StreamBlock( - [ - ("text", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme")), - ( - "image", - wagtail.blocks.StructBlock( - [ - ( - "title", - wagtail.blocks.CharBlock(label="Titre", required=False), - ), - ( - "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration" - ), - ), - ( - "alt", - wagtail.blocks.CharBlock( - label="Texte alternatif (description textuelle de l'image)", - required=False, - ), - ), - ( - "caption", - wagtail.blocks.CharBlock(label="Légende", required=False), - ), - ("url", wagtail.blocks.URLBlock(label="Lien", required=False)), - ], - label="Image", - ), - ), - ( - "video", - wagtail.blocks.StructBlock( - [ - ( - "title", - wagtail.blocks.CharBlock(label="Titre", required=False), - ), - ("caption", wagtail.blocks.CharBlock(label="Légende")), - ( - "url", - wagtail.blocks.URLBlock( - help_text="URL au format 'embed' (Ex. : https://www.youtube.com/embed/gLzXOViPX-0)", - label="Lien de la vidéo", - ), - ), - ], - label="Vidéo", - ), - ), - ( - "card", - wagtail.blocks.StructBlock( - [ - ("title", wagtail.blocks.CharBlock(label="Titre")), - ("description", wagtail.blocks.TextBlock(label="Texte")), - ( - "image", - wagtail.images.blocks.ImageChooserBlock(label="Image"), - ), - ("url", wagtail.blocks.URLBlock(label="Lien", required=False)), - ( - "document", - wagtail.documents.blocks.DocumentChooserBlock( - help_text="Sélectionnez un document pour rendre la carte cliquable vers celui ci (si le champ `Lien` n'est pas renseigné).", - label="ou Document", - required=False, - ), - ), - ], - label="Carte", - ), - ), - ( - "quote", - wagtail.blocks.StructBlock( - [ - ( - "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration (à gauche)", required=False - ), - ), - ("quote", wagtail.blocks.CharBlock(label="Citation")), - ( - "author_name", - wagtail.blocks.CharBlock(label="Nom de l'auteur"), - ), - ( - "author_title", - wagtail.blocks.CharBlock(label="Titre de l'auteur"), - ), - ], - label="Citation", - ), - ), - ( - "text_cta", - wagtail.blocks.StructBlock( - [ - ( - "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme", required=False - ), - ), - ( - "cta_label", - wagtail.blocks.CharBlock( - help_text="Le lien apparait comme un bouton sous le bloc de texte", - label="Titre de l'appel à l'action", - required=False, - ), - ), - ( - "cta_url", - wagtail.blocks.CharBlock(label="Lien", required=False), - ), - ], - label="Texte et appel à l'action", - ), - ), - ( - "iframe", - wagtail.blocks.StructBlock( - [ - ( - "title", - wagtail.blocks.CharBlock( - help_text="Accessibilité : Le titre doit décrire, de façon claire et concise, le contenu embarqué.", - label="Titre", - ), - ), - ( - "url", - wagtail.blocks.URLBlock( - help_text="Exemple pour Tally : https://tally.so/embed/w2jMRa", - label="Lien du cadre intégré", - ), - ), - ( - "height", - wagtail.blocks.IntegerBlock(label="Hauteur en pixels"), - ), - ], - label="Cadre intégré", - ), - ), - ], - label="Multi-colonnes", - ), - ), - ], - label="Multi-colonnes", - ), - ), - ( - "accordions", - wagtail.blocks.StreamBlock( - [ - ("title", wagtail.blocks.CharBlock(label="Titre")), - ( - "accordion", - wagtail.blocks.StructBlock( - [ - ("title", wagtail.blocks.CharBlock(label="Titre")), - ("content", wagtail.blocks.RichTextBlock(label="Contenu")), - ], - label="Accordéon", - max_num=15, - min_num=1, - ), - ), - ], - label="Accordéons", - ), - ), - ( - "stepper", - wagtail.blocks.StructBlock( - [ - ("title", wagtail.blocks.CharBlock(label="Titre")), - ("total", wagtail.blocks.IntegerBlock(label="Nombre d'étape")), - ("current", wagtail.blocks.IntegerBlock(label="Étape en cours")), - ( - "steps", - wagtail.blocks.StreamBlock( - [ - ( - "step", - wagtail.blocks.StructBlock( - [ - ("title", wagtail.blocks.CharBlock(label="Titre de l'étape")), - ("detail", wagtail.blocks.TextBlock(label="Détail")), - ], - label="Étape", - ), - ) - ], - label="Les étapes", - ), - ), - ], - label="Étapes", - ), - ), - ( - "separator", - wagtail.blocks.StructBlock( - [ - ( - "top_margin", - wagtail.blocks.IntegerBlock( - default=3, label="Espacement au dessus", max_value=15, min_value=0 - ), - ), - ( - "bottom_margin", - wagtail.blocks.IntegerBlock( - default=3, label="Espacement en dessous", max_value=15, min_value=0 - ), - ), - ], - label="Séparateur", - ), - ), - ], - blank=True, - use_json_field=True, - ), - ), - ] diff --git a/content_manager/migrations/0009_cmsdsfrconfig_footer_theme_modale_and_more.py b/content_manager/migrations/0008_cmsdsfrconfig_theme_modale_button_and_more.py similarity index 99% rename from content_manager/migrations/0009_cmsdsfrconfig_footer_theme_modale_and_more.py rename to content_manager/migrations/0008_cmsdsfrconfig_theme_modale_button_and_more.py index 40500453..cce70f97 100644 --- a/content_manager/migrations/0009_cmsdsfrconfig_footer_theme_modale_and_more.py +++ b/content_manager/migrations/0008_cmsdsfrconfig_theme_modale_button_and_more.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.7 on 2023-11-27 16:21 +# Generated by Django 4.2.7 on 2023-11-28 16:55 import wagtail.blocks import wagtail.documents.blocks @@ -9,13 +9,13 @@ class Migration(migrations.Migration): dependencies = [ - ("content_manager", "0008_alter_contentpage_body"), + ("content_manager", "0007_cmsdsfrconfig"), ] operations = [ migrations.AddField( model_name="cmsdsfrconfig", - name="footer_theme_modale", + name="theme_modale_button", field=models.BooleanField(default=False, verbose_name="Choix du thème clair/sombre"), ), migrations.AlterField( diff --git a/content_manager/migrations/0010_rename_footer_theme_modale_cmsdsfrconfig_theme_modale_button.py b/content_manager/migrations/0010_rename_footer_theme_modale_cmsdsfrconfig_theme_modale_button.py deleted file mode 100644 index c0d2b031..00000000 --- a/content_manager/migrations/0010_rename_footer_theme_modale_cmsdsfrconfig_theme_modale_button.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 4.2.7 on 2023-11-27 16:23 - -from django.db import migrations - - -class Migration(migrations.Migration): - dependencies = [ - ("content_manager", "0009_cmsdsfrconfig_footer_theme_modale_and_more"), - ] - - operations = [ - migrations.RenameField( - model_name="cmsdsfrconfig", - old_name="footer_theme_modale", - new_name="theme_modale_button", - ), - ]