controllers: use template:
rather than file:
to render PDFs
ActionView now throws an error if a relative path is used with `file:`.
This commit is contained in:
parent
185c74d891
commit
3f3d6ae399
5 changed files with 6 additions and 6 deletions
|
@ -3,7 +3,7 @@ class API::V2::DossiersController < API::V2::BaseController
|
||||||
|
|
||||||
def pdf
|
def pdf
|
||||||
@include_infos_administration = true
|
@include_infos_administration = true
|
||||||
render(file: 'dossiers/show', formats: [:pdf])
|
render(template: 'dossiers/show', formats: [:pdf])
|
||||||
end
|
end
|
||||||
|
|
||||||
def geojson
|
def geojson
|
||||||
|
|
|
@ -42,7 +42,7 @@ module Instructeurs
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.pdf do
|
format.pdf do
|
||||||
@include_infos_administration = true
|
@include_infos_administration = true
|
||||||
render(file: 'dossiers/show', formats: [:pdf])
|
render(template: 'dossiers/show', formats: [:pdf])
|
||||||
end
|
end
|
||||||
format.all
|
format.all
|
||||||
end
|
end
|
||||||
|
@ -235,7 +235,7 @@ module Instructeurs
|
||||||
|
|
||||||
def generate_pdf_for_instructeur_export
|
def generate_pdf_for_instructeur_export
|
||||||
@include_infos_administration = true
|
@include_infos_administration = true
|
||||||
pdf = render_to_string(file: 'dossiers/show', formats: [:pdf])
|
pdf = render_to_string(template: 'dossiers/show', formats: [:pdf])
|
||||||
dossier.pdf_export_for_instructeur.attach(io: StringIO.open(pdf), filename: "export-#{dossier.id}.pdf", content_type: 'application/pdf')
|
dossier.pdf_export_for_instructeur.attach(io: StringIO.open(pdf), filename: "export-#{dossier.id}.pdf", content_type: 'application/pdf')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ module Users
|
||||||
|
|
||||||
def generate_empty_pdf(procedure)
|
def generate_empty_pdf(procedure)
|
||||||
@dossier = procedure.new_dossier
|
@dossier = procedure.new_dossier
|
||||||
s = render_to_string(file: 'dossiers/dossier_vide', formats: [:pdf])
|
s = render_to_string(template: 'dossiers/dossier_vide', formats: [:pdf])
|
||||||
send_data(s, :filename => "#{procedure.libelle}.pdf")
|
send_data(s, :filename => "#{procedure.libelle}.pdf")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,7 +32,7 @@ module Users
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.pdf do
|
format.pdf do
|
||||||
@include_infos_administration = false
|
@include_infos_administration = false
|
||||||
render(file: 'dossiers/show', formats: [:pdf])
|
render(template: 'dossiers/show', formats: [:pdf])
|
||||||
end
|
end
|
||||||
format.all
|
format.all
|
||||||
end
|
end
|
||||||
|
|
|
@ -121,7 +121,7 @@ class AttestationTemplate < ApplicationRecord
|
||||||
def build_pdf(dossier)
|
def build_pdf(dossier)
|
||||||
attestation = render_attributes_for(dossier: dossier)
|
attestation = render_attributes_for(dossier: dossier)
|
||||||
attestation_view = ApplicationController.render(
|
attestation_view = ApplicationController.render(
|
||||||
file: 'new_administrateur/attestation_templates/show',
|
template: 'new_administrateur/attestation_templates/show',
|
||||||
formats: :pdf,
|
formats: :pdf,
|
||||||
assigns: { attestation: attestation }
|
assigns: { attestation: attestation }
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue