add pdf generation

This commit is contained in:
Alex Turchyn committed 2023-06-01 00:01:11 +03:00
1 parent 170cb1ecea
commit 6a41f82e5b
21 files changed
+383 -49

No files matched your search

@@ -0,0 +1,27 @@
# frozen_string_literal: true
class SubmissionsDebugController < ApplicationController
layout 'flow'
skip_before_action :authenticate_user!
def index
@submission = Submission.preload({ attachments_attachments: :blob },
flow: { documents_attachments: :blob })
.find_by(slug: params[:submission_slug])
respond_to do |f|
f.html do
render 'submit_flow/show'
end
f.pdf do
Submissions::GenerateResultAttachments.call(@submission)
send_data ActiveStorage::Attachment.where(name: :documents).last.download,
filename: 'debug.pdf',
disposition: 'inline',
type: 'application/pdf'
end
end
end
end