mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
593 B
23 lines
593 B
# frozen_string_literal: true
|
|
|
|
class TemplatesPreviewController < ApplicationController
|
|
load_and_authorize_resource :template
|
|
|
|
def show
|
|
ActiveRecord::Associations::Preloader.new(
|
|
records: [@template],
|
|
associations: [schema_documents: { preview_images_attachments: :blob }]
|
|
).call
|
|
|
|
@template_data =
|
|
@template.as_json.merge(
|
|
documents: @template.schema_documents.as_json(
|
|
methods: [:metadata],
|
|
include: { preview_images: { methods: %i[url metadata filename] } }
|
|
)
|
|
).to_json
|
|
|
|
render :show, layout: 'plain'
|
|
end
|
|
end
|