Feature/add cofirmation dialogs (#513)

* add category/tag confirmation dialog

* add page delete confirmation

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden 2021-06-13 14:53:57 -08:00 committed by GitHub
parent af41b08a60
commit 30892dcb2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 4 deletions

View File

@ -22,7 +22,7 @@
<script> <script>
export default { export default {
name: "theButton", name: "TheButton",
props: { props: {
// Types // Types
cancel: { cancel: {

View File

@ -5,6 +5,7 @@
:style="{ zIndex: zIndex }" :style="{ zIndex: zIndex }"
@click:outside="cancel" @click:outside="cancel"
@keydown.esc="cancel" @keydown.esc="cancel"
@keydown.enter="confirm"
> >
<template v-slot:activator="{}"> <template v-slot:activator="{}">
<slot v-bind="{ open }"> </slot> <slot v-bind="{ open }"> </slot>

View File

@ -59,6 +59,7 @@
"custom": "Custom", "custom": "Custom",
"dashboard": "Dashboard", "dashboard": "Dashboard",
"delete": "Delete", "delete": "Delete",
"confirm-delete-generic": "Are you sure you want to delete this?",
"disabled": "Disabled", "disabled": "Disabled",
"download": "Download", "download": "Download",
"edit": "Edit", "edit": "Edit",
@ -188,6 +189,7 @@
"url-form-hint": "Copy and paste a link from your favorite recipe website" "url-form-hint": "Copy and paste a link from your favorite recipe website"
}, },
"page": { "page": {
"page": "Page",
"all-recipes": "All Recipes", "all-recipes": "All Recipes",
"home-page": "Home Page", "home-page": "Home Page",
"new-page-created": "New page created", "new-page-created": "New page created",

View File

@ -31,7 +31,16 @@
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<TheButton delete small minor @click="deletePage(item.id)" /> <ConfirmationDialog
:title="$t('page.page') + ' ' + $t('general.delete')"
:icon="$globals.icons.pages"
:message="$t('general.confirm-delete-generic')"
@confirm="deletePage(item.id)"
>
<template v-slot="{ open }">
<TheButton delete small minor @click="open" />
</template>
</ConfirmationDialog>
<v-spacer> </v-spacer> <v-spacer> </v-spacer>
<TheButton edit small @click="editPage(index)" /> <TheButton edit small @click="editPage(index)" />
</v-card-actions> </v-card-actions>
@ -49,11 +58,15 @@
<script> <script>
import draggable from "vuedraggable"; import draggable from "vuedraggable";
import CreatePageDialog from "./CreatePageDialog"; import CreatePageDialog from "./CreatePageDialog";
import ConfirmationDialog from "@/components/UI/Dialogs/ConfirmationDialog.vue";
import TheButton from "@/components/UI/Buttons/TheButton.vue";
import { api } from "@/api"; import { api } from "@/api";
export default { export default {
components: { components: {
draggable, draggable,
CreatePageDialog, CreatePageDialog,
ConfirmationDialog,
TheButton,
}, },
data() { data() {
return { return {

View File

@ -75,7 +75,16 @@
<v-card-title class="py-1">{{ item.name }}</v-card-title> <v-card-title class="py-1">{{ item.name }}</v-card-title>
<v-divider class="mx-2"></v-divider> <v-divider class="mx-2"></v-divider>
<v-card-actions> <v-card-actions>
<TheButton minor small delete @click="deleteItem(item.slug)" /> <ConfirmationDialog
:title="$t('general.confirm') + ' ' + $t('general.delete')"
:icon="$globals.icons.tags"
:message="$t('general.confirm-delete-generic')"
@confirm="deleteItem(item.slug)"
>
<template v-slot="{ open }">
<TheButton minor small delete @click="open"></TheButton>
</template>
</ConfirmationDialog>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<TheButton small edit @click="openEditDialog(item)" /> <TheButton small edit @click="openEditDialog(item)" />
</v-card-actions> </v-card-actions>
@ -95,6 +104,8 @@ import { validators } from "@/mixins/validators";
import RemoveUnused from "./RemoveUnused"; import RemoveUnused from "./RemoveUnused";
import BulkAssign from "./BulkAssign"; import BulkAssign from "./BulkAssign";
import NewCategoryTagDialog from "@/components/UI/Dialogs/NewCategoryTagDialog"; import NewCategoryTagDialog from "@/components/UI/Dialogs/NewCategoryTagDialog";
import ConfirmationDialog from "@/components/UI/Dialogs/ConfirmationDialog.vue";
import TheButton from "@/components/UI/Buttons/TheButton.vue";
export default { export default {
mixins: [validators], mixins: [validators],
components: { components: {
@ -104,6 +115,8 @@ export default {
RemoveUnused, RemoveUnused,
NewCategoryTagDialog, NewCategoryTagDialog,
BulkAssign, BulkAssign,
ConfirmationDialog,
TheButton,
}, },
props: { props: {
isTags: { isTags: {