зеркало из https://github.com/nextcloud/forms.git
Change mandatory to isRequired
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
This commit is contained in:
Родитель
c8f371da5d
Коммит
579d145c9d
|
@ -74,7 +74,7 @@ class Question extends Entity {
|
|||
'formId' => $this->getFormId(),
|
||||
'order' => $this->getOrder(),
|
||||
'type' => htmlspecialchars_decode($this->getType()),
|
||||
'mandatory' => $this->getMandatory(),
|
||||
'isRequired' => $this->getMandatory(),
|
||||
'text' => htmlspecialchars_decode($this->getText()),
|
||||
];
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@
|
|||
class="question__header-warning icon-error-color"
|
||||
tabindex="0" />
|
||||
<Actions v-if="!readOnly" class="question__header-menu" :force-menu="true">
|
||||
<ActionCheckbox :checked="mandatory"
|
||||
@update:checked="onMandatoryChange">
|
||||
<ActionCheckbox :checked="isRequired"
|
||||
@update:checked="onRequiredChange">
|
||||
<!-- TRANSLATORS Making this question necessary to be answered when submitting to a form -->
|
||||
{{ t('forms', 'Required') }}
|
||||
</ActionCheckbox>
|
||||
|
@ -99,7 +99,7 @@ export default {
|
|||
type: String,
|
||||
required: true,
|
||||
},
|
||||
mandatory: {
|
||||
isRequired: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
|
@ -131,11 +131,11 @@ export default {
|
|||
|
||||
computed: {
|
||||
/**
|
||||
* Extend text with asterisk if question is mandatory
|
||||
* Extend text with asterisk if question is required
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
computedText() {
|
||||
if (this.mandatory) {
|
||||
if (this.isRequired) {
|
||||
return this.text + ' *'
|
||||
}
|
||||
return this.text
|
||||
|
@ -155,8 +155,8 @@ export default {
|
|||
this.$emit('update:text', target.value)
|
||||
},
|
||||
|
||||
onMandatoryChange(mandatory) {
|
||||
this.$emit('update:mandatory', mandatory)
|
||||
onRequiredChange(isRequired) {
|
||||
this.$emit('update:isRequired', isRequired)
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
<Question
|
||||
v-bind.sync="$attrs"
|
||||
:text="text"
|
||||
:mandatory="mandatory"
|
||||
:is-required="isRequired"
|
||||
:edit.sync="edit"
|
||||
:read-only="readOnly"
|
||||
:max-question-length="maxStringLengths.questionText"
|
||||
:title-placeholder="answerType.titlePlaceholder"
|
||||
:warning-invalid="answerType.warningInvalid"
|
||||
@update:text="onTitleChange"
|
||||
@update:mandatory="onMandatoryChange"
|
||||
@update:isRequired="onRequiredChange"
|
||||
@delete="onDelete">
|
||||
<div class="question__content">
|
||||
<DatetimePicker
|
||||
|
@ -103,7 +103,7 @@ export default {
|
|||
*/
|
||||
inputAttr() {
|
||||
return {
|
||||
required: this.mandatory,
|
||||
required: this.isRequired,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<Question
|
||||
v-bind.sync="$attrs"
|
||||
:text="text"
|
||||
:mandatory="mandatory"
|
||||
:is-required="isRequired"
|
||||
:edit.sync="edit"
|
||||
:read-only="readOnly"
|
||||
:max-question-length="maxStringLengths.questionText"
|
||||
|
@ -33,13 +33,13 @@
|
|||
:content-valid="contentValid"
|
||||
:shift-drag-handle="shiftDragHandle"
|
||||
@update:text="onTitleChange"
|
||||
@update:mandatory="onMandatoryChange"
|
||||
@update:isRequired="onRequiredChange"
|
||||
@delete="onDelete">
|
||||
<select v-if="!edit"
|
||||
:id="text"
|
||||
:name="text"
|
||||
:multiple="isMultiple"
|
||||
:required="mandatory"
|
||||
:required="isRequired"
|
||||
class="question__content"
|
||||
@change="onChange">
|
||||
<option value="">
|
||||
|
@ -189,8 +189,8 @@ export default {
|
|||
* @returns {boolean}
|
||||
*/
|
||||
isRequired(id) {
|
||||
// false, if question not mandatory
|
||||
if (!this.mandatory) {
|
||||
// false, if question not required
|
||||
if (!this.isRequired) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
@ -24,21 +24,21 @@
|
|||
<Question
|
||||
v-bind.sync="$attrs"
|
||||
:text="text"
|
||||
:mandatory="mandatory"
|
||||
:is-required="isRequired"
|
||||
:edit.sync="edit"
|
||||
:read-only="readOnly"
|
||||
:max-question-length="maxStringLengths.questionText"
|
||||
:title-placeholder="answerType.titlePlaceholder"
|
||||
:warning-invalid="answerType.warningInvalid"
|
||||
@update:text="onTitleChange"
|
||||
@update:mandatory="onMandatoryChange"
|
||||
@update:isRequired="onRequiredChange"
|
||||
@delete="onDelete">
|
||||
<div class="question__content">
|
||||
<textarea ref="textarea"
|
||||
:aria-label="t('forms', 'A long answer for the question “{text}”', { text })"
|
||||
:placeholder="submissionInputPlaceholder"
|
||||
:disabled="!readOnly"
|
||||
:required="mandatory"
|
||||
:required="isRequired"
|
||||
:value="values[0]"
|
||||
class="question__text"
|
||||
:maxlength="maxStringLengths.answerText"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<Question
|
||||
v-bind.sync="$attrs"
|
||||
:text="text"
|
||||
:mandatory="mandatory"
|
||||
:is-required="isRequired"
|
||||
:edit.sync="edit"
|
||||
:read-only="readOnly"
|
||||
:max-question-length="maxStringLengths.questionText"
|
||||
|
@ -33,7 +33,7 @@
|
|||
:content-valid="contentValid"
|
||||
:shift-drag-handle="shiftDragHandle"
|
||||
@update:text="onTitleChange"
|
||||
@update:mandatory="onMandatoryChange"
|
||||
@update:isRequired="onRequiredChange"
|
||||
@delete="onDelete">
|
||||
<ul class="question__content">
|
||||
<template v-for="(answer, index) in options">
|
||||
|
@ -49,7 +49,7 @@
|
|||
'checkbox question__checkbox': !isUnique,
|
||||
}"
|
||||
:name="`${id}-answer`"
|
||||
:required="isRequired(answer.id)"
|
||||
:required="checkRequired(answer.id)"
|
||||
:type="isUnique ? 'radio' : 'checkbox'"
|
||||
@change="onChange($event, answer.id)"
|
||||
@keydown.enter.exact.prevent="onKeydownEnter">
|
||||
|
@ -195,9 +195,9 @@ export default {
|
|||
* @param {number} id the answer id
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isRequired(id) {
|
||||
// false, if question not mandatory
|
||||
if (!this.mandatory) {
|
||||
checkRequired(id) {
|
||||
// false, if question not required
|
||||
if (!this.isRequired) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
@ -24,21 +24,21 @@
|
|||
<Question
|
||||
v-bind.sync="$attrs"
|
||||
:text="text"
|
||||
:mandatory="mandatory"
|
||||
:is-required="isRequired"
|
||||
:edit.sync="edit"
|
||||
:read-only="readOnly"
|
||||
:max-question-length="maxStringLengths.questionText"
|
||||
:title-placeholder="answerType.titlePlaceholder"
|
||||
:warning-invalid="answerType.warningInvalid"
|
||||
@update:text="onTitleChange"
|
||||
@update:mandatory="onMandatoryChange"
|
||||
@update:isRequired="onRequiredChange"
|
||||
@delete="onDelete">
|
||||
<div class="question__content">
|
||||
<input ref="input"
|
||||
:aria-label="t('forms', 'A short answer for the question “{text}”', { text })"
|
||||
:placeholder="submissionInputPlaceholder"
|
||||
:disabled="!readOnly"
|
||||
:required="mandatory"
|
||||
:required="isRequired"
|
||||
:value="values[0]"
|
||||
class="question__input"
|
||||
:maxlength="maxStringLengths.answerText"
|
||||
|
|
|
@ -46,9 +46,9 @@ export default {
|
|||
},
|
||||
|
||||
/**
|
||||
* Mandatory-Setting
|
||||
* Required-Setting
|
||||
*/
|
||||
mandatory: {
|
||||
isRequired: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
|
@ -119,13 +119,13 @@ export default {
|
|||
}, 200),
|
||||
|
||||
/**
|
||||
* Forward the mandatory change to the parent and store to db
|
||||
* Forward the required change to the parent and store to db
|
||||
*
|
||||
* @param {Boolean} mandatoryValue new mandatory Value
|
||||
* @param {Boolean} isRequiredValue new mandatory Value
|
||||
*/
|
||||
onMandatoryChange: debounce(function(mandatoryValue) {
|
||||
this.$emit('update:mandatory', mandatoryValue)
|
||||
this.saveQuestionProperty('mandatory', mandatoryValue)
|
||||
onRequiredChange: debounce(function(isRequiredValue) {
|
||||
this.$emit('update:isRequired', isRequiredValue)
|
||||
this.saveQuestionProperty('mandatory', isRequiredValue)
|
||||
}, 200),
|
||||
|
||||
/**
|
||||
|
|
|
@ -204,8 +204,8 @@ export default {
|
|||
return this.form.questions && this.form.questions.length === 0
|
||||
},
|
||||
|
||||
isMandatoryUsed() {
|
||||
return this.form.questions.reduce((isUsed, question) => isUsed || question.mandatory, false)
|
||||
isRequiredUsed() {
|
||||
return this.form.questions.reduce((isUsed, question) => isUsed || question.isRequired, false)
|
||||
},
|
||||
|
||||
infoMessage() {
|
||||
|
@ -219,7 +219,7 @@ export default {
|
|||
message += t('forms', 'Responses are connected to your Nextcloud account.')
|
||||
}
|
||||
|
||||
if (this.isMandatoryUsed) {
|
||||
if (this.isRequiredUsed) {
|
||||
message += ' ' + t('forms', 'An asterisk (*) indicates mandatory questions.')
|
||||
}
|
||||
|
||||
|
|
|
@ -152,8 +152,8 @@ export default {
|
|||
})
|
||||
},
|
||||
|
||||
isMandatoryUsed() {
|
||||
return this.form.questions.reduce((isUsed, question) => isUsed || question.mandatory, false)
|
||||
isRequiredUsed() {
|
||||
return this.form.questions.reduce((isUsed, question) => isUsed || question.isRequired, false)
|
||||
},
|
||||
|
||||
infoMessage() {
|
||||
|
@ -164,7 +164,7 @@ export default {
|
|||
if (!this.form.isAnonymous && this.isLoggedIn) {
|
||||
message += t('forms', 'Responses are connected to your Nextcloud account.')
|
||||
}
|
||||
if (this.isMandatoryUsed) {
|
||||
if (this.isRequiredUsed) {
|
||||
message += ' ' + t('forms', 'An asterisk (*) indicates mandatory questions.')
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче