From 897df836330fb399eeeb234fd1d7ac687970aa2e Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Tue, 27 Jun 2023 00:57:29 +0300 Subject: [PATCH] add cell field type --- app/controllers/api/templates_controller.rb | 2 +- app/javascript/application.js | 2 - app/javascript/submission_form/area.vue | 17 ++++- app/javascript/submission_form/form.vue | 14 ++-- app/javascript/template_builder/area.vue | 73 ++++++++++++++++++- app/javascript/template_builder/builder.vue | 8 +- app/javascript/template_builder/document.vue | 8 +- app/javascript/template_builder/field.vue | 11 ++- .../template_builder/field_type.vue | 21 +++++- app/javascript/template_builder/fields.vue | 3 +- app/javascript/template_builder/i18n.js | 11 --- app/javascript/template_builder/page.vue | 43 +++++++---- app/views/submissions/_value.html.erb | 9 +++ .../generate_result_attachments.rb | 13 ++++ 14 files changed, 188 insertions(+), 47 deletions(-) delete mode 100644 app/javascript/template_builder/i18n.js diff --git a/app/controllers/api/templates_controller.rb b/app/controllers/api/templates_controller.rb index 7d385c2c..6675a684 100644 --- a/app/controllers/api/templates_controller.rb +++ b/app/controllers/api/templates_controller.rb @@ -17,7 +17,7 @@ module Api schema: [%i[attachment_uuid name]], submitters: [%i[name uuid]], fields: [[:uuid, :submitter_uuid, :name, :type, :required, - { options: [], areas: [%i[x y w h attachment_uuid page]] }]]) + { options: [], areas: [%i[x y w h cell_w attachment_uuid page]] }]]) end end end diff --git a/app/javascript/application.js b/app/javascript/application.js index 2ee408b5..a12535d2 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -41,8 +41,6 @@ window.customElements.define('template-builder', class extends HTMLElement { template: reactive(JSON.parse(this.dataset.template)) }) - this.app.config.globalProperties.$t = (key) => TemplateBuilder.i18n[key] || key - this.app.mount(this.appElem) this.appendChild(this.appElem) diff --git a/app/javascript/submission_form/area.vue b/app/javascript/submission_form/area.vue index 711737c6..7aa500ff 100644 --- a/app/javascript/submission_form/area.vue +++ b/app/javascript/submission_form/area.vue @@ -82,6 +82,19 @@ :class="{ '!w-auto !h-full': area.w > area.h, '!w-full !h-auto': area.w <= area.h }" /> +
+
+ {{ char }} +
+