diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-11-27 09:42:23 +0100 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-11-29 08:07:53 +0000 |
commit | 41379c0f0a57a6d257da997779d5de506508c070 (patch) | |
tree | 06c8d86891d41be16dc1bb6e956bf07628a20f92 /apps/dav/src | |
parent | 2f1f35530b07831a3f6927d9b998ad3ac9a35a3c (diff) | |
download | nextcloud-server-41379c0f0a57a6d257da997779d5de506508c070.tar.gz nextcloud-server-41379c0f0a57a6d257da997779d5de506508c070.zip |
fix(dav): Make ooo settings a form and the message required
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/src')
-rw-r--r-- | apps/dav/src/components/AbsenceForm.vue | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/apps/dav/src/components/AbsenceForm.vue b/apps/dav/src/components/AbsenceForm.vue index 0462c22a53d..500004b755a 100644 --- a/apps/dav/src/components/AbsenceForm.vue +++ b/apps/dav/src/components/AbsenceForm.vue @@ -21,24 +21,26 @@ --> <template> - <div class="absence"> + <form class="absence" @submit.prevent="saveForm"> <div class="absence__dates"> <NcDateTimePickerNative id="absence-first-day" v-model="firstDay" :label="$t('dav', 'First day')" - class="absence__dates__picker" /> + class="absence__dates__picker" + :required="true" /> <NcDateTimePickerNative id="absence-last-day" v-model="lastDay" :label="$t('dav', 'Last day (inclusive)')" - class="absence__dates__picker" /> + class="absence__dates__picker" + :required="true" /> </div> - <NcTextField :value.sync="status" :label="$t('dav', 'Short absence status')" /> - <NcTextArea :value.sync="message" :label="$t('dav', 'Long absence Message')" /> + <NcTextField :value.sync="status" :label="$t('dav', 'Short absence status')" :required="true" /> + <NcTextArea :value.sync="message" :label="$t('dav', 'Long absence Message')" :required="true" /> <div class="absence__buttons"> <NcButton :disabled="loading || !valid" type="primary" - @click="saveForm"> + native-type="submit"> {{ $t('dav', 'Save') }} </NcButton> <NcButton :disabled="loading || !valid" @@ -47,7 +49,7 @@ {{ $t('dav', 'Disable absence') }} </NcButton> </div> - </div> + </form> </template> <script> @@ -59,7 +61,9 @@ import { generateUrl } from '@nextcloud/router' import axios from '@nextcloud/axios' import { formatDateAsYMD } from '../utils/date.js' import { loadState } from '@nextcloud/initial-state' -import { showError } from '@nextcloud/dialogs' +import { showError, showSuccess } from '@nextcloud/dialogs' + +import logger from '../service/logger.js' export default { name: 'AbsenceForm', @@ -88,6 +92,7 @@ export default { return !!this.firstDay && !!this.lastDay && !!this.status + && !!this.message && this.lastDay > this.firstDay }, }, @@ -111,8 +116,10 @@ export default { status: this.status, message: this.message, }) + showSuccess(this.$t('dav', 'Absence saved')) } catch (error) { showError(this.$t('dav', 'Failed to save your absence settings')) + logger.error('Could not save absence', { error }) } finally { this.loading = false } @@ -122,8 +129,10 @@ export default { try { await axios.delete(generateUrl('/apps/dav/settings/absence')) this.resetForm() + showSuccess(this.$t('dav', 'Absence cleared')) } catch (error) { showError(this.$t('dav', 'Failed to clear your absence settings')) + logger.error('Could not clear absence', { error }) } finally { this.loading = false } |