aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElizabeth Danzberger <lizzy7128@tutanota.de>2024-07-01 16:47:12 -0400
committerJulius Härtl <jus@bitgrid.net>2024-07-25 11:11:38 +0200
commite65f318fdfad720a7d0a69a4dd2b1963af008b09 (patch)
tree434e094c60bd8ef73809baa7e500713ce1ebd277
parentd3bfcec7ea70555a3701bedcffe1df951b5a324c (diff)
downloadnextcloud-server-e65f318fdfad720a7d0a69a4dd2b1963af008b09.tar.gz
nextcloud-server-e65f318fdfad720a7d0a69a4dd2b1963af008b09.zip
feat: TemplateFiller component
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
-rw-r--r--apps/files/src/components/TemplateFiller.vue16
-rw-r--r--apps/files/src/views/TemplatePicker.vue12
2 files changed, 24 insertions, 4 deletions
diff --git a/apps/files/src/components/TemplateFiller.vue b/apps/files/src/components/TemplateFiller.vue
index 3e01d64052e..6f0988d0dc9 100644
--- a/apps/files/src/components/TemplateFiller.vue
+++ b/apps/files/src/components/TemplateFiller.vue
@@ -4,18 +4,28 @@
-->
<template>
-
+ <NcDialog name="Fill Template">
+ {{ fields }}
+ </NcDialog>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
+import { NcDialog } from '@nextcloud/vue'
export default defineComponent({
name: 'TemplateFiller',
- components: {},
+ components: {
+ NcDialog,
+ },
- props: {},
+ props: {
+ fields: {
+ type: Array,
+ default: [],
+ },
+ },
methods: {},
})
diff --git a/apps/files/src/views/TemplatePicker.vue b/apps/files/src/views/TemplatePicker.vue
index f2e2e29e4b5..6c26771a240 100644
--- a/apps/files/src/views/TemplatePicker.vue
+++ b/apps/files/src/views/TemplatePicker.vue
@@ -47,7 +47,7 @@
import type { TemplateFile } from '../types.ts'
import { getCurrentUser } from '@nextcloud/auth'
-import { showError } from '@nextcloud/dialogs'
+import { showError, spawnDialog } from '@nextcloud/dialogs'
import { emit } from '@nextcloud/event-bus'
import { File } from '@nextcloud/files'
import { translate as t } from '@nextcloud/l10n'
@@ -59,6 +59,7 @@ import { createFromTemplate, getTemplates } from '../services/Templates.js'
import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
import TemplatePreview from '../components/TemplatePreview.vue'
+import TemplateFiller from '../components/TemplateFiller.vue'
import logger from '../logger.js'
const border = 2
@@ -202,6 +203,7 @@ export default defineComponent({
async onSubmit() {
this.loading = true
+
const currentDirectory = new URL(window.location.href).searchParams.get('dir') || '/'
// If the file doesn't have an extension, add the default one
@@ -210,6 +212,14 @@ export default defineComponent({
this.name = `${this.name}${this.provider?.extension ?? ''}`
}
+ if (this.selectedTemplate?.fields) {
+ spawnDialog(TemplateFiller, {
+ fields: this.selectedTemplate?.fields
+ })
+
+ return
+ }
+
try {
const fileInfo = await createFromTemplate(
normalize(`${currentDirectory}/${this.name}`),