views: make the "Voir l'attestation" UI simpler

Instead of adding a button, just turn the "attestation" text into a link
This commit is contained in:
Pierre de La Morinerie 2019-10-14 15:38:04 +02:00
parent 0064c2c610
commit 0e5f66c5ba
2 changed files with 5 additions and 6 deletions

View file

@ -8,7 +8,9 @@
= text_area :dossier, :motivation, class: 'motivation-text-area', placeholder: placeholder, required: false = text_area :dossier, :motivation, class: 'motivation-text-area', placeholder: placeholder, required: false
- if dossier.procedure.attestation_template&.activated? - if dossier.procedure.attestation_template&.activated?
%p.help %p.help
L'acceptation du dossier envoie automatiquement une attestation à l'usager. L'acceptation du dossier envoie automatiquement
= link_to 'une attestation', apercu_attestation_instructeur_dossier_path(dossier.procedure, dossier), target: '_blank', rel: 'noopener', title: "Voir l'attestation qui sera envoyée à l'usager"
à l'usager.
- unspecified_attestation_champs = dossier.unspecified_attestation_champs - unspecified_attestation_champs = dossier.unspecified_attestation_champs
- if unspecified_attestation_champs.present? - if unspecified_attestation_champs.present?
@ -34,7 +36,5 @@
.hidden{ id: "justificatif_motivation_import_#{popup_class}" } .hidden{ id: "justificatif_motivation_import_#{popup_class}" }
= file_field :dossier, :justificatif_motivation, direct_upload: true = file_field :dossier, :justificatif_motivation, direct_upload: true
.text-right .text-right
- if title == 'Accepter' && dossier.procedure.attestation_template&.activated?
= link_to "Voir l'attestation", apercu_attestation_instructeur_dossier_path(dossier.procedure, dossier), target: '_blank', rel: 'noopener', class: 'button', title: "Voir l'attestation qui sera envoyée au demandeur"
%span.button{ onclick: 'DS.motivationCancel();' } Annuler %span.button{ onclick: 'DS.motivationCancel();' } Annuler
= button_tag 'Valider la décision', name: :process_action, value: process_action, class: 'button primary', title: title, data: { confirm: confirm } = button_tag 'Valider la décision', name: :process_action, value: process_action, class: 'button primary', title: title, data: { confirm: confirm }

View file

@ -16,11 +16,10 @@ describe 'instructeurs/dossiers/state_button_motivation.html.haml', type: :view
context 'with an attestation preview' do context 'with an attestation preview' do
let(:dossier) { create :dossier, :accepte, :with_attestation } let(:dossier) { create :dossier, :accepte, :with_attestation }
it { expect(rendered).to have_text("Voir l'attestation") } it { expect(rendered).to have_link(href: apercu_attestation_instructeur_dossier_path(dossier.procedure, dossier)) }
end end
context 'without an attestation preview' do context 'without an attestation preview' do
it { expect(rendered).not_to have_text("envoie automatiquement une attestation") } it { expect(rendered).not_to have_link(href: apercu_attestation_instructeur_dossier_path(dossier.procedure, dossier)) }
it { expect(rendered).not_to have_text("Voir l'attestation") }
end end
end end