generation d'un fichier pdf bien nommé
La route ne contient pas '.pdf' dans l'url, mais le controller génère un fichier pdf du nom de la procédure et lance le téléchargement immédiatement
This commit is contained in:
parent
76488ec758
commit
debc6628d8
2 changed files with 10 additions and 6 deletions
|
@ -20,16 +20,14 @@ module Users
|
|||
@procedure = retrieve_procedure
|
||||
return procedure_not_found if @procedure.blank? || @procedure.brouillon?
|
||||
|
||||
@dossier = @procedure.new_dossier
|
||||
render(file: 'dossiers/dossier_vide', formats: [:pdf])
|
||||
generate_empty_pdf(@procedure)
|
||||
end
|
||||
|
||||
def dossier_vide_pdf_test
|
||||
@procedure = retrieve_procedure
|
||||
return procedure_not_found if @procedure.blank? || @procedure.publiee?
|
||||
|
||||
@dossier = @procedure.new_dossier
|
||||
render(file: 'dossiers/dossier_vide', formats: [:pdf])
|
||||
generate_empty_pdf(@procedure)
|
||||
end
|
||||
|
||||
def sign_in
|
||||
|
@ -81,5 +79,11 @@ module Users
|
|||
def store_user_location!(procedure)
|
||||
store_location_for(:user, helpers.procedure_lien(procedure))
|
||||
end
|
||||
|
||||
def generate_empty_pdf(procedure)
|
||||
@dossier = procedure.new_dossier
|
||||
s = render_to_string(file: 'dossiers/dossier_vide', formats: [:pdf])
|
||||
send_data(s, :filename => "#{procedure.libelle}.pdf")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -42,9 +42,9 @@
|
|||
= link_to 'Commencer un nouveau dossier', url_for_new_dossier(@procedure), class: ['button large expand']
|
||||
|
||||
- if feature_enabled_for?(:dossier_pdf_vide, @procedure)
|
||||
- pdf_link = commencer_dossier_vide_path(path: @procedure.path, format: :pdf)
|
||||
- pdf_link = commencer_dossier_vide_path(path: @procedure.path)
|
||||
- if @procedure.brouillon?
|
||||
- pdf_link = commencer_dossier_vide_test_path(path: @procedure.path, format: :pdf)
|
||||
- pdf_link = commencer_dossier_vide_test_path(path: @procedure.path)
|
||||
%hr
|
||||
%p
|
||||
Vous souhaitez effectuer une demande par papier ? Vous pouvez télécharger un dossier vide au format PDF,
|
||||
|
|
Loading…
Reference in a new issue