[Instructeur] Improve attestation preview (#4404)

Instructeur : la prévisualisation de l'attestation est plus simple
This commit is contained in:
Pierre de La Morinerie 2019-10-15 12:48:06 +02:00 committed by GitHub
commit e3d61a8303
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -6,8 +6,11 @@
= form_tag(terminer_instructeur_dossier_path(dossier.procedure, dossier), remote: true, method: :post, class: 'form') do = form_tag(terminer_instructeur_dossier_path(dossier.procedure, dossier), remote: true, method: :post, class: 'form') do
- if title == 'Accepter' - if title == 'Accepter'
= text_area :dossier, :motivation, class: 'motivation-text-area', placeholder: placeholder, required: false = text_area :dossier, :motivation, class: 'motivation-text-area', placeholder: placeholder, required: false
%p.help - if dossier.procedure.attestation_template&.activated?
L'acceptation du dossier envoie automatiquement une attestation à l'usager. %p.help
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?
@ -33,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,10 +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("Voir l'attestation") } it { expect(rendered).not_to have_link(href: apercu_attestation_instructeur_dossier_path(dossier.procedure, dossier)) }
end end
end end