Skip to content

Commit

Permalink
Add a new setting to add the theme toggle to the footer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-Crow committed Nov 27, 2023
1 parent 289cbae commit 1d694e3
Show file tree
Hide file tree
Showing 7 changed files with 493 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"wagtail.search",
"wagtail",
"wagtailmenus",
"wagtail_modeladmin",
"taggit",
"django.contrib.auth",
"django.contrib.contenttypes",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.7 on 2023-11-27 16:23

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("content_manager", "0009_cmsdsfrconfig_footer_theme_modale_and_more"),
]

operations = [
migrations.RenameField(
model_name="cmsdsfrconfig",
old_name="footer_theme_modale",
new_name="theme_modale_button",
),
]
5 changes: 4 additions & 1 deletion content_manager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class Meta:
]


@register_setting(icon="code")
@register_setting(icon="cog")
class CmsDsfrConfig(BaseSiteSetting):
class Meta:
verbose_name = "Configuration du site"
Expand Down Expand Up @@ -161,6 +161,8 @@ class Meta:
blank=True,
help_text="Balises HTML autorisés",
)

theme_modale_button = models.BooleanField("Choix du thème clair/sombre", default=False)
mourning = models.BooleanField("Mise en berne", default=False)

panels = [
Expand All @@ -172,4 +174,5 @@ class Meta:
FieldPanel("site_tagline"),
FieldPanel("footer_description"),
FieldPanel("mourning"),
FieldPanel("theme_modale_button"),
]
20 changes: 19 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dj-static = "^0.0.6"
wagtailmenus = "^3.1.9"
boto3 = "^1.29.1"
django-storages = "^1.14.2"
wagtail-modeladmin = "^1.0.0"


[tool.poetry.group.dev.dependencies]
Expand Down
7 changes: 7 additions & 0 deletions templates/blocks/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@

{% block footer_links %}
{% flat_menu handle="footer" template="menus/custom_flat_menu_footer.html" %}
{% if settings.content_manager.CmsDsfrConfig.theme_modale_button %}
<li class="fr-footer__bottom-item">
<button id="footer__bottom-link__parametres-affichage" aria-controls="fr-theme-modal" data-fr-opened="false" class="fr-icon-theme-fill fr-link--icon-left fr-footer__bottom-link" data-fr-js-modal-button="true">
Paramètres d’affichage
</button>
</li>
{% endif %}
{% endblock footer_links %}

0 comments on commit 1d694e3

Please sign in to comment.