Skip to content

Commit

Permalink
add images with links
Browse files Browse the repository at this point in the history
  • Loading branch information
madjid-asa committed Sep 12, 2023
1 parent 2e14a8a commit e8195b5
Show file tree
Hide file tree
Showing 5 changed files with 242 additions and 68 deletions.
15 changes: 10 additions & 5 deletions lemarche/cms/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

Expand Down Expand Up @@ -70,7 +68,6 @@ class Meta:


class OurRessourcesSection(blocks.StructBlock):

title = blocks.CharBlock(default="Nos ressources", required=True, max_length=120)

class Meta:
Expand All @@ -80,7 +77,6 @@ class Meta:


class WhatFindHereSection(blocks.StructBlock):

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

class Meta:
Expand All @@ -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"
Expand Down
201 changes: 201 additions & 0 deletions lemarche/cms/migrations/0008_alter_homepage_content.py
Original file line number Diff line number Diff line change
@@ -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,
),
),
]
14 changes: 14 additions & 0 deletions lemarche/static/itou_marche/sections/_home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
padding-top: 3rem;
padding-bottom: 3rem;
}

.s-hp-slider-partners {
padding-top: 1.5rem;
padding-bottom: 1.5rem;
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions lemarche/templates/cms/streams/image_with_link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

{% load static wagtailimages_tags %}

<a href="{{self.external_link}}" target="_blank" rel="noopener">
{% image self.image height-80 %}
</a>
74 changes: 11 additions & 63 deletions lemarche/templates/cms/streams/section_our_partners.html
Original file line number Diff line number Diff line change
@@ -1,74 +1,22 @@

{% load static bootstrap4 %}
{% load static bootstrap4 wagtailcore_tags wagtailimages_tags %}

<section class="s-hp-slider-partners">
<div class="s-hp-slider-partners__container container">
<div class="s-hp-slider-partners__row row">
<div class="s-hp-slider-partners__col col-12">
<h2 class="h2 mb-3 mb-lg-5">Les partenaires du marché</h2>
<h2 class="h2 mb-3 mb-lg-5 text-center">{{self.title}}</h2>
</div>
</div>
<div class="s-hp-slider-partners__row row row-cols-2 row-cols-sm-3 row-cols-md-4 row-cols-lg-6">
<div class="s-hp-slider-partners__col col pb-3 d-flex align-items-center">
<a href="https://group.bnpparibas/" target="_blank" rel="noopener">
<img src="{% static 'images/logo-partners-bnp.svg' %}" class="img-fluid" alt="Banque BNP Paribas | La banque d'un monde qui change" loading="lazy" />
</a>
</div>
<div class="s-hp-slider-partners__col col pb-3 d-flex align-items-center">
<a href="https://www.laposte.fr/" target="_blank" rel="noopener">
<img src="{% static 'images/logo-partners-la-poste.jpg' %}" class="img-fluid" alt="Achetez des Timbres, Envoyez Courrier, Colis - La Poste" loading="lazy" />
</a>
</div>
<div class="s-hp-slider-partners__col col pb-3 d-flex align-items-center">
<a href="https://www.servier.fr/" target="_blank" rel="noopener">
<img src="{% static 'images/logo-partners-servier.min.png' %}" class="img-fluid" alt="Groupe pharmaceutique Servier" loading="lazy" />
</a>
</div>
<div class="s-hp-slider-partners__col col pb-3 d-flex align-items-center">
<a href="https://www.lesentreprises-sengagent.gouv.fr" target="_blank" rel="noopener">
<img src="{% static 'images/logo-partners-les-entreprises-sengagent.svg' %}" class="img-fluid" alt="Les entreprises s'engagent" loading="lazy" />
</a>
</div>
<div class="s-hp-slider-partners__col col pb-3 d-flex align-items-center">
<a href="https://www.cna-asso.fr/" target="_blank" rel="noopener">
<img src="{% static 'images/logo-partners-cna.min.png' %}" class="img-fluid" alt="Conseil National des Achats" loading="lazy" />
</a>
</div>
<div class="s-hp-slider-partners__col col pb-3 d-flex align-items-center">
<a href="https://www.reseau-gesat.com" target="_blank" rel="noopener">
<img src="{% static 'images/logo-partners-reseau-gesat-square.min.png' %}" class="img-fluid" alt="Développer vos achats responsables auprès du STPA (ESAT & EA)" loading="lazy" />
</a>
</div>
<div class="s-hp-slider-partners__col col pb-3 d-flex align-items-center">
<a href="https://handeco.org" target="_blank" rel="noopener">
<img src="{% static 'images/logo-partners-handeco.min.png' %}" class="img-fluid" alt="Handeco - Le partenaire économique des acteurs solidaires" loading="lazy" />
</a>
</div>
<div class="s-hp-slider-partners__col col pb-3 d-flex align-items-center">
<a href="https://ess2024.org" target="_blank" rel="noopener">
<img src="{% static 'images/logo-partners-ess-2024.min.png' %}" class="img-fluid" alt="ESS 2024 La plateforme solidaire" loading="lazy" />
</a>
</div>
<div class="s-hp-slider-partners__col col pb-3 d-flex align-items-center">
<a href="https://campus-inclusion.fr" target="_blank" rel="noopener">
<img src="{% static 'images/logo-partners-le-campus-de-linclusion.min.png' %}" class="img-fluid" alt="Campus de l'inclusion : Dirigeants, passez à l'action !" loading="lazy" />
</a>
</div>
<div class="s-hp-slider-partners__col col pb-3 d-flex align-items-center">
<a href="https://www.linkedin.com/company/economies-solidaires/" target="_blank" rel="noopener">
<img src="{% static 'images/logo-partners-agence-des-economies-solidaires.min.jpg' %}" class="img-fluid" alt="Agence des Economies Solidaires" loading="lazy" />
</a>
</div>
<div class="s-hp-slider-partners__col col pb-3 d-flex align-items-center">
<a href="http://www.lesentreprisesdinsertion.org/" target="_blank" rel="noopener">
<img src="{% static 'images/logo-partners-fei.min.png' %}" class="img-fluid" alt="Fédération des Entreprises d'Insertion" loading="lazy" />
</a>
</div>
<div class="s-hp-slider-partners__col col pb-3 d-flex align-items-center">
<a href="https://up.coop/home" target="_blank" rel="noopener">
<img src="{% static 'images/logo-partners-up.min.jpg' %}" class="img-fluid" alt="Up France" loading="lazy" />
</a>
</div>
<div class="s-hp-slider-partners__row row">
{% for image_with_link in self.images_with_link %}
<div class="s-hp-slider-partners__col s-hp-slider-partners__col-image">
{% include_block image_with_link %}
{% comment %} <a href="https://group.bnpparibas/" target="_blank" rel="noopener">
<img src="{% static 'images/logo-partners-bnp.svg' %}" class="img-fluid" alt="Banque BNP Paribas | La banque d'un monde qui change" loading="lazy" />
</a> {% endcomment %}
</div>
{% endfor %}
</div>
</div>
</section>

0 comments on commit e8195b5

Please sign in to comment.