chore(instructeurs): sections summary only on xl screens

This commit is contained in:
Colin Darie 2024-06-27 12:46:15 +02:00
parent 0d744a0eb7
commit d36d7b0d48
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
4 changed files with 21 additions and 18 deletions

View file

@ -1,16 +1,18 @@
class ViewableChamp::HeaderSectionsSummaryComponent < ApplicationComponent class ViewableChamp::HeaderSectionsSummaryComponent < ApplicationComponent
attr_reader :header_sections
def initialize(dossier:, is_private:) def initialize(dossier:, is_private:)
@dossier = dossier @dossier = dossier
@is_private = is_private @is_private = is_private
end
def header_sections @header_sections = @dossier.revision
@dossier.revision
.types_de_champ_for(scope: @is_private ? :private : :public) .types_de_champ_for(scope: @is_private ? :private : :public)
.filter(&:header_section?) .filter(&:header_section?)
.map { @dossier.project_champ(_1, nil) } # row_id not needed, do not link to repetiion header_sections .map { @dossier.project_champ(_1, nil) } # row_id not needed, do not link to repetiion header_sections
end end
def render? = header_sections.any?
def href(header_section) # used by viewable champs to anchor elements def href(header_section) # used by viewable champs to anchor elements
"##{header_section.input_group_id}" "##{header_section.input_group_id}"
end end

View file

@ -1,6 +1,5 @@
#summary{ class: header_sections.present? ? 'fr-col-12 fr-col-md-3' : '' } #summary.fr-col-12.fr-col-xl-3.fr-hidden.fr-unhidden-xl
- if header_sections.present? %nav.fr-sidemenu.sticky{ "aria-labelledby" => "fr-summary-title", role: "navigation" }
%nav.fr-sidemenu.sticky.fr-hidden.fr-unhidden-md{ "aria-labelledby" => "fr-summary-title", role: "navigation" }
%ul.fr-sidemenu__list %ul.fr-sidemenu__list
- header_sections.each do |header_section| - header_sections.each do |header_section|
%li.fr-sidemenu__item %li.fr-sidemenu__item

View file

@ -5,6 +5,7 @@
#dossier-annotations-privees #dossier-annotations-privees
.fr-container .fr-container
.fr-grid-row.fr-grid-row--center .fr-grid-row.fr-grid-row--center
= render ViewableChamp::HeaderSectionsSummaryComponent.new(dossier: @dossier, is_private: true) - summary = ViewableChamp::HeaderSectionsSummaryComponent.new(dossier: @dossier, is_private: true)
.fr-col-md-9 = render summary
%div{ class: class_names("fr-col-12", "fr-col-xl-9" => summary.render?, "fr-col-xl-8" => !summary.render?) }
= render partial: "shared/dossiers/edit_annotations", locals: { dossier: @dossier, seen_at: @annotations_privees_seen_at } = render partial: "shared/dossiers/edit_annotations", locals: { dossier: @dossier, seen_at: @annotations_privees_seen_at }

View file

@ -16,6 +16,7 @@
.fr-container .fr-container
.fr-grid-row.fr-grid-row--center .fr-grid-row.fr-grid-row--center
= render ViewableChamp::HeaderSectionsSummaryComponent.new(dossier: @dossier, is_private: false) - summary = ViewableChamp::HeaderSectionsSummaryComponent.new(dossier: @dossier, is_private: false)
.fr-col-md-9 = render summary
%div{ class: class_names("fr-col-12", "fr-col-xl-9" => summary.render?, "fr-col-xl-8" => !summary.render?) }
= render partial: "shared/dossiers/demande", locals: { dossier: @dossier, demande_seen_at: @demande_seen_at, profile: 'instructeur' } = render partial: "shared/dossiers/demande", locals: { dossier: @dossier, demande_seen_at: @demande_seen_at, profile: 'instructeur' }