diff --git a/app/assets/stylesheets/dsfr.scss b/app/assets/stylesheets/dsfr.scss index 6478ea3c7..baddb347c 100644 --- a/app/assets/stylesheets/dsfr.scss +++ b/app/assets/stylesheets/dsfr.scss @@ -89,6 +89,21 @@ trix-editor.fr-input { } } } +/* prettier-ignore */ +.fr-nav__item.section-active { + position: relative; + + &::after { + content: ''; // scss-lint:disable StringQuotes + position: absolute; + bottom: -2px; + left: 0; + width: 100%; + height: 2px; + background-color: var(--blue-france-sun-113-625); + transform: translateY(100%); + } +} @keyframes popover-slide { from { diff --git a/app/helpers/navigation_helper.rb b/app/helpers/navigation_helper.rb new file mode 100644 index 000000000..870785327 --- /dev/null +++ b/app/helpers/navigation_helper.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module NavigationHelper + def current_nav_section + if procedure_management_section? + 'procedure_management' + elsif user_support_section? + 'user_support' + elsif downloads_section? + 'downloads' + else + 'follow_up' + end + end + + private + + def procedure_management_section? + return true if params[:action].in?(['administrateurs', 'stats', 'email_notifications', 'deleted_dossiers']) + return true if params[:controller] == 'instructeurs/groupe_instructeurs' + + false + end + + def user_support_section? + params[:action] == 'email_usagers' || params[:action] == 'apercu' + end + + def downloads_section? + params[:action] == 'exports' || + params[:controller] == 'instructeurs/archives' + end +end diff --git a/app/views/instructeurs/procedures/_header.html.haml b/app/views/instructeurs/procedures/_header.html.haml index 66b6fa33a..fe3208ff9 100644 --- a/app/views/instructeurs/procedures/_header.html.haml +++ b/app/views/instructeurs/procedures/_header.html.haml @@ -1,23 +1,24 @@ .procedure-header - .clipboard-container.flex - = link_to "javascript:history.back()", class: "fr-btn btn-back" do - %span.fr-icon-arrow-left-line{ "aria-hidden" => "true", style: "font-size: 14px;" } - + .clipboard-container %h1.fr-h3 = "#{procedure_libelle procedure} (n°#{procedure.id})" %nav.flex.align-center.fr-translate.fr-nav{ role: "navigation", "aria-label"=> t('instructeurs.dossiers.header.banner.procedure_navigation') } - .fr-nav__item + .fr-nav__item{ class: ('section-active' if current_nav_section == 'follow_up') } = link_to instructeur_procedure_path(procedure), class: "account-btn fr-btn fr-btn--tertiary fr-btn--no-border", style: "box-shadow: none; background: none;" do %span.fr-mr-1w= t('instructeurs.dossiers.header.banner.follow_up') - .fr-nav__item.relative + .fr-nav__item.relative{ class: ('section-active' if current_nav_section == 'procedure_management') } %button.account-btn.fr-translate__btn.fr-btn.fr-btn--tertiary.fr-btn--no-border.fr-text--md{ "aria-controls" => "procedure-management", "aria-expanded" => "false", style: "box-shadow: none; background: none;" } = t('instructeurs.dossiers.header.banner.procedure_management') #procedure-management.fr-collapse.fr-menu.absolute %ul.fr-menu__list %li = link_to t('instructeurs.dossiers.header.banner.administrators_list'), administrateurs_instructeur_procedure_path(procedure), class: 'fr-nav__link' - %li - = link_to t('instructeurs.dossiers.header.banner.instructeurs'), instructeur_groupes_path(procedure), class: 'fr-nav__link' + - if procedure.instructeurs_self_management_enabled? + %li + = link_to t('instructeurs.dossiers.header.banner.instructeurs'), instructeur_groupes_path(procedure), class: 'fr-nav__link' + - elsif procedure.administrateurs.exists?(id: current_administrateur&.id) + %li + = link_to t('instructeurs.dossiers.header.banner.instructeurs'), admin_procedure_groupe_instructeurs_path(procedure), class: 'fr-nav__link' %li = link_to t('instructeurs.dossiers.header.banner.notification_management'), email_notifications_instructeur_procedure_path(procedure), class: 'fr-nav__link' %li @@ -25,7 +26,7 @@ %li = link_to t('views.instructeurs.dossiers.show_deleted_dossiers'), deleted_dossiers_instructeur_procedure_path(@procedure), class: 'fr-nav__link' - .fr-nav__item.relative + .fr-nav__item.relative{ class: ('section-active' if current_nav_section == 'user_support') } %button.account-btn.fr-translate__btn.fr-btn.fr-btn--tertiary.fr-btn--no-border.fr-text--md{ "aria-controls" => "user-support", "aria-expanded" => "false", style: "box-shadow: none; background: none;" } = t('instructeurs.dossiers.header.banner.user_support') #user-support.fr-collapse.fr-menu.absolute @@ -38,7 +39,7 @@ = link_to "#", class: "fr-nav__link fr-link fr-link--md fr-link--icon-left fr-icon-clipboard-line", data: {controller: "clipboard", clipboard_text_value: commencer_url(@procedure.path), action: "click->clipboard#copy" } do = t('instructeurs.dossiers.header.banner.copy_link_button') - .fr-nav__item.relative + .fr-nav__item.relative{ class: ('section-active' if current_nav_section == 'downloads') } %button.account-btn.fr-translate__btn.fr-btn.fr-btn--tertiary.fr-btn--no-border.fr-text--md{ "aria-controls" => "downloads", "aria-expanded" => "false", style: "box-shadow: none; background: none;" } = t('instructeurs.dossiers.header.banner.downloads') #downloads.fr-collapse.fr-menu.absolute @@ -49,6 +50,8 @@ = link_to t('instructeurs.dossiers.header.banner.archives'), instructeur_archives_path(procedure), class: 'fr-nav__link' %li = link_to t('instructeurs.dossiers.header.banner.exports_models'), exports_instructeur_procedure_path(procedure), class: 'fr-nav__link' + - if @has_export_notification + %span.notifications{ 'aria-label': t('instructeurs.dossiers.header.banner.exports_notification_label') } - -# #last-export-alert - -# = render partial: "last_export_alert", locals: { export: @last_export, statut: @statut } + #last-export-alert + = render partial: "instructeurs/procedures/last_export_alert", locals: { export: @last_export, statut: @statut }