attestation_template v2: add weasyprint integration
This commit is contained in:
parent
e4a48f1270
commit
791954af1b
3 changed files with 19 additions and 1 deletions
|
@ -6,7 +6,21 @@ module Administrateurs
|
|||
json_body = @attestation_template.json_body&.deep_symbolize_keys
|
||||
@body = TiptapService.to_html(json_body, {})
|
||||
|
||||
render layout: 'attestation'
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
render layout: 'attestation'
|
||||
end
|
||||
|
||||
format.pdf do
|
||||
html = render_to_string('/administrateurs/attestation_template_v2s/show', layout: 'attestation', formats: [:html])
|
||||
|
||||
result = Typhoeus.post(WEASYPRINT_URL,
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body: { html: html }.to_json)
|
||||
|
||||
send_data(result.body, filename: 'attestation.pdf', type: 'application/pdf', disposition: 'inline')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
|
|
|
@ -250,3 +250,6 @@ ADMINS_GROUP_ENABLED="disabled"
|
|||
# Do you want to isolate bulk email (notifications) from transactional ones (ex: reset password).
|
||||
# BULK_EMAIL_QUEUE will host bulk email (notifications)
|
||||
BULK_EMAIL_QUEUE="low_priority"
|
||||
|
||||
# work in progress about attestation_v2
|
||||
WEASYPRINT_URL="http://10.33.23.204:5000/pdf"
|
||||
|
|
|
@ -14,6 +14,7 @@ SENDINBLUE_API_V3_URL = ENV.fetch("SENDINBLUE_API_V3_URL", "https://api.sendinbl
|
|||
UNIVERSIGN_API_URL = ENV.fetch("UNIVERSIGN_API_URL", "https://ws.universign.eu/tsa/post/")
|
||||
CERTIGNA_API_URL = ENV.fetch("CERTIGNA_API_URL", "https://timestamp.dhimyotis.com/api/v1/")
|
||||
FEATURE_UPVOTE_URL = ENV.fetch("FEATURE_UPVOTE_URL", "https://demarches-simplifiees.featureupvote.com")
|
||||
WEASYPRINT_URL = ENV.fetch("WEASYPRINT_URL", nil)
|
||||
|
||||
# Internal URLs
|
||||
FOG_OPENSTACK_URL = ENV.fetch("FOG_OPENSTACK_URL", "https://auth.cloud.ovh.net")
|
||||
|
|
Loading…
Add table
Reference in a new issue