Merge pull request #49568 from nextcloud/template-picker-ux-improvement

feat(templates): make second click as confirmation on templates picker
This commit is contained in:
Julius Knorr 2024-12-02 21:33:50 +01:00 committed by GitHub
commit aba4d94c10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 21 additions and 8 deletions

View file

@ -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>

View file

@ -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') || '/'

2
dist/5421-5421.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/5421-5421.js.map vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/5421-5421.js.map.license vendored Symbolic link
View file

@ -0,0 +1 @@
5421-5421.js.license

2
dist/694-694.js vendored

File diff suppressed because one or more lines are too long

1
dist/694-694.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
694-694.js.license

4
dist/files-init.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long