Archived
1
Fork 0
This commit is contained in:
Edgar P. Burkhart 2024-06-12 19:02:56 +02:00
parent a7bad9aa3b
commit 191b946a73
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
7 changed files with 110 additions and 3 deletions

View file

@ -0,0 +1,43 @@
# Generated by Django 5.0.6 on 2024-06-12 17:00
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("base", "0003_formpage_formfield"),
("wagtailimages", "0026_delete_uploadedimage"),
]
operations = [
migrations.CreateModel(
name="SiteSettings",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"icon",
models.ForeignKey(
blank=True,
help_text="Icône du site",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="wagtailimages.image",
),
),
],
options={
"abstract": False,
},
),
]

View file

@ -26,6 +26,21 @@ class NavigationSettings(BaseGenericSetting):
) )
] ]
@register_setting
class SiteSettings(BaseGenericSetting):
icon = models.ForeignKey(
"wagtailimages.Image",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
help_text="Icône du site",
)
panels = [
MultiFieldPanel(
[FieldPanel("icon")], "Informations du site")]
class FormField(AbstractFormField): class FormField(AbstractFormField):
page = ParentalKey("FormPage", on_delete=models.CASCADE, related_name="form_fields") page = ParentalKey("FormPage", on_delete=models.CASCADE, related_name="form_fields")

View file

@ -0,0 +1,27 @@
# Generated by Django 5.0.6 on 2024-06-12 16:50
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("home", "0004_homepage_hero_text_homepage_image"),
("wagtailimages", "0026_delete_uploadedimage"),
]
operations = [
migrations.AddField(
model_name="homepage",
name="icon",
field=models.ForeignKey(
blank=True,
help_text="Icône du site",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="wagtailimages.image",
),
),
]

View file

@ -0,0 +1,17 @@
# Generated by Django 5.0.6 on 2024-06-12 17:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("home", "0005_homepage_icon"),
]
operations = [
migrations.RemoveField(
model_name="homepage",
name="icon",
),
]

View file

@ -6,7 +6,11 @@ h1, h2, h3, h4, h5, h6 {
--pico-font-weight: 600; --pico-font-weight: 600;
} }
img { nav img {
height: 100%;
}
main img {
width: 100%; width: 100%;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

View file

@ -1,10 +1,11 @@
{% load wagtailcore_tags navigation_tags %} {% load wagtailcore_tags navigation_tags wagtailimages_tags %}
{% get_site_root as site_root %} {% get_site_root as site_root %}
<nav> <nav>
<ul> <ul>
<li> <li>
<a href="{% pageurl site_root %}"> <a href="{% pageurl site_root %}">
<strong>Lycée du Pays de Soule</strong> {% srcset_image settings.base.SiteSettings.icon width-{64,128} %}
<strong>{{ site_root.title }}</strong>
</a> </a>
</li> </li>
</ul> </ul>