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.
21 lines
547 B
21 lines
547 B
# frozen_string_literal: true
|
|
|
|
class TemplatesUploadsController < ApplicationController
|
|
load_and_authorize_resource :template, parent: false
|
|
|
|
def create
|
|
@template.author = current_user
|
|
@template.name = File.basename(params[:files].first.original_filename, '.*')
|
|
|
|
@template.save!
|
|
|
|
documents = Templates::CreateAttachments.call(@template, params)
|
|
|
|
schema = documents.map { |doc| { attachment_uuid: doc.uuid, name: doc.filename.base } }
|
|
|
|
@template.update!(schema:)
|
|
|
|
redirect_to edit_template_path(@template)
|
|
end
|
|
end
|