pull/381/merge
Pete Matsyburka 3 months ago
parent 2bffbf83c6
commit 2c8f5d2129

@ -3,6 +3,8 @@
class TemplatesDebugController < ApplicationController class TemplatesDebugController < ApplicationController
load_and_authorize_resource :template load_and_authorize_resource :template
DEBUG_FILE = ''
def show def show
attachment = @template.documents.first attachment = @template.documents.first
@ -16,6 +18,8 @@ class TemplatesDebugController < ApplicationController
@template.update!(fields: Templates::ProcessDocument.normalize_attachment_fields(@template, [attachment])) @template.update!(fields: Templates::ProcessDocument.normalize_attachment_fields(@template, [attachment]))
debug_file if DEBUG_FILE.present?
ActiveRecord::Associations::Preloader.new( ActiveRecord::Associations::Preloader.new(
records: [@template], records: [@template],
associations: [schema_documents: { preview_images_attachments: :blob }] associations: [schema_documents: { preview_images_attachments: :blob }]
@ -31,4 +35,27 @@ class TemplatesDebugController < ApplicationController
render 'templates/edit', layout: 'plain' render 'templates/edit', layout: 'plain'
end end
def debug_file
tempfile = Tempfile.new
tempfile.binmode
tempfile.write(File.read(DEBUG_FILE))
tempfile.rewind
filename = File.basename(DEBUG_FILE)
file = ActionDispatch::Http::UploadedFile.new(
tempfile:,
filename:,
type: Marcel::MimeType.for(tempfile)
)
params = { files: [file] }
documents = Templates::CreateAttachments.call(@template, params)
schema = documents.map { |doc| { attachment_uuid: doc.uuid, name: doc.filename.base } }
@template.update!(schema:)
end
end end

@ -24,6 +24,7 @@ en: &en
thanks: Thanks thanks: Thanks
private: Private private: Private
select: Select select: Select
party: Party
edit_order: Edit Order edit_order: Edit Order
invite_form_fields: Invite form fields invite_form_fields: Invite form fields
default_parties: Default parties default_parties: Default parties
@ -899,6 +900,7 @@ en: &en
range_without_total: "%{from}-%{to} events" range_without_total: "%{from}-%{to} events"
es: &es es: &es
party: Parte
edit_order: Edita Pedido edit_order: Edita Pedido
select: Seleccionar select: Seleccionar
invite_form_fields: Invitar campos del formulario invite_form_fields: Invitar campos del formulario
@ -1778,6 +1780,7 @@ es: &es
range_without_total: "%{from}-%{to} eventos" range_without_total: "%{from}-%{to} eventos"
it: &it it: &it
party: Parte
edit_order: Modifica Ordine edit_order: Modifica Ordine
select: Seleziona select: Seleziona
invite_form_fields: Invita campi modulo invite_form_fields: Invita campi modulo
@ -2657,6 +2660,7 @@ it: &it
range_without_total: "%{from}-%{to} eventi" range_without_total: "%{from}-%{to} eventi"
fr: &fr fr: &fr
party: Partie
edit_order: Modifier la commande edit_order: Modifier la commande
select: Sélectionner select: Sélectionner
invite_form_fields: Inviter des champs de formulaire invite_form_fields: Inviter des champs de formulaire
@ -3539,6 +3543,7 @@ fr: &fr
range_without_total: "%{from} à %{to} événements" range_without_total: "%{from} à %{to} événements"
pt: &pt pt: &pt
party: Parte
edit_order: Edita Pedido edit_order: Edita Pedido
select: Selecionar select: Selecionar
invite_form_fields: Convidar campos do formulário invite_form_fields: Convidar campos do formulário
@ -4419,6 +4424,7 @@ pt: &pt
range_without_total: "%{from}-%{to} eventos" range_without_total: "%{from}-%{to} eventos"
de: &de de: &de
party: Partei
edit_order: Bestellung bearbeiten edit_order: Bestellung bearbeiten
select: Auswählen select: Auswählen
invite_form_fields: Formularfelder einladen invite_form_fields: Formularfelder einladen

Loading…
Cancel
Save