make pdf links clickable

This commit is contained in:
Alex Turchyn
2023-09-01 01:27:13 +03:00
parent c4daf8ed49
commit 52ef0ae929
17 changed files with 131 additions and 44 deletions
@@ -7,12 +7,7 @@ module Api
@template = current_account.templates.find(params[:template_id])
documents =
find_or_create_blobs.map do |blob|
document = @template.documents.create!(blob:)
Templates::ProcessDocument.call(document)
end
documents = Templates::CreateAttachments.call(@template, params)
schema = documents.map do |doc|
{ attachment_uuid: doc.uuid, name: doc.filename.base }
@@ -27,19 +22,5 @@ module Api
)
}
end
private
def find_or_create_blobs
blobs = params[:blobs]&.map do |attrs|
ActiveStorage::Blob.find_signed(attrs[:signed_id])
end
blobs || params[:files].map do |file|
ActiveStorage::Blob.create_and_upload!(io: file.open,
filename: file.original_filename,
content_type: file.content_type)
end
end
end
end
+1 -1
View File
@@ -18,7 +18,7 @@ class EsignSettingsController < ApplicationController
default_pkcs = GenerateCertificate.load_pkcs(cert_data) if cert_data['cert'].present?
custom_pkcs_list = (cert_data['custom'] || []).map do |e|
{ 'pkcs' => OpenSSL::PKCS12.new(Base64.urlsafe_decode64(e['data']), e['password']),
{ 'pkcs' => OpenSSL::PKCS12.new(Base64.urlsafe_decode64(e['data']), e['password'].to_s),
'name' => e['name'],
'status' => e['status'] }
end
+1 -1
View File
@@ -6,7 +6,7 @@ class SubmissionsController < ApplicationController
def show
@submission =
Submission.joins(:template).where(template: { account_id: current_account.id })
.preload(template: { documents_attachments: { preview_images_attachments: :blob } })
.preload(:template, template_schema_documents: [:blob, { preview_images_attachments: :blob }])
.find(params[:id])
render :show, layout: 'plain'
+3 -1
View File
@@ -7,7 +7,9 @@ class SubmitFormController < ApplicationController
def show
@submitter =
Submitter.preload(submission: { template: { documents_attachments: { preview_images_attachments: :blob } } })
Submitter.preload(submission: [
:template, { template_schema_documents: [:blob, { preview_images_attachments: :blob }] }
])
.find_by!(slug: params[:slug])
return redirect_to submit_form_completed_path(@submitter.slug) if @submitter.completed_at?
@@ -10,13 +10,13 @@ class VerifyPdfSignatureController < ApplicationController
cert_data = if Docuseal.multitenant?
Docuseal::CERTS
else
EncryptedConfig.find_by(account:, key: EncryptedConfig::ESIGN_CERTS_KEY)&.value || {}
EncryptedConfig.find_by(account: current_account, key: EncryptedConfig::ESIGN_CERTS_KEY)&.value || {}
end
default_pkcs = GenerateCertificate.load_pkcs(cert_data)
custom_certs = (cert_data['custom'] || []).map do |e|
OpenSSL::PKCS12.new(Base64.urlsafe_decode64(e['data']), e['password'])
custom_certs = cert_data.fetch('custom', []).map do |e|
OpenSSL::PKCS12.new(Base64.urlsafe_decode64(e['data']), e['password'].to_s)
end
trusted_certs = [default_pkcs.certificate,