From 0afba8d11e516267eecdd1b788e4814a04a772b8 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Thu, 26 Feb 2026 11:03:08 +0200 Subject: [PATCH] adjust with prefillable --- app/javascript/application.js | 5 ++++- app/javascript/template_builder/builder.vue | 12 +++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/javascript/application.js b/app/javascript/application.js index 8889609f..fe53cc5b 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -155,12 +155,15 @@ safeRegisterElement('template-builder', class extends HTMLElement { this.appElem.classList.add('md:h-screen') + const template = reactive(JSON.parse(this.dataset.template)) + this.app = createApp(TemplateBuilder, { - template: reactive(JSON.parse(this.dataset.template)), + template, customFields: reactive(JSON.parse(this.dataset.customFields || '[]')), backgroundColor: '#faf7f5', locale: this.dataset.locale, withPhone: this.dataset.withPhone === 'true', + withPrefillable: template.fields?.some((f) => f.prefillable), withVerification: ['true', 'false'].includes(this.dataset.withVerification) ? this.dataset.withVerification === 'true' : null, withKba: ['true', 'false'].includes(this.dataset.withKba) ? this.dataset.withKba === 'true' : null, withLogo: this.dataset.withLogo !== 'false', diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue index be19c2d4..969304e7 100644 --- a/app/javascript/template_builder/builder.vue +++ b/app/javascript/template_builder/builder.vue @@ -720,6 +720,11 @@ export default { required: false, default: false }, + withPrefillable: { + type: Boolean, + required: false, + default: false + }, customFields: { type: Array, required: false, @@ -948,13 +953,6 @@ export default { !submitter.email }) }, - withPrefillable () { - if (this.template.fields) { - return this.template.fields.some((f) => f.prefillable) - } else { - return false - } - }, isInlineSize () { return CSS.supports('container-type: size') },