Skip to content

Commit 356c173

Browse files
authored
Merge pull request #3190 from nextcloud/backport/3188/stable5.2
[stable5.2] Format AppNavigationForm.vue (refs #3099)
2 parents f810095 + 80a5571 commit 356c173

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

src/components/AppNavigationForm.vue

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -86,33 +86,23 @@
8686
v-if="canEdit && !readOnly"
8787
close-after-click
8888
:disabled="isFormLocked"
89-
@click="showDeleteDialog = true">
89+
@click="onConfirmDelete">
9090
<template #icon>
9191
<IconDelete :size="20" />
9292
</template>
9393
{{ t('forms', 'Delete form') }}
9494
</NcActionButton>
95-
<NcDialog
96-
:open.sync="showDeleteDialog"
97-
:name="t('forms', 'Delete form')"
98-
:message="
99-
t('forms', 'Are you sure you want to delete {title}?', {
100-
title: formTitle,
101-
})
102-
"
103-
:buttons="buttons" />
10495
</template>
10596
</NcListItem>
10697
</template>
10798

10899
<script>
109100
import { getCurrentUser } from '@nextcloud/auth'
110101
import { generateOcsUrl } from '@nextcloud/router'
111-
import { showError } from '@nextcloud/dialogs'
102+
import { DialogSeverity, getDialogBuilder, showError } from '@nextcloud/dialogs'
112103
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
113104
import NcActionRouter from '@nextcloud/vue/components/NcActionRouter'
114105
import NcActionSeparator from '@nextcloud/vue/components/NcActionSeparator'
115-
import NcDialog from '@nextcloud/vue/components/NcDialog'
116106
import NcListItem from '@nextcloud/vue/components/NcListItem'
117107
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
118108
import axios from '@nextcloud/axios'
@@ -126,8 +116,6 @@ import IconPencil from 'vue-material-design-icons/PencilOutline.vue'
126116
import IconPoll from 'vue-material-design-icons/Poll.vue'
127117
import IconShareVariant from 'vue-material-design-icons/ShareVariantOutline.vue'
128118
129-
import IconDeleteSvg from '@mdi/svg/svg/delete.svg?raw'
130-
131119
import FormsIcon from './Icons/FormsIcon.vue'
132120
133121
import { FormState } from '../models/Constants.ts'
@@ -150,7 +138,6 @@ export default {
150138
NcActionButton,
151139
NcActionRouter,
152140
NcActionSeparator,
153-
NcDialog,
154141
NcListItem,
155142
NcLoadingIcon,
156143
},
@@ -176,17 +163,6 @@ export default {
176163
data() {
177164
return {
178165
loading: false,
179-
showDeleteDialog: false,
180-
buttons: [
181-
{
182-
label: t('forms', 'Delete form'),
183-
icon: IconDeleteSvg,
184-
type: 'error',
185-
callback: () => {
186-
this.onDeleteForm()
187-
},
188-
},
189-
],
190166
}
191167
},
192168
@@ -306,6 +282,33 @@ export default {
306282
this.$emit('clone', this.form.id)
307283
},
308284
285+
async onConfirmDelete() {
286+
const dialog = getDialogBuilder(t('forms', 'Delete form'))
287+
.setText(
288+
t('forms', 'Are you sure you want to delete {title}?', {
289+
title: this.formTitle,
290+
}),
291+
)
292+
.setSeverity(DialogSeverity.Error)
293+
.setButtons([
294+
{
295+
label: t('forms', 'Cancel'),
296+
callback: () => {},
297+
variant: 'secondary',
298+
},
299+
{
300+
label: t('forms', 'Delete form'),
301+
callback: () => {
302+
this.onDeleteForm()
303+
},
304+
variant: 'error',
305+
},
306+
])
307+
.build()
308+
309+
await dialog.show()
310+
},
311+
309312
async onToggleArchive() {
310313
try {
311314
// TODO: add loading status feedback ?

0 commit comments

Comments
 (0)