feat(base): Ajoute un bloc pour afficher une carte interactive

develop
Raphael 2022-09-05 17:50:56 +02:00
Parent d346f4b624
révision 207c8e9df7
5 fichiers modifiés avec 60 ajouts et 0 suppressions

Voir le fichier

@ -98,6 +98,22 @@ class ButtonBlock(LinkMixin, blocks.StructBlock):
)
class MapBlock(blocks.StructBlock):
"""
Bloc d'une carte interactive.
"""
class Meta:
label = "Carte"
icon = 'location'
group = "Médias"
template = 'blocks/map_block.html'
url = blocks.URLBlock(
icon='link', help_text="Lien vers la carte interractive."
)
class TuileBlock(LinkMixin, StyleColorMixin, blocks.StructBlock):
"""
Bloc d'une tuile avec un titre, un paragraphe et éventuellement un lien
@ -237,3 +253,4 @@ class BaseStreamBlock(blocks.StreamBlock):
image_block = ImageBlock()
section_tuiles_block = SectionTuilesBlock()
encart_block = EncartBlock()
map_block = MapBlock()

Diff de fichier supprimé car une ou plusieurs lignes sont trop longues

Voir le fichier

@ -9,3 +9,9 @@ def editor_js():
return format_html(
'<script src="{}"></script>', static('js/toggle_editor_block.js')
)
@hooks.register('register_icons')
def register_icons(icons):
icons.append('admin/icons/location.svg')
return icons

Voir le fichier

@ -0,0 +1 @@
<svg id="icon-location" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M408 120c0 54.6-73.1 151.9-105.2 192c-7.7 9.6-22 9.6-29.6 0C241.1 271.9 168 174.6 168 120C168 53.7 221.7 0 288 0s120 53.7 120 120zm8 80.4c3.5-6.9 6.7-13.8 9.6-20.6c.5-1.2 1-2.5 1.5-3.7l116-46.4C558.9 123.4 576 135 576 152V422.8c0 9.8-6 18.6-15.1 22.3L416 503V200.4zM137.6 138.3c2.4 14.1 7.2 28.3 12.8 41.5c2.9 6.8 6.1 13.7 9.6 20.6V451.8L32.9 502.7C17.1 509 0 497.4 0 480.4V209.6c0-9.8 6-18.6 15.1-22.3l122.6-49zM327.8 332c13.9-17.4 35.7-45.7 56.2-77V504.3L192 449.4V255c20.5 31.3 42.3 59.6 56.2 77c20.5 25.6 59.1 25.6 79.6 0zM288 152c22.1 0 40-17.9 40-40s-17.9-40-40-40s-40 17.9-40 40s17.9 40 40 40z"/></svg>

Après

Largeur:  |  Hauteur:  |  Taille: 867 B

Voir le fichier

@ -0,0 +1,14 @@
{% extends "./_base.html" %}
{% load wagtailcore_tags %}
{% block block %}
<iframe width="100%" height="400px" frameborder="0" allowfullscreen src="{{ self.url }}"></iframe>
<p>
<a type="button" class="btn btn-primary" href="{{ self.url }}"">
<i class="fa fa-arrow-right" aria-hidden="true"></i>
Voir en plein écran
</a>
</p>
{% endblock %}