mirror of
https://github.com/nextcloud/server.git
synced 2026-03-14 06:32:26 -04:00
feat: TemplateFiller component
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
This commit is contained in:
parent
d3bfcec7ea
commit
e65f318fdf
2 changed files with 24 additions and 4 deletions
|
|
@ -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: {},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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}`),
|
||||
|
|
|
|||
Loading…
Reference in a new issue