feat(ressources): ajoute un lien inline; fix #7
Parent
f82fee3834
révision
fb820a7e17
|
@ -181,6 +181,7 @@ class FilAriane(mixins.SetBlockTheme, blocks.StructBlock):
|
|||
def contenus_textes():
|
||||
return [(nom, bloc()) for nom, bloc in contenus['texte']] + [
|
||||
("table_matieres", TableMatieres()),
|
||||
("ressource", Ressource()),
|
||||
]
|
||||
|
||||
|
||||
|
@ -291,6 +292,28 @@ class TableMatieres(mixins.SetBlockTheme, blocks.StructBlock):
|
|||
)
|
||||
|
||||
|
||||
@register_contenu()
|
||||
class Ressource(mixins.SetBlockTheme, mixins.SetThemeColor, blocks.StructBlock):
|
||||
class Meta:
|
||||
icon = 'doc-full'
|
||||
group = 'interne'
|
||||
label = "lier une ressource"
|
||||
|
||||
ressource = blocks.PageChooserBlock(target_model=[
|
||||
'base.Publication',
|
||||
'base.Fiche',
|
||||
'base.LivreBlanc',
|
||||
])
|
||||
|
||||
direct = blocks.BooleanBlock(
|
||||
label="lien direct au fichier",
|
||||
required=False,
|
||||
default=False,
|
||||
help_text="Lie au fichier ressource. Par défaut lie à la page de "
|
||||
"présentation de la ressource.",
|
||||
)
|
||||
|
||||
|
||||
@register_contenu()
|
||||
class Espace(mixins.SetBlockTheme, blocks.StructBlock):
|
||||
class Meta:
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
{% extends "./_baseblock.html" %}
|
||||
{% load wagtailcore_tags wagtailimages_tags %}
|
||||
|
||||
{% block interieur %}
|
||||
{% with color=value.theme_color|default:page.specific.get_theme_color %}
|
||||
<div class="alert-{{ color }}">
|
||||
{% with ressource=value.ressource.specific %}
|
||||
{% if value.direct %}
|
||||
<a href="{{ ressource.document.url }}">
|
||||
{% else %}
|
||||
<a href="{{ ressource.url }}">
|
||||
{% endif %}
|
||||
<i class="d-inline-block fa fa-4x fa-file-text-o align-middle p-2 mr-2"></i>
|
||||
<div class="d-inline-block lead">{{ ressource.title }}</div>
|
||||
</a>
|
||||
{% endwith %}
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% endblock %}
|
Chargement…
Référencer dans un nouveau ticket