diff --git a/Makefile b/Makefile index 0fcee0dd..5a3a05ef 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,31 @@ -reset-db: - psql -c 'DROP DATABASE djdb;' - psql -c 'ALTER USER dju CREATEDB;' - psql -c 'CREATE DATABASE djdb OWNER dju;' - python manage.py migrate +ifeq ($(USE_VENV),1) + EXEC_CMD := +else + EXEC_CMD := docker-compose exec -ti web +endif .PHONY: web-prompt web-prompt: - docker-compose run --rm web bash + $(EXEC_CMD) bash .PHONY: test-unit test-unit: - python manage.py test --settings config.settings_test + $(EXEC_CMD) python manage.py test --settings config.settings_test .PHONY: test-e2e test-e2e: - python manage.py behave --settings config.settings_test + $(EXEC_CMD) python manage.py behave --settings config.settings_test .PHONY: test test: test-e2e test-unit .PHONY: quality quality: - black --check --exclude=venv . - isort --check --skip-glob="**/migrations" --extend-skip-glob="venv" . - flake8 --count --show-source --statistics --exclude=venv . + $(EXEC_CMD) black --check --exclude=venv . + $(EXEC_CMD) isort --check --skip-glob="**/migrations" --extend-skip-glob="venv" . + $(EXEC_CMD) flake8 --count --show-source --statistics --exclude=venv . .PHONY: fix fix: - black --exclude=venv . - isort --skip-glob="**/migrations" --extend-skip-glob="venv" . + $(EXEC_CMD) black --exclude=venv . + $(EXEC_CMD) isort --skip-glob="**/migrations" --extend-skip-glob="venv" . diff --git a/README.md b/README.md index b1d61f6f..150ead47 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,24 @@ -# Content Manager +# Gestionnaire de contenu DSFR et Accessible + +**Créez et gérez votre site internet simplement** + +Gestionnaire de contenu (CMS) pour créer un site internet dont le domaine se terminant par .gouv.fr . Pas besoin de compétence technique pour mettre à jours le contenu. + +**Un CMS basé sur la solution open source Wagtail** + +Créez ou modifiez des pages, ajoutez un menu de navigation, des boutons, images, vidéos, contributeurs etc + +**Système de Design de l'État** + +Construisez vos pages à l'aide de composants prêts à l'emploi issus du Système de Design de l'État (DSFR) + +**Accessible et responsive** + +Le contenu des pages générées par le CMS est partiellement conforme selon la norme RGAA 4.1 et responsive + + + + ## Prérequis diff --git a/config/settings.py b/config/settings.py index c6ab47d0..65c2e743 100644 --- a/config/settings.py +++ b/config/settings.py @@ -158,24 +158,20 @@ "django.contrib.staticfiles.finders.FileSystemFinder", ] -# S3 uploads +# S3 uploads & MEDIA CONFIGURATION # ------------------------------------------------------------------------------ -AWS_S3_ACCESS_KEY_ID = os.getenv("S3_KEY_ID", "123") -AWS_S3_SECRET_ACCESS_KEY = os.getenv("S3_KEY_SECRET", "secret") -AWS_S3_ENDPOINT_URL = ( - f"{os.getenv('S3_PROTOCOL', 'https')}://{os.getenv('S3_HOST', 'set-var-env.com/')}" -) -AWS_STORAGE_BUCKET_NAME = os.getenv("S3_BUCKET_NAME", "set-bucket-name") -AWS_S3_STORAGE_BUCKET_REGION = os.getenv("S3_BUCKET_REGION", "fr") - -# MEDIA CONFIGURATION -# ------------------------------------------------------------------------------ - -# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url -MEDIA_URL = f"https://{AWS_S3_ENDPOINT_URL}/" # noqa - -DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" +if os.getenv("S3_HOST"): + AWS_S3_ACCESS_KEY_ID = os.getenv("S3_KEY_ID", "123") + AWS_S3_SECRET_ACCESS_KEY = os.getenv("S3_KEY_SECRET", "secret") + AWS_S3_ENDPOINT_URL = f"{os.getenv('S3_PROTOCOL', 'https')}://{os.getenv('S3_HOST', 'set-var-env.com/')}" + AWS_STORAGE_BUCKET_NAME = os.getenv("S3_BUCKET_NAME", "set-bucket-name") + AWS_S3_STORAGE_BUCKET_REGION = os.getenv("S3_BUCKET_REGION", "fr") + DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" + MEDIA_URL = f"https://{AWS_S3_ENDPOINT_URL}/" # noqa +else: + DEFAULT_FILE_STORAGE = "django.core.files.storage.FileSystemStorage" + MEDIA_URL = "medias/" # Django Sass SASS_PROCESSOR_ROOT = os.path.join(BASE_DIR, "static") @@ -216,3 +212,7 @@ WAGTAILEMBEDS_RESPONSIVE_HTML = True WAGTAIL_MODERATION_ENABLED = False + +CSRF_TRUSTED_ORIGINS = [] +for host in ALLOWED_HOSTS: + CSRF_TRUSTED_ORIGINS.append("https://" + host) diff --git a/content_manager/migrations/0001_initial.py b/content_manager/migrations/0001_initial.py index 1b5ec54c..f157f352 100644 --- a/content_manager/migrations/0001_initial.py +++ b/content_manager/migrations/0001_initial.py @@ -9,7 +9,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [ @@ -45,9 +44,7 @@ class Migration(migrations.Migration): ), ( "large", - wagtail.blocks.BooleanBlock( - label="Large", required=False - ), + wagtail.blocks.BooleanBlock(label="Large", required=False), ), ], label="Titre de page", @@ -55,15 +52,11 @@ class Migration(migrations.Migration): ), ( "paragraph", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme"), ), ( "paragraphlarge", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (large)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (large)"), ), ( "image", @@ -71,15 +64,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration"), ), ( "alt", @@ -90,15 +79,11 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende", required=False - ), + wagtail.blocks.CharBlock(label="Légende", required=False), ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ] ), @@ -109,9 +94,7 @@ class Migration(migrations.Migration): [ ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration (à gauche)" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration (à gauche)"), ), ( "image_ratio", @@ -126,9 +109,7 @@ class Migration(migrations.Migration): ), ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (à droite)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (à droite)"), ), ( "link_label", @@ -140,9 +121,7 @@ class Migration(migrations.Migration): ), ( "link_url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ], label="Bloc image à gauche et texte à droite", @@ -154,15 +133,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre du message", required=False - ), + wagtail.blocks.CharBlock(label="Titre du message", required=False), ), ( "description", - wagtail.blocks.TextBlock( - label="Texte du message", required=False - ), + wagtail.blocks.TextBlock(label="Texte du message", required=False), ), ( "level", @@ -219,15 +194,11 @@ class Migration(migrations.Migration): ), ( "author_name", - wagtail.blocks.CharBlock( - label="Nom de l'auteur" - ), + wagtail.blocks.CharBlock(label="Nom de l'auteur"), ), ( "author_title", - wagtail.blocks.CharBlock( - label="Titre de l'auteur" - ), + wagtail.blocks.CharBlock(label="Titre de l'auteur"), ), ], label="Citation", @@ -239,9 +210,7 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "caption", @@ -267,9 +236,7 @@ class Migration(migrations.Migration): [ ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme"), ), ( "image", @@ -284,9 +251,7 @@ class Migration(migrations.Migration): ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration"), ), ( "alt", @@ -306,9 +271,7 @@ class Migration(migrations.Migration): ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ], label="Image", @@ -327,9 +290,7 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende" - ), + wagtail.blocks.CharBlock(label="Légende"), ), ( "url", @@ -351,27 +312,19 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre" - ), + wagtail.blocks.CharBlock(label="Titre"), ), ( "description", - wagtail.blocks.TextBlock( - label="Texte" - ), + wagtail.blocks.TextBlock(label="Texte"), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Image" - ), + wagtail.images.blocks.ImageChooserBlock(label="Image"), ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ( "document", @@ -402,21 +355,15 @@ class Migration(migrations.Migration): ), ( "quote", - wagtail.blocks.CharBlock( - label="Citation" - ), + wagtail.blocks.CharBlock(label="Citation"), ), ( "author_name", - wagtail.blocks.CharBlock( - label="Nom de l'auteur" - ), + wagtail.blocks.CharBlock(label="Nom de l'auteur"), ), ( "author_title", - wagtail.blocks.CharBlock( - label="Titre de l'auteur" - ), + wagtail.blocks.CharBlock(label="Titre de l'auteur"), ), ], label="Citation", @@ -440,15 +387,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre" - ), + wagtail.blocks.CharBlock(label="Titre"), ), ( "content", - wagtail.blocks.RichTextBlock( - label="Contenu" - ), + wagtail.blocks.RichTextBlock(label="Contenu"), ), ], label="Accordéon", @@ -470,15 +413,11 @@ class Migration(migrations.Migration): ), ( "total", - wagtail.blocks.IntegerBlock( - label="Nombre d'étape" - ), + wagtail.blocks.IntegerBlock(label="Nombre d'étape"), ), ( "current", - wagtail.blocks.IntegerBlock( - label="Étape en cours" - ), + wagtail.blocks.IntegerBlock(label="Étape en cours"), ), ( "steps", @@ -490,15 +429,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre de l'étape" - ), + wagtail.blocks.CharBlock(label="Titre de l'étape"), ), ( "detail", - wagtail.blocks.TextBlock( - label="Détail" - ), + wagtail.blocks.TextBlock(label="Détail"), ), ], label="Étape", diff --git a/content_manager/migrations/0002_alter_contentpage_body.py b/content_manager/migrations/0002_alter_contentpage_body.py index c6287962..30b905d8 100644 --- a/content_manager/migrations/0002_alter_contentpage_body.py +++ b/content_manager/migrations/0002_alter_contentpage_body.py @@ -8,7 +8,6 @@ class Migration(migrations.Migration): - dependencies = [ ("content_manager", "0001_initial"), ] @@ -25,9 +24,7 @@ class Migration(migrations.Migration): [ ( "bg_image", - wagtail.images.blocks.ImageChooserBlock( - label="Image d'arrière plan" - ), + wagtail.images.blocks.ImageChooserBlock(label="Image d'arrière plan"), ), ( "bg_color", @@ -45,15 +42,11 @@ class Migration(migrations.Migration): ("title", wagtail.blocks.CharBlock(label="Titre")), ( "cta_label", - wagtail.blocks.CharBlock( - label="Texte du bouton", required=False - ), + wagtail.blocks.CharBlock(label="Texte du bouton", required=False), ), ( "cta_link", - wagtail.blocks.URLBlock( - label="Lien du bouton", required=False - ), + wagtail.blocks.URLBlock(label="Lien du bouton", required=False), ), ], label="Section promotionnelle", @@ -66,9 +59,7 @@ class Migration(migrations.Migration): ("title", wagtail.blocks.CharBlock(label="Titre")), ( "large", - wagtail.blocks.BooleanBlock( - label="Large", required=False - ), + wagtail.blocks.BooleanBlock(label="Large", required=False), ), ], label="Titre de page", @@ -80,9 +71,7 @@ class Migration(migrations.Migration): ), ( "paragraphlarge", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (large)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (large)"), ), ( "image", @@ -90,15 +79,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration"), ), ( "alt", @@ -109,15 +94,11 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende", required=False - ), + wagtail.blocks.CharBlock(label="Légende", required=False), ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ] ), @@ -128,9 +109,7 @@ class Migration(migrations.Migration): [ ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration (à gauche)" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration (à gauche)"), ), ( "image_ratio", @@ -145,9 +124,7 @@ class Migration(migrations.Migration): ), ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (à droite)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (à droite)"), ), ( "link_label", @@ -159,9 +136,7 @@ class Migration(migrations.Migration): ), ( "link_url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ], label="Bloc image à gauche et texte à droite", @@ -173,15 +148,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre du message", required=False - ), + wagtail.blocks.CharBlock(label="Titre du message", required=False), ), ( "description", - wagtail.blocks.TextBlock( - label="Texte du message", required=False - ), + wagtail.blocks.TextBlock(label="Texte du message", required=False), ), ( "level", @@ -205,15 +176,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre de la mise en vant", required=False - ), + wagtail.blocks.CharBlock(label="Titre de la mise en vant", required=False), ), ( "text", - wagtail.blocks.TextBlock( - label="Texte mis en avant", required=False - ), + wagtail.blocks.TextBlock(label="Texte mis en avant", required=False), ), ], label="Texte mise en avant", @@ -248,9 +215,7 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ("caption", wagtail.blocks.CharBlock(label="Légende")), ( @@ -273,9 +238,7 @@ class Migration(migrations.Migration): [ ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme"), ), ( "image", @@ -283,15 +246,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration"), ), ( "alt", @@ -302,15 +261,11 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende", required=False - ), + wagtail.blocks.CharBlock(label="Légende", required=False), ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ], label="Image", @@ -322,15 +277,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende" - ), + wagtail.blocks.CharBlock(label="Légende"), ), ( "url", @@ -360,15 +311,11 @@ class Migration(migrations.Migration): ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Image" - ), + wagtail.images.blocks.ImageChooserBlock(label="Image"), ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ( "document", @@ -398,21 +345,15 @@ class Migration(migrations.Migration): ), ( "quote", - wagtail.blocks.CharBlock( - label="Citation" - ), + wagtail.blocks.CharBlock(label="Citation"), ), ( "author_name", - wagtail.blocks.CharBlock( - label="Nom de l'auteur" - ), + wagtail.blocks.CharBlock(label="Nom de l'auteur"), ), ( "author_title", - wagtail.blocks.CharBlock( - label="Titre de l'auteur" - ), + wagtail.blocks.CharBlock(label="Titre de l'auteur"), ), ], label="Citation", @@ -437,9 +378,7 @@ class Migration(migrations.Migration): ), ( "content", - wagtail.blocks.RichTextBlock( - label="Contenu" - ), + wagtail.blocks.RichTextBlock(label="Contenu"), ), ], label="Accordéon", @@ -474,15 +413,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre de l'étape" - ), + wagtail.blocks.CharBlock(label="Titre de l'étape"), ), ( "detail", - wagtail.blocks.TextBlock( - label="Détail" - ), + wagtail.blocks.TextBlock(label="Détail"), ), ], label="Étape", diff --git a/content_manager/migrations/0003_alter_contentpage_body.py b/content_manager/migrations/0003_alter_contentpage_body.py index 2b9a1edb..e9e2648b 100644 --- a/content_manager/migrations/0003_alter_contentpage_body.py +++ b/content_manager/migrations/0003_alter_contentpage_body.py @@ -8,7 +8,6 @@ class Migration(migrations.Migration): - dependencies = [ ("content_manager", "0002_alter_contentpage_body"), ] @@ -25,9 +24,7 @@ class Migration(migrations.Migration): [ ( "bg_image", - wagtail.images.blocks.ImageChooserBlock( - label="Image d'arrière plan" - ), + wagtail.images.blocks.ImageChooserBlock(label="Image d'arrière plan"), ), ( "bg_color", @@ -45,21 +42,15 @@ class Migration(migrations.Migration): ("title", wagtail.blocks.CharBlock(label="Titre")), ( "text", - wagtail.blocks.CharBlock( - label="Texte", required=False - ), + wagtail.blocks.CharBlock(label="Texte", required=False), ), ( "cta_label", - wagtail.blocks.CharBlock( - label="Texte du bouton", required=False - ), + wagtail.blocks.CharBlock(label="Texte du bouton", required=False), ), ( "cta_link", - wagtail.blocks.URLBlock( - label="Lien du bouton", required=False - ), + wagtail.blocks.URLBlock(label="Lien du bouton", required=False), ), ], label="Section promotionnelle", @@ -72,9 +63,7 @@ class Migration(migrations.Migration): ("title", wagtail.blocks.CharBlock(label="Titre")), ( "large", - wagtail.blocks.BooleanBlock( - label="Large", required=False - ), + wagtail.blocks.BooleanBlock(label="Large", required=False), ), ], label="Titre de page", @@ -86,9 +75,7 @@ class Migration(migrations.Migration): ), ( "paragraphlarge", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (large)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (large)"), ), ( "image", @@ -96,15 +83,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration"), ), ( "alt", @@ -115,15 +98,11 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende", required=False - ), + wagtail.blocks.CharBlock(label="Légende", required=False), ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ] ), @@ -134,9 +113,7 @@ class Migration(migrations.Migration): [ ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration (à gauche)" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration (à gauche)"), ), ( "image_ratio", @@ -151,9 +128,7 @@ class Migration(migrations.Migration): ), ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (à droite)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (à droite)"), ), ( "link_label", @@ -165,9 +140,7 @@ class Migration(migrations.Migration): ), ( "link_url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ], label="Bloc image à gauche et texte à droite", @@ -179,15 +152,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre du message", required=False - ), + wagtail.blocks.CharBlock(label="Titre du message", required=False), ), ( "description", - wagtail.blocks.TextBlock( - label="Texte du message", required=False - ), + wagtail.blocks.TextBlock(label="Texte du message", required=False), ), ( "level", @@ -211,15 +180,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre de la mise en vant", required=False - ), + wagtail.blocks.CharBlock(label="Titre de la mise en vant", required=False), ), ( "text", - wagtail.blocks.TextBlock( - label="Texte mis en avant", required=False - ), + wagtail.blocks.TextBlock(label="Texte mis en avant", required=False), ), ], label="Texte mise en avant", @@ -254,9 +219,7 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ("caption", wagtail.blocks.CharBlock(label="Légende")), ( @@ -297,9 +260,7 @@ class Migration(migrations.Migration): ), ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "columns", @@ -307,9 +268,7 @@ class Migration(migrations.Migration): [ ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme"), ), ( "image", @@ -369,9 +328,7 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende" - ), + wagtail.blocks.CharBlock(label="Légende"), ), ( "url", @@ -393,21 +350,15 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre" - ), + wagtail.blocks.CharBlock(label="Titre"), ), ( "description", - wagtail.blocks.TextBlock( - label="Texte" - ), + wagtail.blocks.TextBlock(label="Texte"), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Image" - ), + wagtail.images.blocks.ImageChooserBlock(label="Image"), ), ( "url", @@ -445,21 +396,15 @@ class Migration(migrations.Migration): ), ( "quote", - wagtail.blocks.CharBlock( - label="Citation" - ), + wagtail.blocks.CharBlock(label="Citation"), ), ( "author_name", - wagtail.blocks.CharBlock( - label="Nom de l'auteur" - ), + wagtail.blocks.CharBlock(label="Nom de l'auteur"), ), ( "author_title", - wagtail.blocks.CharBlock( - label="Titre de l'auteur" - ), + wagtail.blocks.CharBlock(label="Titre de l'auteur"), ), ], label="Citation", @@ -488,9 +433,7 @@ class Migration(migrations.Migration): ), ( "content", - wagtail.blocks.RichTextBlock( - label="Contenu" - ), + wagtail.blocks.RichTextBlock(label="Contenu"), ), ], label="Accordéon", @@ -525,15 +468,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre de l'étape" - ), + wagtail.blocks.CharBlock(label="Titre de l'étape"), ), ( "detail", - wagtail.blocks.TextBlock( - label="Détail" - ), + wagtail.blocks.TextBlock(label="Détail"), ), ], label="Étape", diff --git a/content_manager/migrations/0004_alter_contentpage_body.py b/content_manager/migrations/0004_alter_contentpage_body.py new file mode 100644 index 00000000..5eb6bc5b --- /dev/null +++ b/content_manager/migrations/0004_alter_contentpage_body.py @@ -0,0 +1,554 @@ +# Generated by Django 4.1.5 on 2023-04-06 09:33 + +from django.db import migrations +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + dependencies = [ + ("content_manager", "0003_alter_contentpage_body"), + ] + + 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), + ), + ], + 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", + ), + ), + ], + 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/0005_alter_contentpage_body.py b/content_manager/migrations/0005_alter_contentpage_body.py new file mode 100644 index 00000000..89711e1e --- /dev/null +++ b/content_manager/migrations/0005_alter_contentpage_body.py @@ -0,0 +1,449 @@ +# Generated by Django 4.1.5 on 2023-04-20 09:23 + +from django.db import migrations +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + dependencies = [ + ("content_manager", "0004_alter_contentpage_body"), + ] + + 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)), + ], + 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/models.py b/content_manager/models.py index a9348dde..6102b255 100644 --- a/content_manager/models.py +++ b/content_manager/models.py @@ -13,9 +13,7 @@ class HeroBlock(blocks.StructBlock): 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" - }, + error_messages={"invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe"}, required=False, ) title = blocks.CharBlock(label="Titre") @@ -32,9 +30,7 @@ class TitleBlock(blocks.StructBlock): 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 - ) + 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) @@ -129,9 +125,7 @@ class CardBlock(blocks.StructBlock): 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 - ) + 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) @@ -139,12 +133,36 @@ 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): @@ -152,9 +170,7 @@ class MultiColumnsWithTitleBlock(blocks.StructBlock): 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" - }, + 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) @@ -188,12 +204,8 @@ class StepperBlock(blocks.StructBlock): 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 - ) + 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 ContentPage(Page): diff --git a/content_manager/templates/content_manager/blocks/multicolumns.html b/content_manager/templates/content_manager/blocks/multicolumns.html index 4d7d8e4c..e154cadb 100644 --- a/content_manager/templates/content_manager/blocks/multicolumns.html +++ b/content_manager/templates/content_manager/blocks/multicolumns.html @@ -14,6 +14,16 @@

{{ block.value.title }}

{% for subblock in block.value.columns %} {% if subblock.block_type == 'text' %}
{{ subblock.value|richtext }}
+ {% elif subblock.block_type == 'text_cta' %} +
+ {{ subblock.value.text|richtext }} + {% if subblock.value.cta_url and subblock.value.cta_label %} +

+ {# It doesn't use dsfr_link or dsfr_button because it's a link with a button style #} + {{ subblock.value.cta_label }} +

+ {% endif %} +
{% elif subblock.block_type == 'image' %}
{% include "content_manager/blocks/image.html" with block=subblock %}
{% elif subblock.block_type == 'video' %} @@ -30,7 +40,7 @@

{{ subblock.value.title }}

{% elif subblock.block_type == 'card' %}
- {% image subblock.value.bg_image original as img %} + {% image subblock.value.image original as img %} {% if subblock.value.document %} {% dsfr_card title=subblock.value.title description=subblock.value.description link=subblock.value.document.url image_url=img.url %} {% else %} @@ -42,6 +52,10 @@

{{ subblock.value.title }}

{% image subblock.value.image original as img %} {% dsfr_quote text=subblock.value.quote author=subblock.value.author_name source=subblock.value.author_title image_url=img.url %}
+ {% elif subblock.block_type == 'iframe' %} +
+ +
{% endif %} {% endfor %} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..0bcf8273 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.black] +line_length = 119 diff --git a/requirements.txt b/requirements.txt index 2754f2ef..00efdea7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,19 @@ dj-static==0.0.6 -Django==4.1.5 -django-dsfr==0.12.0 -black==22.12.0 +Django==4.1.9 +django-dsfr==0.14.0 +black==23.3.0 flake8==6.0.0 -isort==5.11.4 -pre-commit==2.20.0 -dj-database-url==1.2.0 -psycopg2-binary==2.9.5 -python-dotenv==0.21.0 -whitenoise==6.2.0 -djlint==1.19.9 +isort==5.12.0 +pre-commit==3.3.1 +dj-database-url==2.0.0 +psycopg2-binary==2.9.6 +python-dotenv==1.0.0 +whitenoise==6.4.0 +djlint==1.27.2 gunicorn==20.1.0 -django-sass-processor==1.2.1 -libsass==0.21.0 +django-sass-processor==1.2.2 +libsass==0.22.0 wagtail==4.1.4 wagtailmenus==3.1.3 -boto3==1.26.59 +boto3==1.26.133 django-storages==1.13.2