Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions src/views/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@
@change="autoSizeDescription"
@keydown="autoSizeDescription"
@keyup="onDescChange" />
<!-- Only visible if at least one question is marked as mandatory-->
<p v-if="mandatoryUsed" class="info-mandatory">
* {{ t('forms', 'Required questions') }}
</p>
<!-- Generate form information message-->
<p class="info-message" v-text="infoMessage" />
</header>

<section>
Expand Down Expand Up @@ -197,14 +195,21 @@ export default {
return this.form.questions && this.form.questions.length === 0
},

/**
* Check if at least one question is mandatory
* @returns {Boolean}
*/
mandatoryUsed() {
return this.form.questions.reduce(
(isUsed, question) => isUsed || question.mandatory
, false)
isMandatoryUsed() {
return this.form.questions.reduce((isUsed, question) => isUsed || question.mandatory, false)
},

infoMessage() {
let message = ''
if (this.form.isAnonymous) {
message += t('forms', 'Responses are anonymous.')
} else {
message += t('forms', 'Responses are connected to your Nextcloud account.')
}
if (this.isMandatoryUsed) {
message += ' ' + t('forms', ' An asterisk (*) indicates mandatory questions.')
}
return message
},
},

Expand Down Expand Up @@ -446,7 +451,7 @@ export default {

.form-title,
.form-desc,
.info-mandatory {
.info-message {
width: 100%;
padding: 0 16px;
border: none;
Expand All @@ -470,7 +475,7 @@ export default {
resize: none;
}

.info-mandatory {
.info-message {
font-size: 100%;
padding-bottom: 20px;
resize: none;
Expand Down
33 changes: 19 additions & 14 deletions src/views/Submit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@
<!-- Do not wrap the following line between tags! `white-space:pre-line` respects `\n` but would produce additional empty first line -->
<!-- eslint-disable-next-line -->
<p v-if="!loading && !success" class="form-desc">{{ form.description }}</p>
<!-- Only visible if at least one question is marked as mandatory-->
<p v-if="mandatoryUsed && !loading && !success" class="info-mandatory">
* {{ t('forms', 'Required questions') }}
</p>
<!-- Generate form information message-->
<p class="info-message" v-text="infoMessage" />
</header>

<!-- Questions list -->
Expand Down Expand Up @@ -143,14 +141,21 @@ export default {
})
},

/**
* Check if at least one question is mandatory
* @returns {Boolean}
*/
mandatoryUsed() {
return this.form.questions.reduce(
(isUsed, question) => isUsed || question.mandatory
, false)
isMandatoryUsed() {
return this.form.questions.reduce((isUsed, question) => isUsed || question.mandatory, false)
},

infoMessage() {
let message = ''
if (this.form.isAnonymous) {
message += t('forms', 'Responses are anonymous.')
} else {
message += t('forms', 'Responses are connected to your Nextcloud account.')
}
if (this.isMandatoryUsed) {
message += ' ' + t('forms', ' An asterisk (*) indicates mandatory questions.')
}
return message
},
},

Expand Down Expand Up @@ -231,7 +236,7 @@ export default {

.form-title,
.form-desc,
.info-mandatory {
.info-message {
width: 100%;
padding: 0 16px;
border: none;
Expand All @@ -255,7 +260,7 @@ export default {
white-space: pre-line;
}

.info-mandatory {
.info-message {
font-size: 100%;
padding-bottom: 20px;
resize: none;
Expand Down