From a74522ae6b58922996e2c7226cd1e915f19a0db4 Mon Sep 17 00:00:00 2001 From: mfo Date: Fri, 3 Jan 2025 15:15:11 +0100 Subject: [PATCH] fix(attestation.v2): ensure to fwd attestation signature while building pdf --- app/models/attestation_template.rb | 6 ++++-- .../administrateurs/attestation_template_v2s/show.html.haml | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/attestation_template.rb b/app/models/attestation_template.rb index 82207cb23..ccb9cd625 100644 --- a/app/models/attestation_template.rb +++ b/app/models/attestation_template.rb @@ -213,13 +213,15 @@ class AttestationTemplate < ApplicationRecord end def build_v2_pdf(dossier) - body = render_attributes_for(dossier:).fetch(:body) + attributes = render_attributes_for(dossier:) + body = attributes.fetch(:body) + signature = attributes.fetch(:signature) html = ApplicationController.render( template: '/administrateurs/attestation_template_v2s/show', formats: [:html], layout: 'attestation', - assigns: { attestation_template: self, body: body } + assigns: { attestation_template: self, body:, signature: } ) WeasyprintService.generate_pdf(html, { procedure_id: procedure.id, dossier_id: dossier.id }) diff --git a/app/views/administrateurs/attestation_template_v2s/show.html.haml b/app/views/administrateurs/attestation_template_v2s/show.html.haml index 3351d889f..87faf5ee7 100644 --- a/app/views/administrateurs/attestation_template_v2s/show.html.haml +++ b/app/views/administrateurs/attestation_template_v2s/show.html.haml @@ -25,7 +25,6 @@ .main = sanitize(@body, attributes: %w[class style], tags: Rails.configuration.action_view.sanitized_allowed_tags + %w[header]) - - if @signature&.attached? .signature - = image_tag(@signature) + = image_tag(Rails.application.routes.url_helpers.url_for(@signature))