create component for footer

This commit is contained in:
Lisa Durand 2024-05-27 17:56:05 +02:00
parent 123a038c19
commit 2659d0f966
17 changed files with 49 additions and 97 deletions

View file

@ -0,0 +1,10 @@
class Procedure::FixedFooterComponent < ApplicationComponent
def initialize(procedure:, form: nil, is_form_disabled: nil, extra_class_names: nil)
@procedure = procedure
@form = form
@is_form_disabled = is_form_disabled
@extra_class_names = extra_class_names
end
attr_reader :form, :is_form_disabled, :extra_class_names
end

View file

@ -0,0 +1,4 @@
fr:
back: Revenir à l'écran de gestion
submit: Enregistrer
cancel: Annuler et revenir à l'écran de gestion

View file

@ -0,0 +1,20 @@
- if form
.padded-fixed-footer
.fixed-footer
.fr-container
.fr-grid-row
%div{ class: "fr-col-12 #{extra_class_names}" }
%ul.fr-btns-group.fr-btns-group--inline-md
%li
= link_to t('.cancel'), admin_procedure_path(id: @procedure), class: 'fr-btn fr-btn--secondary', data: { confirm: 'Si vous avez fait des modifications elles ne seront pas sauvegardées.'}
%li
= form.submit t(".submit"), class: "fr-btn", disabled: is_form_disabled
- else
.padded-fixed-footer
.fixed-footer
.fr-container
.fr-grid-row
%div{ class: "fr-col-12 fr-pb-2w #{extra_class_names}" }
= link_to admin_procedure_path(id: @procedure), class: 'fr-link fr-icon-arrow-left-line fr-link--icon-left fr-mb-2w' do
= t('.back')

View file

@ -11,8 +11,5 @@
available_instructeur_emails: @available_instructeur_emails,
disabled_as_super_admin: @disabled_as_super_admin }
.padded-fixed-footer
.fixed-footer.fr-pb-2w
.fr-container
= link_to admin_procedure_path(id: @procedure), class: 'fr-link fr-icon-arrow-left-line fr-link--icon-left' do
Revenir à l'écran de gestion
= render Procedure::FixedFooterComponent.new(procedure: @procedure)

View file

@ -37,11 +37,4 @@
= render Dsfr::RadioButtonListComponent.new(form: f, target: :resume, buttons: resume_buttons)
.padded-fixed-footer
.fixed-footer
.fr-container
%ul.fr-btns-group.fr-btns-group--inline-md
%li
= link_to "Annuler et revenir à l'écran de gestion", admin_procedure_path(id: @procedure), class: 'fr-btn fr-btn--secondary', data: { confirm: 'Êtes-vous sûr de vouloir annuler les modifications effectuées ?'}
%li
= f.submit t(".submit"), class: "fr-btn", disabled: form_disabled?
= render Procedure::FixedFooterComponent.new(procedure: @procedure, form: f, is_form_disabled: form_disabled?)

View file

@ -30,11 +30,4 @@
.procedure-preview
= render partial: 'users/dossiers/merci', locals: { procedure: @procedure, dossier: nil}
.padded-fixed-footer
.fixed-footer
.fr-container
%ul.fr-btns-group.fr-btns-group--inline-md
%li
= link_to "Annuler et revenir à l'écran de gestion", admin_procedure_path(id: @procedure), class: 'fr-btn fr-btn--secondary', data: { confirm: 'Êtes-vous sûr de vouloir annuler les modifications effectuées ?'}
%li
= f.button 'Enregistrer', class: 'fr-btn'
= render Procedure::FixedFooterComponent.new(procedure: @procedure, form: f)

View file

@ -108,8 +108,4 @@
%h2.empty-text Aucun expert invité pour le moment.
%p.empty-text-details Les instructeurs de cette démarche nont pas encore fait appel aux experts.
.padded-fixed-footer
.fixed-footer.fr-pb-2w
.fr-container
= link_to admin_procedure_path(id: @procedure), class: 'fr-link fr-icon-arrow-left-line fr-link--icon-left' do
Revenir à l'écran de gestion
= render Procedure::FixedFooterComponent.new(procedure: @procedure)

View file

@ -18,10 +18,4 @@
= render Procedure::EmailTemplateCardComponent.new(email_template: mail_template)
.padded-fixed-footer
.fixed-footer
.fr-container
.fr-grid-row
.fr-col-12.fr-pb-2w
= link_to admin_procedure_path(id: @procedure), class: 'fr-link fr-icon-arrow-left-line fr-link--icon-left fr-mb-2w' do
Revenir à la démarche
= render Procedure::FixedFooterComponent.new(procedure: @procedure)

View file

@ -20,8 +20,4 @@
%tbody#administrateurs
= render(Procedure::ProcedureAdministrateurs::AdministrateurComponent.with_collection(@procedure.administrateurs.order('users.email'), procedure: @procedure))
.padded-fixed-footer
.fixed-footer.fr-pb-2w
.fr-container
= link_to admin_procedure_path(id: @procedure), class: 'fr-link fr-icon-arrow-left-line fr-link--icon-left' do
Revenir à l'écran de gestion
= render Procedure::FixedFooterComponent.new(procedure: @procedure)

View file

@ -33,10 +33,4 @@
hint: "Laccusé de lecture est à activer uniquement pour les démarches avec voies de recours car il complexifie laccès à la décision finale pour les usagers",
opt: {"checked" => @procedure.accuse_lecture})
.padded-fixed-footer
.fixed-footer
.fr-container
.fr-grid-row
.fr-col-12.fr-col-offset-md-2.fr-col-md-8.fr-pb-2w
= link_to admin_procedure_path(id: @procedure), class: 'fr-link fr-icon-arrow-left-line fr-link--icon-left fr-mb-2w' do
Revenir à l'écran de gestion
= render Procedure::FixedFooterComponent.new(procedure: @procedure, extra_class_names: 'fr-col-offset-md-2 fr-col-md-8' )

View file

@ -16,13 +16,4 @@
= render partial: 'administrateurs/procedures/informations', locals: { f: f }
.padded-fixed-footer
.fixed-footer
.fr-container
.fr-grid-row
.fr-col-12.fr-col-offset-md-2.fr-col-md-8
%ul.fr-btns-group.fr-btns-group--inline-md
%li
= link_to "Annuler et revenir à l'écran de gestion", admin_procedure_path(id: @procedure), class: 'fr-btn fr-btn--secondary', data: { confirm: 'Êtes-vous sûr de vouloir annuler les modifications effectuées ?'}
%li
= f.button 'Enregistrer', class: 'fr-btn'
= render Procedure::FixedFooterComponent.new(procedure: @procedure, form: f, extra_class_names: 'fr-col-offset-md-2 fr-col-md-8')

View file

@ -22,11 +22,4 @@
= f.label :api_entreprise_token, "Jeton", class: 'fr-label'
= f.password_field :api_entreprise_token, value: @procedure.read_attribute(:api_entreprise_token), class: 'fr-input'
.padded-fixed-footer
.fixed-footer
.fr-container
%ul.fr-btns-group.fr-btns-group--inline-md
%li
= link_to "Annuler et revenir à l'écran de gestion", admin_procedure_path(id: @procedure), class: 'fr-btn fr-btn--secondary', data: { confirm: 'Êtes-vous sûr de vouloir annuler les modifications effectuées ?'}
%li
= f.button 'Enregistrer', class: 'fr-btn'
= render Procedure::FixedFooterComponent.new(procedure: @procedure, form: f)

View file

@ -31,8 +31,4 @@
= render Procedure::RevisionChangesComponent.new changes:, previous_revision:
- previous_revision = revision
.padded-fixed-footer
.fixed-footer.fr-pb-2w
.fr-container
= link_to admin_procedure_path(id: @procedure), class: 'fr-link fr-icon-arrow-left-line fr-link--icon-left' do
Revenir à l'écran de gestion
= render Procedure::FixedFooterComponent.new(procedure: @procedure)

View file

@ -11,11 +11,4 @@
.fr-container
= render partial: 'monavis', locals: { f: f }
.padded-fixed-footer
.fixed-footer
.fr-container
%ul.fr-btns-group.fr-btns-group--inline-md
%li
= link_to "Annuler et revenir à l'écran de gestion", admin_procedure_path(id: @procedure), class: 'fr-btn fr-btn--secondary', data: { confirm: 'Êtes-vous sûr de vouloir annuler les modifications effectuées ?'}
%li
= f.button 'Enregistrer', class: 'fr-btn'
= render Procedure::FixedFooterComponent.new(procedure: @procedure, form: f)

View file

@ -25,11 +25,4 @@
= b.check_box
= b.label class: "fr-label"
.padded-fixed-footer
.fixed-footer
.fr-container
%ul.fr-btns-group.fr-btns-group--inline-md
%li
= link_to "Annuler et revenir à l'écran de gestion", admin_procedure_path(id: @procedure), class: 'fr-btn fr-btn--secondary', data: { confirm: 'Êtes-vous sûr de vouloir annuler les modifications effectuées ?'}
%li
= f.button 'Enregistrer', class: 'fr-btn'
= render Procedure::FixedFooterComponent.new(procedure: @procedure, form: f)

View file

@ -34,11 +34,4 @@
- if procedure_id.present?
= hidden_field_tag :procedure_id, procedure_id
.padded-fixed-footer
.fixed-footer
.fr-container
%ul.fr-btns-group.fr-btns-group--inline-md
%li
= link_to "Annuler et revenir à l'écran de gestion", admin_procedure_path(id: @procedure.id), class: "fr-btn fr-btn--secondary"
%li
= f.submit "Enregistrer", class: "fr-btn"
= render Procedure::FixedFooterComponent.new(procedure: @procedure, form: f)

View file

@ -34,8 +34,4 @@
data: { confirm: "Confirmez vous la suppression de #{service.nom}" },
class: 'btn btn-link ml-2'
.padded-fixed-footer
.fixed-footer.fr-pb-2w
.fr-container
= link_to admin_procedure_path(id: @procedure), class: 'fr-link fr-icon-arrow-left-line fr-link--icon-left' do
Revenir à l'écran de gestion
= render Procedure::FixedFooterComponent.new(procedure: @procedure)