Skip to content

Commit

Permalink
Merge pull request #41 from betagouv/sreuiller/dynamic-footer-menu
Browse files Browse the repository at this point in the history
Dynamisation des menus en haut à droite et en pied page
  • Loading branch information
SebastienReuiller authored Sep 1, 2023
2 parents 6bf1f33 + 6e3135a commit 9eb9322
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@

WAGTAILEMBEDS_RESPONSIVE_HTML = True
WAGTAIL_MODERATION_ENABLED = False
WAGTAILMENUS_FLAT_MENUS_HANDLE_CHOICES = (("header_tools", "Menu en haut à droite"), ("footer", "Menu en pied de page"),)

CSRF_TRUSTED_ORIGINS = []
for host in ALLOWED_HOSTS:
Expand Down
6 changes: 2 additions & 4 deletions templates/blocks/footer.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{% extends "dsfr/footer.html" %}
{% load menu_tags %}

{% block footer_links %}
{{ block.super }}
<li class="fr-footer__bottom-item">
<button class="fr-btn--display fr-btn" aria-controls="fr-theme-modal" data-fr-opened="false">Paramètres d'affichage</button>
</li>
{% flat_menu handle="footer" template="menus/custom_flat_menu_footer.html" %}
{% endblock footer_links %}
4 changes: 1 addition & 3 deletions templates/blocks/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
{% block service_tagline %}{{ SITE_CONFIG.site_tagline }}{% endblock service_tagline %}

{% block header_tools %}
<li>
<button class="fr-btn--display fr-btn" aria-controls="fr-theme-modal" data-fr-opened="false">Paramètres d'affichage</button>
</li>
{% flat_menu handle="header_tools" template="menus/custom_flat_menu.html" %}
{% endblock header_tools %}

{# Leave burger_menu and main_menu blocks empty if the main menu is not used #}
Expand Down
9 changes: 9 additions & 0 deletions templates/menus/custom_flat_menu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% load menu_tags %}
{% for item in menu_items %}
<li>
<a href="{{ item.href }}"
class="fr-btn"
{% if item.active_class %} aria-current="page"{% endif %}
target="_self">{{ item.text }}</a>
</li>
{% endfor %}
8 changes: 8 additions & 0 deletions templates/menus/custom_flat_menu_footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% for item in menu_items %}
<li class="fr-footer__bottom-item">
<a href="{{ item.href }}"
class="fr-footer__bottom-link"
{% if item.active_class %} aria-current="page"{% endif %}
target="_self">{{ item.text }}</a>
</li>
{% endfor %}

0 comments on commit 9eb9322

Please sign in to comment.