refactor(admin): improve links & message of PublicationWarningComponent
This commit is contained in:
parent
60abc6ea6e
commit
eb42ea9a2d
3 changed files with 10 additions and 3 deletions
|
@ -3,6 +3,12 @@ class Procedure::PublicationWarningComponent < ApplicationComponent
|
||||||
@procedure = procedure
|
@procedure = procedure
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def title
|
||||||
|
return "Des problèmes empêchent la publication des modifications" if @procedure.publiee?
|
||||||
|
|
||||||
|
"Des problèmes empêchent la publication de la démarche"
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def render?
|
def render?
|
||||||
|
@ -26,7 +32,8 @@ class Procedure::PublicationWarningComponent < ApplicationComponent
|
||||||
when :attestation_template
|
when :attestation_template
|
||||||
edit_admin_procedure_attestation_template_path(@procedure)
|
edit_admin_procedure_attestation_template_path(@procedure)
|
||||||
when :initiated_mail, :received_mail, :closed_mail, :refused_mail, :without_continuation_mail, :re_instructed_mail
|
when :initiated_mail, :received_mail, :closed_mail, :refused_mail, :without_continuation_mail, :re_instructed_mail
|
||||||
admin_procedure_mail_templates_path(@procedure)
|
klass = "Mails::#{attribute.to_s.classify}".constantize
|
||||||
|
edit_admin_procedure_mail_template_path(@procedure, klass.const_get(:SLUG))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
= render Dsfr::AlertComponent.new(state: :warning, title: "Des problèmes empêchent la publication de la démarche") do |c|
|
= render Dsfr::AlertComponent.new(state: :warning, title:) do |c|
|
||||||
- c.body do
|
- c.body do
|
||||||
- error_messages.each do |(messages, path)|
|
- error_messages.each do |(messages, path)|
|
||||||
%p.mt-2
|
%p.mt-2
|
||||||
|
|
|
@ -168,7 +168,7 @@ describe 'Publishing a procedure', js: true do
|
||||||
|
|
||||||
scenario 'an error message prevents the publication' do
|
scenario 'an error message prevents the publication' do
|
||||||
visit admin_procedure_path(procedure)
|
visit admin_procedure_path(procedure)
|
||||||
expect(page).to have_content('Des problèmes empêchent la publication de la démarche')
|
expect(page).to have_content('Des problèmes empêchent la publication des modifications')
|
||||||
expect(page).to have_link('corriger', href: edit_admin_procedure_mail_template_path(procedure, Mails::InitiatedMail::SLUG))
|
expect(page).to have_link('corriger', href: edit_admin_procedure_mail_template_path(procedure, Mails::InitiatedMail::SLUG))
|
||||||
expect(page).to have_button('Publier les modifications', disabled: true)
|
expect(page).to have_button('Publier les modifications', disabled: true)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue