mirror of
https://github.com/DCsunset/taskwarrior-webui.git
synced 2025-08-20 19:33:06 +02:00
feat(frontend): add confirmation before deleting and restoring
This commit is contained in:
parent
2da5ddd4ce
commit
e0c6f98cf9
2 changed files with 107 additions and 23 deletions
59
frontend/components/ConfirmationDialog.vue
Normal file
59
frontend/components/ConfirmationDialog.vue
Normal file
|
@ -0,0 +1,59 @@
|
|||
<template>
|
||||
<v-dialog
|
||||
v-model="showDialog"
|
||||
max-width="300px"
|
||||
@keydown.esc="handler('no')"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
{{ title }}
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
{{ text }}
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn text color="primary" @click="handler('no')">No</v-btn>
|
||||
<v-btn text color="red" @click="handler('yes')">Yes</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed } from '@vue/composition-api';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
value: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
setup(props, context) {
|
||||
const showDialog = computed({
|
||||
get: () => props.value,
|
||||
set: val => context.emit('input', val)
|
||||
});
|
||||
|
||||
const handler = (event: string) => {
|
||||
showDialog.value = false;
|
||||
context.emit(event);
|
||||
};
|
||||
|
||||
return {
|
||||
showDialog,
|
||||
handler
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue