Merge branch '349-poll-is-getting-created-even-if-we-do-not-enter-the-mandatory-questions-and-answers-fields-on' into 'dev'

Validate before enabling "publish" button on poll creation.

See merge request keanuapp/keanuapp-weblite!108
This commit is contained in:
N Pex 2022-07-01 09:14:06 +00:00
commit c90944d951

View file

@ -44,7 +44,7 @@
:class="{ deletable: pollAnswers.length > 1 }"
ref="answerInput"
>
<v-btn v-if="pollAnswers.length > 0" icon @click="removeAnswer(index)"><v-icon>delete</v-icon></v-btn>
<v-btn v-if="pollAnswers.length > 1" icon @click="removeAnswer(index)"><v-icon>delete</v-icon></v-btn>
</InputControl>
</v-col>
</v-row>
@ -72,7 +72,7 @@
block
class="filled-button publish-button"
@click.stop="onCreatePoll()"
:disabled="isCreating"
:disabled="isCreating || !publishButtonEnabled"
>{{ $t("poll_create.create") }}</v-btn
>
</v-col>
@ -197,6 +197,11 @@ export default {
}
},
},
computed: {
publishButtonEnabled() {
return this.pollQuestion && this.pollAnswers.length > 0 && this.pollAnswers.every(a => a.text);
}
},
components: { InputControl },
};
</script>