From e8195b51a582cd549e412f93f47a3aa6014a6e1e Mon Sep 17 00:00:00 2001 From: "madjid.asa" Date: Tue, 12 Sep 2023 11:25:54 +0200 Subject: [PATCH] add images with links --- lemarche/cms/blocks.py | 15 +- .../migrations/0008_alter_homepage_content.py | 201 ++++++++++++++++++ .../static/itou_marche/sections/_home.scss | 14 ++ .../cms/streams/image_with_link.html | 6 + .../cms/streams/section_our_partners.html | 74 +------ 5 files changed, 242 insertions(+), 68 deletions(-) create mode 100644 lemarche/cms/migrations/0008_alter_homepage_content.py create mode 100644 lemarche/templates/cms/streams/image_with_link.html diff --git a/lemarche/cms/blocks.py b/lemarche/cms/blocks.py index 4691819be..8f240e53c 100644 --- a/lemarche/cms/blocks.py +++ b/lemarche/cms/blocks.py @@ -17,7 +17,6 @@ class Meta: class TendersTestimonialsSection(blocks.StructBlock): - title = blocks.CharBlock(default="Ils ont publié un besoin sur le marché", required=True, max_length=120) class Meta: @@ -27,7 +26,6 @@ class Meta: 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) @@ -70,7 +68,6 @@ class Meta: class OurRessourcesSection(blocks.StructBlock): - title = blocks.CharBlock(default="Nos ressources", required=True, max_length=120) class Meta: @@ -80,7 +77,6 @@ class Meta: class WhatFindHereSection(blocks.StructBlock): - title = blocks.CharBlock(default="Sur le marché", required=True, max_length=120) class Meta: @@ -89,9 +85,18 @@ class Meta: label = "Avantages marché" -class OurPartnersSection(blocks.StructBlock): +class ImageWithLink(blocks.StructBlock): + image = ImageChooserBlock(required=True) + external_link = blocks.URLBlock(required=True) + + class Meta: + template = "cms/streams/image_with_link.html" + label = "Image avec lien externe" + +class OurPartnersSection(blocks.StructBlock): title = blocks.CharBlock(default="Les partenaires du marché", required=True, max_length=120) + images_with_link = blocks.StreamBlock([("images", ImageWithLink())], min_num=8, max_num=8) class Meta: template = "cms/streams/section_our_partners.html" diff --git a/lemarche/cms/migrations/0008_alter_homepage_content.py b/lemarche/cms/migrations/0008_alter_homepage_content.py new file mode 100644 index 000000000..99400c388 --- /dev/null +++ b/lemarche/cms/migrations/0008_alter_homepage_content.py @@ -0,0 +1,201 @@ +# Generated by Django 4.2.5 on 2023-09-12 08:19 + +import wagtail.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("cms", "0007_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, + ), + ), + ] + ), + ), + ( + "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), + ) + ] + ), + ), + ( + "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/static/itou_marche/sections/_home.scss b/lemarche/static/itou_marche/sections/_home.scss index 7905c56db..dca1bd501 100644 --- a/lemarche/static/itou_marche/sections/_home.scss +++ b/lemarche/static/itou_marche/sections/_home.scss @@ -54,6 +54,7 @@ padding-top: 3rem; padding-bottom: 3rem; } + .s-hp-slider-partners { padding-top: 1.5rem; padding-bottom: 1.5rem; @@ -82,6 +83,19 @@ } } } + + &__col-image { + img { + display: block; + margin: auto; + } + @media (max-width: 992px) { + width: 25%; + } + @media (min-width: 992px) { + width: 12.5%; + } + } } .multiCarousel { diff --git a/lemarche/templates/cms/streams/image_with_link.html b/lemarche/templates/cms/streams/image_with_link.html new file mode 100644 index 000000000..b05622e15 --- /dev/null +++ b/lemarche/templates/cms/streams/image_with_link.html @@ -0,0 +1,6 @@ + +{% load static wagtailimages_tags %} + + + {% image self.image height-80 %} + diff --git a/lemarche/templates/cms/streams/section_our_partners.html b/lemarche/templates/cms/streams/section_our_partners.html index 755ef530f..1d87b8331 100644 --- a/lemarche/templates/cms/streams/section_our_partners.html +++ b/lemarche/templates/cms/streams/section_our_partners.html @@ -1,74 +1,22 @@ -{% load static bootstrap4 %} +{% load static bootstrap4 wagtailcore_tags wagtailimages_tags %}
-

Les partenaires du marché

+

{{self.title}}

-
-
- - Banque BNP Paribas | La banque d'un monde qui change - -
-
- - Achetez des Timbres, Envoyez Courrier, Colis - La Poste - -
-
- - Groupe pharmaceutique Servier - -
-
- - Les entreprises s'engagent - -
-
- - Conseil National des Achats - -
-
- - Développer vos achats responsables auprès du STPA (ESAT & EA) - -
-
- - Handeco - Le partenaire économique des acteurs solidaires - -
-
- - ESS 2024 La plateforme solidaire - -
-
- - Campus de l'inclusion : Dirigeants, passez à l'action ! - -
-
- - Agence des Economies Solidaires - -
-
- - Fédération des Entreprises d'Insertion - -
-
- - Up France - -
+
+ {% for image_with_link in self.images_with_link %} +
+ {% include_block image_with_link %} + {% comment %} + Banque BNP Paribas | La banque d'un monde qui change + {% endcomment %} +
+ {% endfor %}
\ No newline at end of file