feat(Administrateurs::Procedure::Service#edit): update UI with new warning as well as DSFR ui
feat(Administrateur::Procedure::Service#edit): add warning message a la DSFR
This commit is contained in:
parent
1bdbf2a7d7
commit
17d8c7a371
3 changed files with 42 additions and 1 deletions
24
app/components/dsfr/alert_component.rb
Normal file
24
app/components/dsfr/alert_component.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
# see: https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/alerte
|
||||
class Dsfr::AlertComponent < ApplicationComponent
|
||||
renders_one :body
|
||||
|
||||
def prefix_for_state
|
||||
case state
|
||||
when :error then "Erreur : "
|
||||
when :info then "Information : "
|
||||
when :warning then "Attention : "
|
||||
when :success then ""
|
||||
else ""
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def initialize(state:, title:)
|
||||
@state = state
|
||||
@title = title
|
||||
@block = block
|
||||
end
|
||||
|
||||
attr_reader :state, :title, :block
|
||||
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
%div{ class: "fr-alert fr-alert--#{state}" }
|
||||
%h3.fr-alert__title= "#{prefix_for_state}#{title}"
|
||||
= body
|
|
@ -4,8 +4,22 @@
|
|||
link_to('Choix du service', admin_services_path(procedure_id: @procedure.id)),
|
||||
'Modifier le service'] }
|
||||
|
||||
|
||||
.container
|
||||
%h1 Modifier le service
|
||||
|
||||
- if @procedure.service.procedures.count.positive?
|
||||
= render Dsfr::AlertComponent.new(state: :warning, title: "Modifier un service impactera la ou les démarches qui sont rattachée/s") do |c|
|
||||
- c.body do
|
||||
%ul
|
||||
- @service.procedures.each do |proc|
|
||||
%li= "#{proc.libelle} (N° #{proc.id})"
|
||||
%p.mt-3 Si vous souhaitez modifier uniquement les informations pour ce service, créez un nouveau service puis associez-le à la démarche
|
||||
|
||||
%p.mt-3
|
||||
= link_to "+ Nouveau service", new_admin_service_path(procedure_id: @procedure.id), class: "fr-btn"
|
||||
|
||||
|
||||
%h1.mt-2 Modifier le service
|
||||
|
||||
= render partial: 'form',
|
||||
locals: { service: @service, procedure_id: @procedure.id }
|
||||
|
|
Loading…
Add table
Reference in a new issue