Skip to content

Commit

Permalink
Refacto navigation bar (#1024)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarchois authored Oct 23, 2024
1 parent b12cf3e commit cbe5185
Show file tree
Hide file tree
Showing 37 changed files with 187 additions and 170 deletions.
2 changes: 1 addition & 1 deletion templates/accessRequest.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/app.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{'accessRequest.meta.title'|trans}} - {{ parent() }}
Expand Down
2 changes: 1 addition & 1 deletion templates/accessibility_statement.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/public.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
Accessibilité : non conforme - {{ parent() }}
Expand Down
2 changes: 1 addition & 1 deletion templates/bundles/TwigBundle/Exception/error.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/app.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{ 'error.status_code.title'|trans }} - {{ parent() }}
Expand Down
2 changes: 1 addition & 1 deletion templates/bundles/TwigBundle/Exception/error403.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/app.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{ 'error.403.title'|trans }} - {{ parent() }}
Expand Down
2 changes: 1 addition & 1 deletion templates/bundles/TwigBundle/Exception/error404.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/app.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{ 'error.404.title'|trans }} - {{ parent() }}
Expand Down
7 changes: 1 addition & 6 deletions templates/common/header.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
</div>
<div class="fr-header__service">
<a href="{{ path('app_landing') }}" title="{{ 'common.site_name'|trans }}">
<a href="{{ app.user ? path('app_regulations_list') : path('app_landing') }}" title="{{ 'common.site_name'|trans }}">
<p class="fr-header__service-title">
{{ 'common.site_name'|trans }}
<span class="fr-badge fr-badge--new">bêta</span>
Expand All @@ -26,11 +26,6 @@
<div class="fr-header__tools" data-testid="user-links">
<div class="fr-header__tools-links">
<ul class="fr-btns-group">
<li>
<a class="fr-btn fr-icon-file-text-line" href="{{ path('app_regulations_list') }}">
{{ 'regulation.list.title'|trans }}
</a>
</li>
{% if app.user %}
<li>
<a class="fr-btn fr-icon-edit-line" href="{{ path('app_feedback') }}">
Expand Down
2 changes: 1 addition & 1 deletion templates/ecodesign_statement.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/public.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% set title = "Déclaration d'écoconception" %}

Expand Down
2 changes: 1 addition & 1 deletion templates/feedback.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/app.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{'feedback.meta.title'|trans}} - {{ parent() }}
Expand Down
2 changes: 1 addition & 1 deletion templates/forgot-password.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/public.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{ 'forgot_password.title'|trans }} - {{ parent() }}
Expand Down
2 changes: 1 addition & 1 deletion templates/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/public.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{ parent() }}
Expand Down
2 changes: 1 addition & 1 deletion templates/landing_authorities.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/public.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{ 'landing.authorities.metatitle'|trans }} - {{ parent() }}
Expand Down
2 changes: 1 addition & 1 deletion templates/landing_digital_services.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/public.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{ 'landing.digital_services.metatitle'|trans }} - {{ parent() }}
Expand Down
2 changes: 1 addition & 1 deletion templates/landing_road_users.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/public.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{ 'landing.road_users.metatitle'|trans }} - {{ parent() }}
Expand Down
62 changes: 0 additions & 62 deletions templates/layouts/_base.html.twig

This file was deleted.

3 changes: 0 additions & 3 deletions templates/layouts/app.html.twig

This file was deleted.

122 changes: 122 additions & 0 deletions templates/layouts/layout.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{% set _nonce = csp_nonce('script') %}
{% set _nonce = csp_nonce('style') %}
<meta name="csp-nonce" content="{{ _nonce }}">

<link rel="apple-touch-icon" href="{{ asset('build/dsfr/favicon/apple-touch-icon.png') }}"><!-- 180×180 -->
<link rel="icon" href="{{ asset('build/dsfr/favicon/favicon.svg') }}" type="image/svg+xml">
<link rel="shortcut icon" href="{{ asset('build/dsfr/favicon/favicon.ico') }}" type="image/x-icon"><!-- 32×32 -->
<link rel="manifest" href="{{ asset('build/dsfr/favicon/manifest.webmanifest') }}" crossorigin="use-credentials">

<title>{% block title %}{{ 'common.title'|trans }}{% endblock %}</title>

{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
{% endblock %}

{% block javascripts %}
{{ encore_entry_script_tags('app') }}
<script type="module" src="{{ asset('build/dsfr/dsfr.module.min.js') }}" defer></script>
<script type="text/javascript" nomodule src="{{ asset('build/dsfr/dsfr.nomodule.min.js') }}" defer></script>
{% endblock %}
</head>
<body>

{% set skipLinks = [
{href: '#header-navigation', label: 'public.skiplinks.menu'|trans},
] %}

{% include 'common/skiplinks.html.twig' with { skipLinks: [
{href: '#content', label: 'common.skiplinks.content'|trans},
...(skipLinks|default([])),
{href: '#footer', label: 'common.skiplinks.footer'|trans},
]} only %}

{% embed 'common/header.html.twig' %}
{% block navigation %}
<nav class="fr-nav" id="header-navigation" role="navigation" aria-label="Menu principal">
<ul class="fr-nav__list">
{% if not app.user %}
<li class="fr-nav__item">
<a class="fr-nav__link" href="{{ path('app_landing') }}" {% if 'app_landing' == app.current_route %}aria-current="page"{% endif %}>
{{ 'landing.menu.button.home'|trans }}
</a>
</li>
<li>
<a class="fr-nav__link" href="{{ path('app_landing_authorities') }}" {% if 'app_landing_authorities' == app.current_route %}aria-current="page"{% endif %}>
{{ 'landing.menu.button.authorities'|trans }}
</a>
</li>
<li class="fr-nav__item">
<a class="fr-nav__link" href="{{ path('app_landing_digital_services') }}" {% if 'app_landing_digital_services' == app.current_route %}aria-current="page"{% endif %}>
{{ 'landing.menu.button.digital_services'|trans }}
</a>
</li>
<li class="fr-nav__item">
<a class="fr-nav__link" href="{{ path('app_landing_road_users') }}" {% if 'app_landing_road_users' == app.current_route %}aria-current="page"{% endif %}>
{{ 'landing.menu.button.road_users'|trans }}
</a>
</li>
<li class="fr-nav__item">
<a class="fr-nav__link" href="{{ path('app_regulations_list') }}" {% if 'app_regulations_list' == app.current_route %}aria-current="page"{% endif %}>
{{ 'landing.menu.button.restrictions'|trans }}
</a>
</li>
<li class="fr-nav__item">
<a class="fr-nav__link" href="{{ path('app_carto') }}" {% if 'app_carto' == app.current_route %}aria-current="page"{% endif %}>
{{ 'landing.menu.button.map'|trans }}
</a>
</li>
<li class="fr-nav__item">
<a class="fr-nav__link" href="/blog/fr/" target="_blank">
{{ 'common.blog'|trans }}
</a>
</li>
{% else %}
<li class="fr-nav__item">
<a class="fr-nav__link" href="{{ path('app_regulations_list') }}" {% if 'app_regulations_list' == app.current_route %}aria-current="page"{% endif %}>
{{ 'landing.menu.button.restrictions'|trans }}
</a>
</li>
<li class="fr-nav__item">
<a class="fr-nav__link" href="{{ path('app_carto') }}" {% if 'app_carto' == app.current_route %}aria-current="page"{% endif %}>
{{ 'landing.menu.button.map'|trans }}
</a>
</li>
{% endif %}
</ul>
</nav>
{% endblock %}
{% endembed %}

<main class="{% block page_class %}{% endblock page_class %}">
<noscript>
<section class="fr-container fr-mt-3w">
<div class="fr-alert fr-alert--info">
{{ 'common.javascript_required'|trans|raw }}
</div>
</section>
</noscript>
{% for label, messages in app.flashes %}
{% if loop.first %}<div class="fr-container fr-pt-4w">{% endif %}
{% for message in messages %}
<div class="fr-alert fr-alert--{{ label }}">
{{ message|raw }}
</div>
{% endfor %}
{% if loop.last %}</div>{% endif %}
{% endfor %}

<div {% if not definesContentSkiplink|default(false) %}id="content"{% endif %}>
{% block body %}{% endblock %}
</div>
</main>
{% include 'common/footer.html.twig' %}

{% block body_end %}{% endblock %}
</body>
</html>
46 changes: 0 additions & 46 deletions templates/layouts/public.html.twig

This file was deleted.

4 changes: 2 additions & 2 deletions templates/legal.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/public.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% set title = 'legal.title'|trans %}

Expand Down Expand Up @@ -49,7 +49,7 @@

Les pictogrammes sont issus du [système de design de l'Etat](https://www.systeme-de-design.gouv.fr/elements-d-interface/fondamentaux-techniques/pictogramme) publié sous licence [MIT](https://opensource.org/license/mit/).

Les icones sont issues :
Les icones sont issues :
* du [système de design de l'Etat](https://www.systeme-de-design.gouv.fr/elements-d-interface/fondamentaux-techniques/icone) publié sous licence [MIT](https://opensource.org/license/mit/),
* de [Remix Icon](https://remixicon.com/) publié sous licence [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).

Expand Down
2 changes: 1 addition & 1 deletion templates/login.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/public.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{ 'login.meta.title'|trans }} - {{ parent() }}
Expand Down
4 changes: 2 additions & 2 deletions templates/map/map.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/public.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{'map.meta.title'|trans}} - {{ parent() }}
Expand Down Expand Up @@ -40,7 +40,7 @@
}) }}
{{ form_widget(form.measureTypes) }}
</fieldset>

<h4 class="fr-h6 fr-my-2w">{{ 'map.filters.title.type.regulation'|trans }}</h4>
{{ form_row(form.displayPermanentRegulations, {group_class: 'fr-checkbox-group'}) }}
{{ form_row(form.displayTemporaryRegulations, {group_class: 'fr-checkbox-group'}) }}
Expand Down
2 changes: 1 addition & 1 deletion templates/my_area/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/app.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{'user.myarea'|trans}} - {{ parent() }}
Expand Down
2 changes: 1 addition & 1 deletion templates/my_area/organization/user/form.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/app.html.twig' %}
{% extends 'layouts/layout.html.twig' %}
{% set metaTitle = user is defined ? user.fullName : 'user.form.add'|trans %}
{% block title %}
{{ metaTitle }} - {{ parent() }}
Expand Down
2 changes: 1 addition & 1 deletion templates/my_area/organization/user/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/app.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{'user.list.title'|trans }} - {{ parent() }}
Expand Down
2 changes: 1 addition & 1 deletion templates/my_area/organization/visa_model/form.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/app.html.twig' %}
{% extends 'layouts/layout.html.twig' %}
{% set metaTitle = visaModel is defined ? visaModel.name : 'visa.add.title'|trans %}
{% block title %}
{{ metaTitle }} - {{ parent() }}
Expand Down
2 changes: 1 addition & 1 deletion templates/my_area/organization/visa_model/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'layouts/app.html.twig' %}
{% extends 'layouts/layout.html.twig' %}

{% block title %}
{{'visa.list.title'|trans }} - {{ parent() }}
Expand Down
Loading

0 comments on commit cbe5185

Please sign in to comment.