Skip to content

Commit

Permalink
dynamic studies cases
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienReuiller committed Mar 22, 2024
1 parent 2cd8ed2 commit b61d9c2
Show file tree
Hide file tree
Showing 4 changed files with 346 additions and 54 deletions.
22 changes: 22 additions & 0 deletions lemarche/cms/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
298 changes: 298 additions & 0 deletions lemarche/cms/migrations/0012_alter_homepage_content.py
Original file line number Diff line number Diff line change
@@ -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 <a href="https://remixicon.com/" target="_blanck">remixicon</a>', # 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,
),
),
]
Loading

0 comments on commit b61d9c2

Please sign in to comment.