Question-specific title-placeholders

Signed-off-by: Jonas Rittershofer <jotoeri@users.noreply.github.com>
This commit is contained in:
Jonas Rittershofer 2020-05-14 20:56:22 +02:00
parent 6a52d83675
commit 9184cb4480
8 changed files with 16 additions and 5 deletions

View file

@ -35,7 +35,7 @@
<!-- Header -->
<div class="question__header">
<input v-if="edit || !text"
:placeholder="t('forms', 'Question title')"
:placeholder="titlePlaceholder"
:aria-label="t('forms', 'Title of question number {index}', {index})"
:value="text"
class="question__header-title"
@ -89,6 +89,10 @@ export default {
type: String,
required: true,
},
titlePlaceholder: {
type: String,
required: true,
},
mandatory: {
type: Boolean,
required: true,

View file

@ -27,6 +27,7 @@
:mandatory="mandatory"
:edit.sync="edit"
:max-question-length="maxStringLengths.questionText"
:title-placeholder="answerType.titlePlaceholder"
@update:text="onTitleChange"
@update:mandatory="onMandatoryChange"
@delete="onDelete">

View file

@ -27,6 +27,7 @@
:mandatory="mandatory"
:edit.sync="edit"
:max-question-length="maxStringLengths.questionText"
:title-placeholder="answerType.titlePlaceholder"
@update:text="onTitleChange"
@update:mandatory="onMandatoryChange"
@delete="onDelete">
@ -104,7 +105,7 @@ export default {
},
isUnique() {
return this.model.unique === true
return this.answerType.unique === true
},
hasNoAnswer() {

View file

@ -27,6 +27,7 @@
:mandatory="mandatory"
:edit.sync="edit"
:max-question-length="maxStringLengths.questionText"
:title-placeholder="answerType.titlePlaceholder"
@update:text="onTitleChange"
@update:mandatory="onMandatoryChange"
@delete="onDelete">

View file

@ -74,7 +74,7 @@ export default {
/**
* Answer type model object
*/
model: {
answerType: {
type: Object,
required: true,
},

View file

@ -37,6 +37,7 @@ export default {
component: QuestionMultiple,
icon: 'icon-answer-multiple',
label: t('forms', 'Multiple choice'),
titlePlaceholder: t('forms', 'MultiUniqueTitlePlaceholder'),
unique: true,
// Define conditions where this questions is not ok
validate: question => question.options.length > 0,
@ -46,6 +47,7 @@ export default {
component: QuestionMultiple,
icon: 'icon-answer-checkbox',
label: t('forms', 'Checkboxes'),
titlePlaceholder: t('forms', 'MultiTitlePlaceholder'),
// Define conditions where this questions is not ok
validate: question => question.options.length > 0,
},
@ -54,12 +56,14 @@ export default {
component: QuestionShort,
icon: 'icon-answer-short',
label: t('forms', 'Short answer'),
titlePlaceholder: t('forms', 'ShortTitlePlaceholder'),
},
long: {
component: QuestionLong,
icon: 'icon-answer-long',
label: t('forms', 'Long text'),
titlePlaceholder: t('forms', 'LongTitlePlaceholder'),
},
}

View file

@ -87,7 +87,7 @@
v-for="(question, index) in form.questions"
ref="questions"
:key="question.id"
:model="answerTypes[question.type]"
:answer-type="answerTypes[question.type]"
:index="index + 1"
:max-string-lengths="maxStringLengths"
v-bind.sync="question"

View file

@ -46,7 +46,7 @@
ref="questions"
:key="question.id"
:read-only="true"
:model="answerTypes[question.type]"
:answer-type="answerTypes[question.type]"
:index="index + 1"
:max-string-lengths="maxStringLengths"
v-bind="question"