fix(dossier): fix links to empty pdf templates
This commit is contained in:
parent
a96e12490a
commit
886a409abf
6 changed files with 8 additions and 11 deletions
|
@ -27,7 +27,7 @@ module Users
|
|||
|
||||
def dossier_vide_pdf_test
|
||||
@procedure = retrieve_procedure_with_closed
|
||||
return procedure_not_found if @procedure.blank? || (@procedure.publiee? && !@procedure.draft_changed?)
|
||||
return procedure_not_found if @procedure.blank?
|
||||
|
||||
generate_empty_pdf(@procedure.draft_revision)
|
||||
end
|
||||
|
|
|
@ -29,6 +29,10 @@ module DossierHelper
|
|||
new_dossier_url(procedure_id: revision.procedure.id, brouillon: revision.draft? ? true : nil)
|
||||
end
|
||||
|
||||
def commencer_dossier_vide_for_revision_path(revision)
|
||||
revision.draft? ? commencer_dossier_vide_test_path(path: revision.procedure.path) : commencer_dossier_vide_path(path: revision.procedure.path)
|
||||
end
|
||||
|
||||
def dossier_submission_is_closed?(dossier)
|
||||
dossier.brouillon? && dossier.procedure.close?
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
%span.icon.download
|
||||
Télécharger
|
||||
|
||||
= link_to @procedure.active_revision.draft? ? commencer_dossier_vide_test_path(path: @procedure.path) : commencer_dossier_vide_path(path: @procedure.path), target: "_blank", rel: "noopener", class: 'button', id: "pdf-procedure" do
|
||||
= link_to commencer_dossier_vide_for_revision_path(@procedure.active_revision), target: "_blank", rel: "noopener", class: 'button', id: "pdf-procedure" do
|
||||
%span.icon.printer
|
||||
PDF
|
||||
|
||||
|
|
|
@ -41,9 +41,8 @@
|
|||
= link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: "fr-btn fr-btn--lg fr-btn--secondary fr-my-2w"
|
||||
|
||||
- if @procedure.feature_enabled?(:dossier_pdf_vide)
|
||||
- pdf_link = @revision.draft? ? commencer_dossier_vide_test_path(path: @procedure.path) : commencer_dossier_vide_path(path: @procedure.path)
|
||||
%hr
|
||||
%p= t('views.commencer.show.want_empty_pdf', service: @procedure&.service&.nom, adresse: @procedure&.service&.adresse)
|
||||
|
||||
%br
|
||||
= link_to t('views.commencer.show.download_empty_pdf'), pdf_link, class: "fr-btn fr-btn--lg fr-btn--secondary fr-my-2w"
|
||||
= link_to t('views.commencer.show.download_empty_pdf'), commencer_dossier_vide_for_revision_path(@revision), class: "fr-btn fr-btn--lg fr-btn--secondary fr-my-2w"
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
%h3.fr-footer__top-cat= I18n.t('users.procedure_footer.dematerialisation.header')
|
||||
%ul.fr-footer__top-list
|
||||
%li
|
||||
= link_to t('users.procedure_footer.dematerialisation.title_1'), commencer_dossier_vide_path(path: procedure.path), rel: 'noopener', class: 'fr-footer__top-link'
|
||||
= link_to t('users.procedure_footer.dematerialisation.title_1'), commencer_dossier_vide_for_revision_path(procedure.active_revision), rel: 'noopener', class: 'fr-footer__top-link'
|
||||
%li
|
||||
= link_to t('users.procedure_footer.dematerialisation.title_2'),t('users.procedure_footer.dematerialisation.link'), rel: 'noopener', class: 'fr-footer__top-link'
|
||||
|
||||
|
|
|
@ -234,11 +234,5 @@ describe Users::CommencerController, type: :controller do
|
|||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
context 'published procedure' do
|
||||
let(:procedure) { create(:procedure, :published, :with_service, :with_path) }
|
||||
it 'redirect to procedure not found' do
|
||||
expect(response).to have_http_status(302)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue