diff options
author | Luka Trovic <luka@nextcloud.com> | 2024-11-29 16:42:10 +0100 |
---|---|---|
committer | nextcloud-command <nextcloud-command@users.noreply.github.com> | 2024-12-02 20:19:24 +0000 |
commit | a2fcf2f69b3e01581d5f7ab1f5ba842b6ff0e64d (patch) | |
tree | 1ccc609b2c5527c4baa431183ad1f41dba09098d /apps | |
parent | 9fcf5a56009e069533ed16131c139bb917b80f72 (diff) | |
download | nextcloud-server-a2fcf2f69b3e01581d5f7ab1f5ba842b6ff0e64d.tar.gz nextcloud-server-a2fcf2f69b3e01581d5f7ab1f5ba842b6ff0e64d.zip |
feat(templates): make second click as confirmation on templates picker
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/src/components/TemplatePreview.vue | 7 | ||||
-rw-r--r-- | apps/files/src/views/TemplatePicker.vue | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/apps/files/src/components/TemplatePreview.vue b/apps/files/src/components/TemplatePreview.vue index 46e141c6b3b..735257d1c27 100644 --- a/apps/files/src/components/TemplatePreview.vue +++ b/apps/files/src/components/TemplatePreview.vue @@ -13,7 +13,7 @@ name="template-picker" @change="onCheck"> - <label :for="id" class="template-picker__label"> + <label :for="id" class="template-picker__label" @click="onClick"> <div class="template-picker__preview" :class="failedPreview ? 'template-picker__preview--failed' : ''"> <img class="template-picker__image" @@ -128,6 +128,11 @@ export default { focus() { this.$refs.input?.focus() }, + onClick() { + if (this.checked) { + this.$emit('confirm-click', this.fileid) + } + }, }, } </script> diff --git a/apps/files/src/views/TemplatePicker.vue b/apps/files/src/views/TemplatePicker.vue index f3c7aadf2e2..719ebadd17c 100644 --- a/apps/files/src/views/TemplatePicker.vue +++ b/apps/files/src/views/TemplatePicker.vue @@ -19,6 +19,7 @@ <TemplatePreview v-bind="emptyTemplate" ref="emptyTemplatePreview" :checked="checked === emptyTemplate.fileid" + @confirm-click="onConfirmClick" @check="onCheck" /> <TemplatePreview v-for="template in provider.templates" @@ -26,6 +27,7 @@ v-bind="template" :checked="checked === template.fileid" :ratio="provider.ratio" + @confirm-click="onConfirmClick" @check="onCheck" /> </ul> @@ -207,6 +209,12 @@ export default defineComponent({ this.checked = fileid }, + onConfirmClick(fileid: number) { + if (fileid === this.checked) { + this.onSubmit() + } + }, + async createFile(templateFields) { const currentDirectory = new URL(window.location.href).searchParams.get('dir') || '/' |