Validate before enabling "publish" button on poll creation.

This commit is contained in:
N-Pex 2022-07-01 11:09:30 +02:00 committed by n8fr8
parent 9219f1f465
commit ece3606aa2

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>