Skip to content

Commit

Permalink
dynamic WhatFindHere card
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienReuiller committed Mar 21, 2024
1 parent 995b644 commit 2cd8ed2
Show file tree
Hide file tree
Showing 3 changed files with 262 additions and 32 deletions.
18 changes: 18 additions & 0 deletions lemarche/cms/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,27 @@ class Meta:
label = "Nos ressources"


class WhatFindHereCardBlock(blocks.StructBlock):
ico = blocks.CharBlock(
label="Icone bicro", help_text="Ico du thème (Ex: ico-bicro-marche-recyclage)", required=True, max_length=100
)
text = blocks.CharBlock(required=True, max_length=200)


class WhatFindHereSection(blocks.StructBlock):
title = blocks.CharBlock(default="Sur le marché", required=True, max_length=120)

cards = blocks.StreamBlock(
[
(
"card",
WhatFindHereCardBlock(),
)
],
min_num=3,
max_num=3,
)

class Meta:
template = "cms/streams/section_what_find_here.html"
icon = "pen"
Expand Down
230 changes: 230 additions & 0 deletions lemarche/cms/migrations/0011_alter_homepage_content.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
# Generated by Django 4.2.2 on 2024-03-21 17:08

import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("cms", "0010_remove_homepage_banner_cta_id_and_more"),
]

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,
),
),
]
),
),
(
"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,
),
),
]
46 changes: 14 additions & 32 deletions lemarche/templates/cms/streams/section_what_find_here.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,21 @@ <h2 class="h2 mb-3 mb-lg-5">{{self.title}}</h2>
</div>
</div>
<div class="s-cards-grid-01__row row row-cols-1 row-cols-md-2 row-cols-lg-3 justify-content-center">
<div class="s-cards-grid-01__col col mb-3 mb-md-5">
<div class="card c-card h-100 w-100 c-card--marche">
<div class="card-header text-center">
<img height="80" src="{% static_theme_images 'ico-bicro-marche-local.svg' %}" alt="" />
{% for card in self.cards %}
<div class="s-cards-grid-01__col col mb-3 mb-md-5">
<div class="card c-card h-100 w-100 c-card--marche">
<div class="card-header text-center">
{% with card.value.ico|add:".svg" as ico %}
<img height="80" src="{% static_theme_images ico %}" alt="" />
{% endwith %}
</div>
<div class="card-body">
<p class="h3 lh-base">{{ card.value.text }}</p>
</div>
<div class="card-footer"></div>
</div>
<div class="card-body">
<p class="h3 lh-base">Participez à la dynamique économique et sociale de votre territoire avec des partenaires de proximité.</p>
</div>
<div class="card-footer"></div>
</div>
</div>
<div class="s-cards-grid-01__col col mb-3 mb-md-5">
<div class="card c-card h-100 w-100 c-card--marche">
<div class="card-header text-center">
<img height="80" src="{% static_theme_images 'ico-bicro-marche-recyclage.svg' %}" alt="" />
</div>
<div class="card-body">
<p class="h3 lh-base">Mesurer vos achats inclusifs, renforcez votre politique d’achats responsables et valorisez votre image d’entreprise.</p>
</div>
<div class="card-footer"></div>
</div>
</div>
<div class="s-cards-grid-01__col col mb-3 mb-md-5">
<div class="card c-card h-100 w-100 c-card--marche">
<div class="card-header text-center">
<img height="80" src="{% static_theme_images 'ico-bicro-marche-ouvrier.svg' %}" alt="" />
</div>
<div class="card-body">
<p class="h3 lh-base">Trouvez des prestataires et palliez efficacement vos besoins de main-d'œuvre, métiers en tension, et vos besoins de services.</p>
</div>
<div class="card-footer"></div>
</div>
</div>
{% endfor %}
</div>
</div>
</section>
</section>

0 comments on commit 2cd8ed2

Please sign in to comment.