From b1f68e59d9ed8bee75a1cd60d1b16200845fe07f Mon Sep 17 00:00:00 2001 From: N-Pex Date: Fri, 1 Jul 2022 11:09:30 +0200 Subject: [PATCH] Validate before enabling "publish" button on poll creation. --- src/components/CreatePollDialog.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/CreatePollDialog.vue b/src/components/CreatePollDialog.vue index 14fc973..c5ff2aa 100644 --- a/src/components/CreatePollDialog.vue +++ b/src/components/CreatePollDialog.vue @@ -44,7 +44,7 @@ :class="{ deletable: pollAnswers.length > 1 }" ref="answerInput" > - delete + delete @@ -72,7 +72,7 @@ block class="filled-button publish-button" @click.stop="onCreatePoll()" - :disabled="isCreating" + :disabled="isCreating || !publishButtonEnabled" >{{ $t("poll_create.create") }} @@ -197,6 +197,11 @@ export default { } }, }, + computed: { + publishButtonEnabled() { + return this.pollQuestion && this.pollAnswers.length > 0 && this.pollAnswers.every(a => a.text); + } + }, components: { InputControl }, };