diff --git a/app/controllers/submit_form_controller.rb b/app/controllers/submit_form_controller.rb index 501455ba..8485a843 100644 --- a/app/controllers/submit_form_controller.rb +++ b/app/controllers/submit_form_controller.rb @@ -23,6 +23,8 @@ class SubmitFormController < ApplicationController Submitters::SubmitValues.call(submitter, params, request) head :ok + rescue Submitters::SubmitValues::ValidationError => e + render json: { error: e.message }, status: :unprocessable_entity end def completed diff --git a/app/javascript/application.js b/app/javascript/application.js index 3edc957a..cc924ece 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -75,6 +75,7 @@ window.customElements.define('template-builder', class extends HTMLElement { this.app = createApp(TemplateBuilder, { template: reactive(JSON.parse(this.dataset.template)), backgroundColor: '#faf7f5', + withPhone: this.dataset.withPhone === 'true', isDirectUpload: this.dataset.isDirectUpload === 'true' }) diff --git a/app/javascript/submission_form/area.vue b/app/javascript/submission_form/area.vue index 39517b33..7f057bab 100644 --- a/app/javascript/submission_form/area.vue +++ b/app/javascript/submission_form/area.vue @@ -113,7 +113,7 @@ diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue index a4443317..66b617a5 100644 --- a/app/javascript/template_builder/builder.vue +++ b/app/javascript/template_builder/builder.vue @@ -237,6 +237,7 @@ export default { save: this.save, baseFetch: this.baseFetch, backgroundColor: this.backgroundColor, + withPhone: this.withPhone, selectedAreaRef: computed(() => this.selectedAreaRef) } }, @@ -270,6 +271,11 @@ export default { required: false, default: true }, + withPhone: { + type: Boolean, + required: false, + default: false + }, fetchOptions: { type: Object, required: false, diff --git a/app/javascript/template_builder/field_type.vue b/app/javascript/template_builder/field_type.vue index dbe04bcf..6dbaf9ac 100644 --- a/app/javascript/template_builder/field_type.vue +++ b/app/javascript/template_builder/field_type.vue @@ -18,33 +18,36 @@ :class="menuClasses" @click="closeDropdown" > -