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.
19 lines
517 B
19 lines
517 B
# frozen_string_literal: true
|
|
|
|
class TemplatesUploadsController < ApplicationController
|
|
def create
|
|
template = current_account.templates.new(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
|