diff --git a/app/controllers/template_documents_controller.rb b/app/controllers/template_documents_controller.rb index cfca1297..b29a18f6 100644 --- a/app/controllers/template_documents_controller.rb +++ b/app/controllers/template_documents_controller.rb @@ -3,6 +3,12 @@ class TemplateDocumentsController < ApplicationController load_and_authorize_resource :template + FILES_TTL = 5.minutes + + def index + render json: @template.schema_documents.map { |d| ActiveStorage::Blob.proxy_url(d.blob, expires_at: FILES_TTL.from_now.to_i) } + end + def create if params[:blobs].blank? && params[:files].blank? return render json: { error: I18n.t('file_is_missing') }, status: :unprocessable_content diff --git a/app/javascript/application.js b/app/javascript/application.js index 9b17172b..b839039d 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -167,6 +167,7 @@ safeRegisterElement('template-builder', class extends HTMLElement { withConditions: this.dataset.withConditions === 'true', withGoogleDrive: this.dataset.withGoogleDrive === 'true', withReplaceAndCloneUpload: true, + withDownload: true, currencies: (this.dataset.currencies || '').split(',').filter(Boolean), acceptFileTypes: this.dataset.acceptFileTypes, showTourStartForm: this.dataset.showTourStartForm === 'true' diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue index bcf376ac..5ce17324 100644 --- a/app/javascript/template_builder/builder.vue +++ b/app/javascript/template_builder/builder.vue @@ -175,7 +175,10 @@ {{ t('save') }} -