fix(attestation_v2.signature): forward signature url to attestation_template_v2/show.html
This commit is contained in:
parent
a40d6e9c8a
commit
ee6f9ee77e
3 changed files with 6 additions and 13 deletions
|
@ -10,7 +10,8 @@ module Administrateurs
|
||||||
def show
|
def show
|
||||||
preview_dossier = @procedure.dossier_for_preview(current_user)
|
preview_dossier = @procedure.dossier_for_preview(current_user)
|
||||||
|
|
||||||
@body = @attestation_template.render_attributes_for(dossier: preview_dossier).fetch(:body)
|
@body = attributes.fetch(:body)
|
||||||
|
@signature = attributes.fetch(:signature)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
|
|
|
@ -111,12 +111,6 @@ class AttestationTemplate < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def signature_url
|
|
||||||
if signature.attached?
|
|
||||||
Rails.application.routes.url_helpers.url_for(signature)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def render_attributes_for(params = {})
|
def render_attributes_for(params = {})
|
||||||
groupe_instructeur = params[:groupe_instructeur]
|
groupe_instructeur = params[:groupe_instructeur]
|
||||||
groupe_instructeur ||= params[:dossier]&.groupe_instructeur
|
groupe_instructeur ||= params[:dossier]&.groupe_instructeur
|
||||||
|
@ -176,13 +170,11 @@ class AttestationTemplate < ApplicationRecord
|
||||||
substitutions = tags_substitutions(used_tags, dossier, escape: false)
|
substitutions = tags_substitutions(used_tags, dossier, escape: false)
|
||||||
body = tiptap.to_html(json, substitutions)
|
body = tiptap.to_html(json, substitutions)
|
||||||
|
|
||||||
attributes.merge(
|
attributes.merge(body:).merge(base_attributes)
|
||||||
body:
|
|
||||||
)
|
|
||||||
else
|
else
|
||||||
attributes.merge(
|
attributes.merge(
|
||||||
body: params.fetch(:body) { tiptap.to_html(json) }
|
body: params.fetch(:body) { tiptap.to_html(json) }
|
||||||
)
|
).merge(base_attributes)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,6 @@
|
||||||
.main
|
.main
|
||||||
= sanitize(@body, attributes: %w[class style], tags: Rails.configuration.action_view.sanitized_allowed_tags + %w[header])
|
= sanitize(@body, attributes: %w[class style], tags: Rails.configuration.action_view.sanitized_allowed_tags + %w[header])
|
||||||
|
|
||||||
- if @attestation_template.signature.present?
|
- if @signature&.attached?
|
||||||
.signature
|
.signature
|
||||||
= image_tag(@attestation_template.signature_url)
|
= image_tag(@signature)
|
||||||
|
|
Loading…
Add table
Reference in a new issue