diff --git a/.haml-lint.yml b/.haml-lint.yml index b4ab9d44ed..9a6b7849ed 100644 --- a/.haml-lint.yml +++ b/.haml-lint.yml @@ -4,3 +4,5 @@ linters: ConsecutiveSilentScripts: enabled: true max_consecutive: 5 + ViewLength: + exclude: 'app/views/application/_navbar.html.haml' diff --git a/app/views/application/_navbar.html.haml b/app/views/application/_navbar.html.haml index a17ebcdd04..68f144d2ba 100644 --- a/app/views/application/_navbar.html.haml +++ b/app/views/application/_navbar.html.haml @@ -1,34 +1,43 @@ -- if user_signed_in? - %header.fr-header#header-navigation{ role: "banner" } - .fr-header__body.fr-header--hidden - .fr-container - .fr-header__body-row - .fr-header__brand.fr-enlarge-link - .fr-header__brand-top - .fr-header__logo - %p.fr-logo - = t('republique_francaise_html') - .fr-header__operator - = link_to root_path, class: 'fr-nav__link bold', title: t('navbar.root_path_title') do - %span.red>= t('app_name_subdomain').sp_titleize_url - %br - = "." + t('app_name_domain').sp_titleize_url - .fr-header__navbar - %button.fr-btn--menu.fr-btn#fr-btn-menu-mobile-2{ 'aria-controls': 'modal-870', 'aria-haspopup': 'menu', 'data-fr-opened': 'false', title: t('navbar.menu') } - = t("navbar.menu") - .fr-header__tools - .fr-header__tools-links - %ul.fr-links-group - .fr-header__menu.fr-modal#modal-870{ 'aria-labelledby': 'fr-btn-menu-mobile-2' } - .fr-container - %button.fr-link--close.fr-link{ 'aria-controls': 'modal-870' }= t('navbar.close') - .fr-header__menu-links - %nav.fr-nav{ 'aria-label': t("navbar.main_menu"), role: 'navigation' } - %ul.fr-nav__list - %li.fr-nav__item - = active_link_to root_path, class: 'fr-nav__link fr-text--bold', wrap_tag: :li, wrap_class: 'fr-nav__item', class_active: 'fr-nav__item--active', title: t('navbar.root_path_title'), active: :exclusive do +%header.fr-header{ role: "banner" } + .fr-header__body + .fr-container + .fr-header__body-row + .fr-header__brand.fr-enlarge-link + .fr-header__brand-top + .fr-header__logo + %p.fr-logo + = t('republique_francaise_html') + .fr-header__navbar + %button.fr-btn--menu.fr-btn#fr-btn-menu-mobile-2{ 'aria-controls': 'modal-mobile', 'aria-haspopup': 'menu', 'data-fr-opened': 'false', title: t("navbar.root_path_title") } + = t("navbar.menu") + .fr-header__service + = link_to root_path do + %p.fr-header__service-title %span.red>= t('app_name_subdomain').sp_titleize_url = "." + t('app_name_domain').sp_titleize_url + .fr-header__tools + .fr-header__tools-links{ role: 'navigation' } + %ul.fr-btns-group + - if user_signed_in? + %li + = link_to user_path, class: 'fr-btn' do + %span.ri-user-line.fr-mr-1w{ 'aria-hidden': 'true' } + = t('.profile') + %li + = button_to destroy_user_session_path, method: :delete, data: { turbo: false }, local: true, rel: :nofollow, class: 'fr-btn' do + %span.ri-logout-box-r-line.fr-mr-1w{ 'aria-hidden': 'true' } + = t('.sign_out') + - else + %li + = link_to t('experts_login'), new_user_session_path, class: 'fr-btn fr-icon-lock-line' + + .fr-header__menu.fr-modal#modal-mobile{ 'aria-labelledby': 'fr-btn-menu-mobile-2' } + .fr-container + %button.fr-btn--close.fr-btn{ 'aria-controls': 'modal-mobile' }= t('navbar.close') + .fr-header__menu-links{ 'aria-label': t('navbar.main_menu') } + %nav.fr-nav{ 'aria-label': t("navbar.main_menu"), role: 'navigation' } + - if user_signed_in? + %ul.fr-nav__list - if current_user.experts.present? = active_link_to needs_path, class: 'fr-nav__link', wrap_tag: :li, wrap_class: 'fr-nav__item', class_active: 'fr-nav__item--active' do %span.ri-inbox-fill.fr-mr-1w{ 'aria-hidden': 'true' } @@ -64,12 +73,12 @@ = active_link_to tutoriels_path, class: 'fr-nav__link', wrap_tag: :li, wrap_class: 'fr-nav__item', class_active: 'fr-nav__item--active' do %span.ri-tools-line.fr-mr-1w{ 'aria-hidden': 'true' } = t('user_pages.tutoriels.title') - %li.fr-nav__item.fr-nav__item--align-right - %button.fr-nav__btn{ 'aria-controls': "fr-nav-item-account", 'aria-expanded': "false", data: { controller: 'fr-dropdown', action: 'click->fr-dropdown#collapse' } } - = t('.account') - .fr-menu.fr-collapse#fr-nav-item-account - %ul.fr-menu__list - - if policy(User).admin? + - if policy(User).admin? + %li.fr-nav__item.fr-nav__item--align-right + %button.fr-nav__btn{ 'aria-controls': "fr-nav-item-account", 'aria-expanded': "false", data: { controller: 'fr-dropdown', action: 'click->fr-dropdown#collapse' } } + = t('.tools') + .fr-menu.fr-collapse#fr-nav-item-account + %ul.fr-menu__list = active_link_to admin_root_path, class: 'fr-nav__link', wrap_tag: :li, wrap_class: 'fr-menu__item', class_active: 'fr-menu__item--active' do %span.ri-auction-line.fr-mr-1w{ 'aria-hidden': 'true' } = t('.admin') @@ -85,12 +94,11 @@ = active_link_to new_user_invitation_path, class: 'fr-nav__link', wrap_tag: :li, wrap_class: 'fr-menu__item', class_active: 'fr-menu__item--active' do %span.ri-user-add-line.fr-mr-1w{ 'aria-hidden': 'true' } = t('.invite') - = active_link_to user_path, class: 'fr-nav__link', wrap_tag: :li, wrap_class: 'fr-menu__item', class_active: 'fr-menu__item--active' do - %span.ri-user-line.fr-mr-1w{ 'aria-hidden': 'true' } - = t('.profile') - = button_to destroy_user_session_path, method: :delete, data: { turbo: false }, local: true, rel: :nofollow, class: 'fr-nav__link', wrap_tag: :li, wrap_class: 'fr-menu__item', class_active: 'fr-menu__item--active' do - %span.ri-logout-box-r-line.fr-mr-1w{ 'aria-hidden': 'true' } - = t('.sign_out') - -- else - = render 'navbar_signin' + - else + %ul.fr-nav__list + = active_link_to root_path, class: 'fr-nav__link', wrap_tag: :li, wrap_class: 'fr-nav__item', class_active: 'fr-nav__item--active', active: :exclusive do + %span.ri-home-line.fr-mr-1w{ 'aria-hidden': 'true' } + = t('breadcrumbs_helper.home_link.home') + = active_link_to comment_ca_marche_path, class: 'fr-nav__link', wrap_tag: :li, wrap_class: 'fr-nav__item', class_active: 'fr-nav__item--active' do + %span.ri-presentation-line.fr-mr-1w{ 'aria-hidden': 'true' } + = t('about.comment_ca_marche.title') diff --git a/app/views/application/_navbar_signin.html.haml b/app/views/application/_navbar_signin.html.haml deleted file mode 100644 index 32d51b4e20..0000000000 --- a/app/views/application/_navbar_signin.html.haml +++ /dev/null @@ -1,36 +0,0 @@ -%header.fr-header#header-navigation{ role: "banner" } - .fr-header__body - .fr-container - .fr-header__body-row - .fr-header__brand.fr-enlarge-link - .fr-header__brand-top - .fr-header__logo - %p.fr-logo - = t('republique_francaise_html') - .fr-header__navbar - %button.fr-btn--menu.fr-btn#fr-btn-menu-mobile-2{ 'aria-controls': 'modal-870', 'aria-haspopup': 'menu', 'data-fr-opened': 'false', title: t("navbar.root_path_title") } - = t("navbar.menu") - .fr-header__service - = link_to root_path do - %p.fr-header__service-title - %span.red>= t('app_name_subdomain').sp_titleize_url - = "." + t('app_name_domain').sp_titleize_url - .fr-header__tools - .fr-header__tools-links{ role: 'navigation' } - %ul.fr-btns-group - %li - = link_to t('experts_login'), user_signed_in? ? needs_path : new_user_session_path, class: 'fr-btn fr-icon-lock-line' - - / Navigation principale - à garder pour éviter erreurs js sur mobile - .fr-header__menu.fr-modal#modal-870{ 'aria-labelledby': 'fr-btn-menu-mobile-2' } - .fr-container - %button.fr-btn--close.fr-btn{ 'aria-controls': 'modal-870' }= t('navbar.close') - .fr-header__menu-links{ 'aria-label': t('navbar.main_menu') } - %nav.fr-nav{ 'aria-label': t("navbar.main_menu"), role: 'navigation' } - %ul.fr-nav__list - = active_link_to root_path, class: 'fr-nav__link', wrap_tag: :li, wrap_class: 'fr-nav__item', class_active: 'fr-nav__item--active', active: :exclusive do - %span.ri-home-line.fr-mr-1w{ 'aria-hidden': 'true' } - = t('breadcrumbs_helper.home_link.home') - = active_link_to comment_ca_marche_path, class: 'fr-nav__link', wrap_tag: :li, wrap_class: 'fr-nav__item', class_active: 'fr-nav__item--active' do - %span.ri-presentation-line.fr-mr-1w{ 'aria-hidden': 'true' } - = t('about.comment_ca_marche.title') diff --git a/config/locales/views.fr.yml b/config/locales/views.fr.yml index 8319b1b5d4..e42e96bd38 100644 --- a/config/locales/views.fr.yml +++ b/config/locales/views.fr.yml @@ -99,7 +99,6 @@ fr: see_expert_coordinates: Voir les coordonnées de l'équipe see_person_coordinates: Voir les coordonnées de la personne navbar: - account: Compte admin: Administration annuaire: Annuaire antenne_needs: Besoins de l’antenne @@ -111,6 +110,7 @@ fr: reports: Export des données sign_out: Déconnexion stats: Statistiques + tools: Outils pde_partnership_mention: Ce service public d'accompagnement des entreprises est proposé par Conseillers Entreprises. person_modal: manager_name: 'Responsable : %{name}'