Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add cofirmation dialogs #513

Merged
merged 2 commits into from
Jun 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/components/UI/Buttons/TheButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<script>
export default {
name: "theButton",
name: "TheButton",
props: {
// Types
cancel: {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/UI/Dialogs/ConfirmationDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
:style="{ zIndex: zIndex }"
@click:outside="cancel"
@keydown.esc="cancel"
@keydown.enter="confirm"
>
<template v-slot:activator="{}">
<slot v-bind="{ open }"> </slot>
<slot v-bind="{ open }"> </slot>
</template>
<v-card>
<v-app-bar v-if="Boolean(title)" :color="color" dense dark>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/messages/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"custom": "Custom",
"dashboard": "Dashboard",
"delete": "Delete",
"confirm-delete-generic": "Are you sure you want to delete this?",
"disabled": "Disabled",
"download": "Download",
"edit": "Edit",
Expand Down Expand Up @@ -188,6 +189,7 @@
"url-form-hint": "Copy and paste a link from your favorite recipe website"
},
"page": {
"page": "Page",
"all-recipes": "All Recipes",
"home-page": "Home Page",
"new-page-created": "New page created",
Expand Down
15 changes: 14 additions & 1 deletion frontend/src/pages/Admin/Settings/CustomPageCreator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@
</v-card-text>

<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>
<TheButton edit small @click="editPage(index)" />
</v-card-actions>
Expand All @@ -49,11 +58,15 @@
<script>
import draggable from "vuedraggable";
import CreatePageDialog from "./CreatePageDialog";
import ConfirmationDialog from "@/components/UI/Dialogs/ConfirmationDialog.vue";
import TheButton from "@/components/UI/Buttons/TheButton.vue";
import { api } from "@/api";
export default {
components: {
draggable,
CreatePageDialog,
ConfirmationDialog,
TheButton,
},
data() {
return {
Expand Down
15 changes: 14 additions & 1 deletion frontend/src/pages/Admin/ToolBox/CategoryTagEditor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,16 @@
<v-card-title class="py-1">{{ item.name }}</v-card-title>
<v-divider class="mx-2"></v-divider>
<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>
<TheButton small edit @click="openEditDialog(item)" />
</v-card-actions>
Expand All @@ -95,6 +104,8 @@ import { validators } from "@/mixins/validators";
import RemoveUnused from "./RemoveUnused";
import BulkAssign from "./BulkAssign";
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 {
mixins: [validators],
components: {
Expand All @@ -104,6 +115,8 @@ export default {
RemoveUnused,
NewCategoryTagDialog,
BulkAssign,
ConfirmationDialog,
TheButton,
},
props: {
isTags: {
Expand Down