From 3ed15e383bdcbdd10baf4d3599b86729c00eb846 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Tue, 15 Sep 2026 19:45:29 +0300 Subject: [PATCH] adjust mobile builder --- app/javascript/template_builder/builder.vue | 342 ++++++++++-------- app/javascript/template_builder/controls.vue | 105 ------ .../documents_editor_crop.vue | 140 +++---- .../documents_editor_modal.vue | 47 ++- .../documents_editor_redact.vue | 58 +-- .../template_builder/drag_placeholder.vue | 8 +- app/javascript/template_builder/field.vue | 41 ++- app/javascript/template_builder/fields.vue | 86 +++-- app/javascript/template_builder/i18n.js | 21 ++ .../template_builder/mobile_draw_field.vue | 101 ------ .../template_builder/mobile_drawer.vue | 68 ++++ .../template_builder/mobile_fields.vue | 142 -------- 12 files changed, 521 insertions(+), 638 deletions(-) delete mode 100644 app/javascript/template_builder/controls.vue delete mode 100644 app/javascript/template_builder/mobile_draw_field.vue create mode 100644 app/javascript/template_builder/mobile_drawer.vue delete mode 100644 app/javascript/template_builder/mobile_fields.vue diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue index 82601835e..4992383c8 100644 --- a/app/javascript/template_builder/builder.vue +++ b/app/javascript/template_builder/builder.vue @@ -2,7 +2,7 @@
@@ -25,79 +25,117 @@ :is-default="defaultFields.includes(toRaw(dragField))" :is-required="defaultRequiredFields.includes(toRaw(dragField))" /> -
- - -
-
- -
+
+ +
+
+ + +
+ + +
+ +
+
- -
- - -
@@ -797,27 +789,52 @@ @click="[drawField = null, drawOption = null]" /> - - + + {{ t('draw_field').replace('{field}', fieldNames[drawField.type]) }} + + + + 0 + }, isRevisionsView () { return this.view === 'revisions' }, @@ -2406,10 +2426,40 @@ export default { postNativeEvent (name, detail, dismiss = false) { window.webkit?.messageHandlers?.modal?.postMessage({ action: 'dispatch', name, detail: JSON.stringify(detail), dismiss: dismiss ? 'true' : 'false' }) }, + onDrawerScrollTo (item) { + if (this.isNativeView) { + this.postNativeEvent('template-builder:scroll-to', { attachment_uuid: item.attachment_uuid }, true) + } else { + this.isDocumentsDrawerOpen = false + this.scrollIntoDocument(item) + } + }, + onDrawerSetDraw ({ field, option }) { + if (this.isNativeView) { + this.postNativeEvent('template-builder:draw-field', { uuid: field.uuid, option }, true) + } else { + this.isFieldsDrawerOpen = false + this.drawField = field + this.drawOption = option + } + }, + onDrawerSetDrawType (type) { + if (this.isNativeView) { + this.postNativeEvent('template-builder:draw-field', { type }, true) + } else { + this.isFieldsDrawerOpen = false + this.startFieldDraw({ type }) + } + }, onDrawerScrollToArea (area) { - const field = this.template.fields.find((f) => (f.areas || []).includes(area)) + if (this.isNativeView) { + const field = this.template.fields.find((f) => (f.areas || []).includes(area)) - this.postNativeEvent('template-builder:select-field', { uuid: field?.uuid, attachment_uuid: area.attachment_uuid, page: area.page, x: area.x, y: area.y }, true) + this.postNativeEvent('template-builder:select-field', { uuid: field?.uuid, attachment_uuid: area.attachment_uuid, page: area.page, x: area.x, y: area.y }, true) + } else { + this.isFieldsDrawerOpen = false + this.scrollToArea(area) + } }, syncNative () { const { schema, documents, fields, submitters } = this.template diff --git a/app/javascript/template_builder/controls.vue b/app/javascript/template_builder/controls.vue deleted file mode 100644 index df976002b..000000000 --- a/app/javascript/template_builder/controls.vue +++ /dev/null @@ -1,105 +0,0 @@ - - - diff --git a/app/javascript/template_builder/documents_editor_crop.vue b/app/javascript/template_builder/documents_editor_crop.vue index 3b23c5a33..0df5f4faa 100644 --- a/app/javascript/template_builder/documents_editor_crop.vue +++ b/app/javascript/template_builder/documents_editor_crop.vue @@ -1,7 +1,7 @@ diff --git a/app/javascript/template_builder/documents_editor_modal.vue b/app/javascript/template_builder/documents_editor_modal.vue index 1d25c8c31..1682bcdb5 100644 --- a/app/javascript/template_builder/documents_editor_modal.vue +++ b/app/javascript/template_builder/documents_editor_modal.vue @@ -10,8 +10,8 @@ @click.prevent="$emit('close')" />