diff --git a/lemarche/cms/blocks.py b/lemarche/cms/blocks.py index 4f4ed5382..44fcbf31c 100644 --- a/lemarche/cms/blocks.py +++ b/lemarche/cms/blocks.py @@ -41,9 +41,31 @@ class Meta: label = "Ils ont publié un besoin sur le marché" +class TendersStudiesCase(blocks.StructBlock): + image = ImageChooserBlock(required=True) + title = blocks.CharBlock(label="Titre du cas", required=True, max_length=120) + link = blocks.CharBlock(label="Lien", required=True, max_length=200) + number = blocks.CharBlock(label="Le nombre", required=True, max_length=20) + number_of = blocks.CharBlock(label="Nombre de", required=True, max_length=120) + + class Meta: + template = "cms/streams/section_studies_cases_tenders_case.html" + + class TendersStudiesCasesSection(blocks.StructBlock): title = blocks.CharBlock(default="100% des besoins ont reçu des réponses en 24h", required=True, max_length=120) subtitle = blocks.CharBlock(default="Gagnez du temps en utilisant le marché.", required=True, max_length=120) + cta = CallToAction(label="Call to action") + cases = blocks.StreamBlock( + [ + ( + "case", + TendersStudiesCase(), + ) + ], + min_num=3, + max_num=3, + ) class Meta: template = "cms/streams/section_studies_cases_tenders.html" diff --git a/lemarche/cms/migrations/0012_alter_homepage_content.py b/lemarche/cms/migrations/0012_alter_homepage_content.py new file mode 100644 index 000000000..54de2d095 --- /dev/null +++ b/lemarche/cms/migrations/0012_alter_homepage_content.py @@ -0,0 +1,298 @@ +# Generated by Django 4.2.2 on 2024-03-22 08:05 + +import wagtail.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("cms", "0011_alter_homepage_content"), + ] + + operations = [ + migrations.AlterField( + model_name="homepage", + name="content", + field=wagtail.fields.StreamField( + [ + ("website_stats", wagtail.blocks.StructBlock([])), + ( + "section_they_publish_tenders", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + default="Ils ont publié un besoin sur le marché", max_length=120, required=True + ), + ) + ] + ), + ), + ( + "section_studies_cases_tenders", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + default="100% des besoins ont reçu des réponses en 24h", + max_length=120, + required=True, + ), + ), + ( + "subtitle", + wagtail.blocks.CharBlock( + default="Gagnez du temps en utilisant le marché.", + max_length=120, + required=True, + ), + ), + ( + "cta", + wagtail.blocks.StructBlock( + [ + ( + "cta_id", + wagtail.blocks.CharBlock( + help_text="id du call to action (pour le suivi)", label="slug" + ), + ), + ("cta_href", wagtail.blocks.CharBlock(label="Lien du call to action")), + ("cta_text", wagtail.blocks.CharBlock(label="Titre du call to action")), + ( + "cta_icon", + wagtail.blocks.CharBlock( + help_text='Bibliothèque remixicon', # noqa + label="Icone du call to action", + required=False, + ), + ), + ], + label="Call to action", + ), + ), + ( + "cases", + wagtail.blocks.StreamBlock( + [ + ( + "case", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(required=True), + ), + ( + "title", + wagtail.blocks.CharBlock( + label="Titre du cas", max_length=120, required=True + ), + ), + ( + "link", + wagtail.blocks.CharBlock( + label="Lien", max_length=200, required=True + ), + ), + ( + "number", + wagtail.blocks.CharBlock( + label="Le nombre", max_length=20, required=True + ), + ), + ( + "number_of", + wagtail.blocks.CharBlock( + label="Nombre de", max_length=120, required=True + ), + ), + ] + ), + ) + ], + max_num=3, + min_num=3, + ), + ), + ] + ), + ), + ( + "section_our_siaes", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + default="Les prestataires inclusifs, des partenaires d'excellence", + max_length=60, + required=True, + ), + ), + ( + "subtitle", + wagtail.blocks.RichTextBlock( + default="\n Faire appel à nos 8500 prestataires inclusifs, c'est la garantie d'être accompagné\n par des professionnels reconnus et certifiés dans leur domaine.\n ", # noqa + features=["bold", "italic"], + required=True, + ), + ), + ] + ), + ), + ( + "section_our_ressources", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(default="Nos ressources", max_length=120, required=True), + ) + ] + ), + ), + ( + "section_what_find_here", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(default="Sur le marché", max_length=120, required=True), + ), + ( + "cards", + wagtail.blocks.StreamBlock( + [ + ( + "card", + wagtail.blocks.StructBlock( + [ + ( + "ico", + wagtail.blocks.CharBlock( + help_text="Ico du thème (Ex: ico-bicro-marche-recyclage)", # noqa + label="Icone bicro", + max_length=100, + required=True, + ), + ), + ( + "text", + wagtail.blocks.CharBlock(max_length=200, required=True), + ), + ] + ), + ) + ], + max_num=3, + min_num=3, + ), + ), + ] + ), + ), + ( + "section_our_partners", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + default="Les partenaires du marché", max_length=120, required=True + ), + ), + ( + "images_with_link", + wagtail.blocks.StreamBlock( + [ + ( + "images", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(required=True), + ), + ("external_link", wagtail.blocks.URLBlock(required=True)), + ] + ), + ) + ], + max_num=8, + min_num=8, + ), + ), + ] + ), + ), + ( + "section_our_features", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + default="Une solution complète pour vos achats socialement responsables", + max_length=120, + required=True, + ), + ), + ( + "constats", + wagtail.blocks.StreamBlock( + [ + ( + "feature", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(max_length=60, required=True), + ), + ( + "subtitle", + wagtail.blocks.RichTextBlock( + features=["bold", "italic"], required=True + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock(required=True), + ), + ("url", wagtail.blocks.URLBlock(required=True)), + ] + ), + ) + ], + min_num=1, + ), + ), + ] + ), + ), + ( + "section_why_call_siaes", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + default="Pourquoi faire appel à un prestataire inclusif ?", + max_length=120, + required=True, + ), + ) + ] + ), + ), + ], + null=True, + use_json_field=True, + ), + ), + ] diff --git a/lemarche/templates/cms/streams/section_studies_cases_tenders.html b/lemarche/templates/cms/streams/section_studies_cases_tenders.html index beac0d65b..ca77fce02 100644 --- a/lemarche/templates/cms/streams/section_studies_cases_tenders.html +++ b/lemarche/templates/cms/streams/section_studies_cases_tenders.html @@ -1,64 +1,18 @@ -{% load static bootstrap4 wagtailcore_tags %} +{% load bootstrap4 wagtailcore_tags %}
-
- -
-
- - -
-
- -
+ {% for block in self.cases %} + {% include_block block %} + {% endfor %}
diff --git a/lemarche/templates/cms/streams/section_studies_cases_tenders_case.html b/lemarche/templates/cms/streams/section_studies_cases_tenders_case.html new file mode 100644 index 000000000..412935fa7 --- /dev/null +++ b/lemarche/templates/cms/streams/section_studies_cases_tenders_case.html @@ -0,0 +1,18 @@ +{% load wagtailcore_tags wagtailimages_tags %} + +
+ +