Archived
1
Fork 0

Add external links to footer

This commit is contained in:
Edgar P. Burkhart 2024-06-13 09:02:53 +02:00
parent 30d4fed173
commit 9aa14b2b4f
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
5 changed files with 125 additions and 1 deletions

View file

@ -0,0 +1,29 @@
# Generated by Django 5.0.6 on 2024-06-13 06:50
import wagtail.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("base", "0004_sitesettings"),
]
operations = [
migrations.AddField(
model_name="navigationsettings",
name="links",
field=wagtail.fields.StreamField(
[
(
"links",
wagtail.blocks.ListBlock(
wagtail.blocks.URLBlock(label="Lien externe")
),
)
],
blank=True,
),
),
]

View file

@ -0,0 +1,34 @@
# Generated by Django 5.0.6 on 2024-06-13 06:55
import wagtail.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("base", "0005_navigationsettings_links"),
]
operations = [
migrations.AlterField(
model_name="navigationsettings",
name="links",
field=wagtail.fields.StreamField(
[
(
"links",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
("title", wagtail.blocks.CharBlock()),
("url", wagtail.blocks.URLBlock()),
]
)
),
)
],
blank=True,
),
),
]

View file

@ -0,0 +1,32 @@
# Generated by Django 5.0.6 on 2024-06-13 07:00
import wagtail.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("base", "0006_alter_navigationsettings_links"),
]
operations = [
migrations.AlterField(
model_name="navigationsettings",
name="links",
field=wagtail.fields.StreamField(
[
(
"link",
wagtail.blocks.StructBlock(
[
("title", wagtail.blocks.CharBlock()),
("url", wagtail.blocks.URLBlock()),
]
),
)
],
blank=True,
),
),
]

View file

@ -1,10 +1,11 @@
from django.db import models from django.db import models
from modelcluster.fields import ParentalKey from modelcluster.fields import ParentalKey
from wagtail import blocks
from wagtail.admin.panels import FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel from wagtail.admin.panels import FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel
from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField
from wagtail.contrib.forms.panels import FormSubmissionsPanel from wagtail.contrib.forms.panels import FormSubmissionsPanel
from wagtail.contrib.settings.models import BaseGenericSetting, register_setting from wagtail.contrib.settings.models import BaseGenericSetting, register_setting
from wagtail.fields import RichTextField from wagtail.fields import RichTextField, StreamField
@register_setting @register_setting
@ -14,6 +15,20 @@ class NavigationSettings(BaseGenericSetting):
max_length=32, verbose_name="Numéro de téléphone", blank=True max_length=32, verbose_name="Numéro de téléphone", blank=True
) )
email = models.EmailField(verbose_name="Adresse de courriel", blank=True) email = models.EmailField(verbose_name="Adresse de courriel", blank=True)
links = StreamField(
[
(
"link",
blocks.StructBlock(
[
("title", blocks.CharBlock()),
("url", blocks.URLBlock()),
]
),
)
],
blank=True,
)
panels = [ panels = [
MultiFieldPanel( MultiFieldPanel(
@ -21,6 +36,7 @@ class NavigationSettings(BaseGenericSetting):
FieldPanel("address"), FieldPanel("address"),
FieldPanel("phone"), FieldPanel("phone"),
FieldPanel("email"), FieldPanel("email"),
FieldPanel("links"),
], ],
"Informations de contact", "Informations de contact",
) )

View file

@ -15,6 +15,19 @@
</ul> </ul>
</nav> </nav>
</section> </section>
{% if settings.base.NavigationSettings.links %}
<section>
<nav>
<ul>
{% for link in settings.base.NavigationSettings.links %}
<li>
<a href="{{ link.value.url }}" target="_blank">{{ link.value.title }}</a>
</li>
{% endfor %}
</ul>
</nav>
</section>
{% endif %}
<section> <section>
<p> <p>
<small><a href="/admin/">Accès administrateur</a></small> <small><a href="/admin/">Accès administrateur</a></small>