From 2f6772c879e3d6ebe5f803e96493e1c689510703 Mon Sep 17 00:00:00 2001 From: mfo Date: Fri, 21 Jun 2024 15:31:29 +0200 Subject: [PATCH] tech(review): add missing sticky behaviour to summary for instructeur Co-Authored-By: LeSim --- .../header_sections_summary_component.rb | 10 +++++++--- .../header_sections_summary_component.html.haml | 2 +- .../dossiers/annotations_privees.html.haml | 2 +- app/views/instructeurs/dossiers/show.html.haml | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/components/types_de_champ_editor/header_sections_summary_component.rb b/app/components/types_de_champ_editor/header_sections_summary_component.rb index 7f3db3a75..da13f203b 100644 --- a/app/components/types_de_champ_editor/header_sections_summary_component.rb +++ b/app/components/types_de_champ_editor/header_sections_summary_component.rb @@ -5,9 +5,13 @@ class TypesDeChampEditor::HeaderSectionsSummaryComponent < ApplicationComponent end def header_sections - @procedure.draft_revision - .send(@is_private ? :revision_types_de_champ_private : :revision_types_de_champ_public) - .filter { _1.type_de_champ.header_section? } + coordinates = if @is_private + @procedure.draft_revision.revision_types_de_champ_private + else + @procedure.draft_revision.revision_types_de_champ_public + end + + coordinates.filter { _1.type_de_champ.header_section? } end def href(header_section) # used by type de champ editor to anchor elements diff --git a/app/components/viewable_champ/header_sections_summary_component/header_sections_summary_component.html.haml b/app/components/viewable_champ/header_sections_summary_component/header_sections_summary_component.html.haml index d5578eff4..ba7d04a42 100644 --- a/app/components/viewable_champ/header_sections_summary_component/header_sections_summary_component.html.haml +++ b/app/components/viewable_champ/header_sections_summary_component/header_sections_summary_component.html.haml @@ -1,4 +1,4 @@ -#summary +#summary{ class: header_sections.present? ? 'fr-col-12 fr-col-md-3' : '' } - if header_sections.present? %nav.fr-sidemenu.sticky.fr-hidden.fr-unhidden-md{ "aria-labelledby" => "fr-summary-title", role: "navigation" } %ul.fr-sidemenu__list diff --git a/app/views/instructeurs/dossiers/annotations_privees.html.haml b/app/views/instructeurs/dossiers/annotations_privees.html.haml index 2d5a9a711..c10ded4d9 100644 --- a/app/views/instructeurs/dossiers/annotations_privees.html.haml +++ b/app/views/instructeurs/dossiers/annotations_privees.html.haml @@ -5,6 +5,6 @@ #dossier-annotations-privees .fr-container .fr-grid-row.fr-grid-row--center - .fr-col-md-3= render ViewableChamp::HeaderSectionsSummaryComponent.new(dossier: @dossier, is_private: true) + = render ViewableChamp::HeaderSectionsSummaryComponent.new(dossier: @dossier, is_private: true) .fr-col-md-9 = render partial: "shared/dossiers/edit_annotations", locals: { dossier: @dossier, seen_at: @annotations_privees_seen_at } diff --git a/app/views/instructeurs/dossiers/show.html.haml b/app/views/instructeurs/dossiers/show.html.haml index 5e733aaf7..45650667f 100644 --- a/app/views/instructeurs/dossiers/show.html.haml +++ b/app/views/instructeurs/dossiers/show.html.haml @@ -16,6 +16,6 @@ .fr-container .fr-grid-row.fr-grid-row--center - .fr-col-md-3= render ViewableChamp::HeaderSectionsSummaryComponent.new(dossier: @dossier, is_private: false) + = render ViewableChamp::HeaderSectionsSummaryComponent.new(dossier: @dossier, is_private: false) .fr-col-md-9 = render partial: "shared/dossiers/demande", locals: { dossier: @dossier, demande_seen_at: @demande_seen_at, profile: 'instructeur' }