Skip to content

Commit

Permalink
enh: Replace confirm dialog for deletion with modal
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
  • Loading branch information
Chartman123 committed Dec 19, 2023
1 parent 3b11ca8 commit 13fe22a
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/components/AppNavigationForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,23 @@
{{ t('forms', 'Copy form') }}
</NcActionButton>
<NcActionSeparator />
<NcActionButton :close-after-click="true" @click="onDeleteForm">
<NcActionButton :close-after-click="true" @click="showModal">
<template #icon>
<IconDelete :size="20" />
</template>
{{ t('forms', 'Delete form') }}
</NcActionButton>
<NcModal v-if="modal"
@close="closeModal">
<div class="modal__content">
<h2>{{ t('forms', 'Delete form') }}</h2>
<p>{{ t('forms', 'Are you sure you want to delete {title}?', { title: formTitle }) }}</p>
<NcButton type="error"
@click="onDeleteForm">
{{ t('forms', 'Delete form') }}
</NcButton>
</div>
</NcModal>
</template>
</NcListItem>
</template>
Expand All @@ -88,7 +99,9 @@ import { showError } from '@nextcloud/dialogs'
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import NcActionRouter from '@nextcloud/vue/dist/Components/NcActionRouter.js'
import NcActionSeparator from '@nextcloud/vue/dist/Components/NcActionSeparator.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcListItem from '@nextcloud/vue/dist/Components/NcListItem.js'
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
import axios from '@nextcloud/axios'
import moment from '@nextcloud/moment'
Expand Down Expand Up @@ -117,8 +130,10 @@ export default {
NcActionButton,
NcActionRouter,
NcActionSeparator,
NcButton,
NcListItem,
NcLoadingIcon,
NcModal,
},
props: {
Expand All @@ -135,6 +150,7 @@ export default {
data() {
return {
loading: false,
modal: false,
}
},
Expand Down Expand Up @@ -232,6 +248,21 @@ export default {
this.loading = false
}
},
showModal() {
this.modal = true
},
closeModal() {
this.modal = false
},
},
}
</script>

<style scoped>
.modal__content {
margin: 50px;
text-align: center;
}
</style>

0 comments on commit 13fe22a

Please sign in to comment.