Skip to content

Commit 5e00ee3

Browse files
authored
Merge pull request #3188 from don9x2E/chore/3099-appnav-format
Format AppNavigationForm.vue (refs #3099)
2 parents 449e2f8 + 5891e3a commit 5e00ee3

1 file changed

Lines changed: 29 additions & 25 deletions

File tree

src/components/AppNavigationForm.vue

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

10798
<script>
108-
import IconDeleteSvg from '@mdi/svg/svg/delete.svg?raw'
10999
import { getCurrentUser } from '@nextcloud/auth'
110100
import axios from '@nextcloud/axios'
111-
import { showError } from '@nextcloud/dialogs'
101+
import { DialogSeverity, getDialogBuilder, showError } from '@nextcloud/dialogs'
112102
import moment from '@nextcloud/moment'
113103
import { generateOcsUrl } from '@nextcloud/router'
114104
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
115105
import NcActionRouter from '@nextcloud/vue/components/NcActionRouter'
116106
import NcActionSeparator from '@nextcloud/vue/components/NcActionSeparator'
117-
import NcDialog from '@nextcloud/vue/components/NcDialog'
118107
import NcListItem from '@nextcloud/vue/components/NcListItem'
119108
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
120109
import IconArchiveOff from 'vue-material-design-icons/ArchiveOffOutline.vue'
@@ -146,7 +135,6 @@ export default {
146135
NcActionButton,
147136
NcActionRouter,
148137
NcActionSeparator,
149-
NcDialog,
150138
NcListItem,
151139
NcLoadingIcon,
152140
},
@@ -182,17 +170,6 @@ export default {
182170
data() {
183171
return {
184172
loading: false,
185-
showDeleteDialog: false,
186-
buttons: [
187-
{
188-
label: t('forms', 'Delete form'),
189-
icon: IconDeleteSvg,
190-
type: 'error',
191-
callback: () => {
192-
this.onDeleteForm()
193-
},
194-
},
195-
],
196173
}
197174
},
198175
@@ -312,6 +289,33 @@ export default {
312289
this.$emit('clone', this.form.id)
313290
},
314291
292+
async onConfirmDelete() {
293+
const dialog = getDialogBuilder(t('forms', 'Delete form'))
294+
.setText(
295+
t('forms', 'Are you sure you want to delete {title}?', {
296+
title: this.formTitle,
297+
}),
298+
)
299+
.setSeverity(DialogSeverity.Error)
300+
.setButtons([
301+
{
302+
label: t('forms', 'Cancel'),
303+
callback: () => {},
304+
variant: 'secondary',
305+
},
306+
{
307+
label: t('forms', 'Delete form'),
308+
callback: () => {
309+
this.onDeleteForm()
310+
},
311+
variant: 'error',
312+
},
313+
])
314+
.build()
315+
316+
await dialog.show()
317+
},
318+
315319
async onToggleArchive() {
316320
try {
317321
// TODO: add loading status feedback ?

0 commit comments

Comments
 (0)