Merge pull request #9894 from demarches-simplifiees/add-nav-in-admin-form-creation

ETQ Admin, je veux un sommaire qui me pernet de naviguer de section en section
This commit is contained in:
Lisa Durand 2024-01-16 10:36:35 +00:00 committed by GitHub
commit 15e78e94f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 46 additions and 10 deletions

View file

@ -3,6 +3,7 @@
html,
body {
min-height: 100vh;
scroll-behavior: smooth;
}
.page-wrapper {

View file

@ -85,6 +85,11 @@
position: relative;
}
.sticky {
position: sticky;
top: 2em;
}
// display
.hidden {
display: none !important;

View file

@ -136,6 +136,11 @@ button.fr-tag-bug {
}
}
// on veut ajouter un gris plus clair dans le side_menu
.fr-sidemenu__item .fr-sidemenu__link.custom-link-grey {
color: var(--text-disabled-grey);
}
// on veut ferrer à droite le dropdown de sélecteur de langue
@media (min-width: 62em) {
.fr-nav__item.custom-fr-translate-flex-end {
@ -143,7 +148,6 @@ button.fr-tag-bug {
}
}
// improve readability in Windows High Contrast Mode
@media screen and (forced-colors: active) {
.fr-input,

View file

@ -16,6 +16,7 @@
width: 100%;
margin-bottom: $default-padding;
overflow: hidden;
scroll-margin: 1em;
.type-de-champ-container {
width: 100%;
@ -118,3 +119,8 @@
}
}
}
#summary nav ul {
height: 80vh;
overflow: auto;
}

View file

@ -1,6 +1,6 @@
.flex.justify-start.section{ id: dom_id(@tdc.stable_self, :condition) }
= form_tag admin_procedure_condition_path(@procedure_id, @tdc.stable_id), method: :patch, class: 'form width-100' do
.conditionnel.mt-2.width-100
= form_tag admin_procedure_condition_path(@procedure_id, @tdc.stable_id), method: :patch, class: 'form' do
.conditionnel.mt-2
.flex
%p
Logique conditionnelle
@ -9,7 +9,7 @@
= render Conditions::ConditionsErrorsComponent.new(conditions: condition_per_row, source_tdcs: @source_tdcs)
- if @condition.present?
%table.condition-table.mt-2.width-100
%table.condition-table.mt-2
%thead
%tr
%th.far-left

View file

@ -1,6 +1,5 @@
- c = TypesDeChampEditor::SelectChampTemplatePositionComponent.new(block: @block, coordinates: @coordinates)
%ul.types-de-champ-block{ id: block_id, data: { controller: 'select-champ-position-template', 'select-champ-position-template-template-id-value': c.block_id } }
%ul.fr-mt-0.types-de-champ-block{ id: block_id, data: { controller: 'select-champ-position-template', 'select-champ-position-template-template-id-value': c.block_id } }
- @coordinates.each do |coordinate|
= render TypesDeChampEditor::ChampComponent.new(coordinate:, upper_coordinates: coordinate.upper_coordinates)
%li.hidden= render c

View file

@ -1,4 +1,4 @@
.fr-container.fr-pb-12w{ 'data-turbo': 'true', id: dom_id(@revision, :types_de_champ_editor) }
.fr-pb-12w{ 'data-turbo': 'true', id: dom_id(@revision, :types_de_champ_editor) }
.types-de-champ-editor.editor-root
= render TypesDeChampEditor::ErrorsSummary.new(revision: @revision)
= render TypesDeChampEditor::BlockComponent.new(block: @revision, coordinates: coordinates)

View file

@ -967,6 +967,10 @@ class Procedure < ApplicationRecord
lien_dpo.present? && lien_dpo.match?(/@/)
end
def header_sections
draft_revision.revision_types_de_champ_public.filter { _1.type_de_champ.header_section? }
end
private
def pieces_jointes_list

View file

@ -0,0 +1,11 @@
#summary{ class: @procedure.header_sections.present? ? 'fr-col-12 fr-col-md-3' : '' }
- if @procedure.header_sections.present?
%nav.fr-sidemenu.sticky.fr-hidden.fr-unhidden-md{ "aria-labelledby" => "fr-summary-title", role: "navigation" }
%ul.fr-sidemenu__list
- @procedure.header_sections.each do |header|
%li.fr-sidemenu__item
- level = header.type_de_champ.header_section_level_value.to_i
- if level == 1
%a.fr-sidemenu__link{ href: "##{dom_id(header, :type_de_champ_editor)}" }= header.libelle
- else
%a.fr-sidemenu__link{ class: level >= 3 ? 'custom-link-grey': '', href: "##{dom_id(header, :type_de_champ_editor)}" }= "-- #{header.libelle}"

View file

@ -5,9 +5,10 @@
.fr-container
%h1 Configuration des annotations privées
%br
= render NestedForms::FormOwnerComponent.new
= render TypesDeChampEditor::EditorComponent.new(revision: @procedure.draft_revision, is_annotation: true)
.fr-grid-row
.fr-col
= render TypesDeChampEditor::EditorComponent.new(revision: @procedure.draft_revision, is_annotation: true)
.padded-fixed-footer
.fixed-footer

View file

@ -6,7 +6,10 @@
.fr-container
%h1 Configuration des champs
= render NestedForms::FormOwnerComponent.new
= render TypesDeChampEditor::EditorComponent.new(revision: @procedure.draft_revision)
.fr-grid-row
= render partial: 'champs_summary'
.fr-col
= render TypesDeChampEditor::EditorComponent.new(revision: @procedure.draft_revision)
.padded-fixed-footer
.fixed-footer

View file

@ -14,6 +14,8 @@
= turbo_stream.replace 'errors-summary', render(TypesDeChampEditor::ErrorsSummary.new(revision: @procedure.draft_revision))
= turbo_stream.replace 'summary', render(partial: 'administrateurs/procedures/champs_summary')
- unless flash.alert
= turbo_stream.show 'autosave-notice'
= turbo_stream.replace 'autosave-notice', render(partial: 'administrateurs/autosave_notice')