From 02adbae75819651de88c47d4b4c9603f6333a487 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sat, 24 Feb 2024 17:34:22 +0200 Subject: [PATCH] add expand prop --- app/javascript/submission_form/form.vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/javascript/submission_form/form.vue b/app/javascript/submission_form/form.vue index 89324a80..64125ad0 100644 --- a/app/javascript/submission_form/form.vue +++ b/app/javascript/submission_form/form.vue @@ -17,7 +17,7 @@ v-if="!isFormVisible" id="expand_form_button" class="btn btn-neutral flex text-white absolute rounded-none border-x-0 md:border md:rounded-full bottom-0 w-full md:mb-4 text-base" - @click.prevent="isFormVisible = true" + @click.prevent="[isFormVisible = true, scrollIntoField(currentField)]" > {{ t('submit_form') }} {} } }, + expand: { + type: Boolean, + required: false, + default: true + }, withConfetti: { type: Boolean, required: false, @@ -585,7 +590,7 @@ export default { data () { return { isCompleted: false, - isFormVisible: true, + isFormVisible: this.expand, showFillAllRequiredFields: false, currentStep: 0, isSubmitting: false, @@ -657,6 +662,11 @@ export default { return `/s/${this.submitterSlug}` } }, + watch: { + expand (value) { + this.isFormVisible = value + } + }, mounted () { this.submittedValues = JSON.parse(JSON.stringify(this.values))