From 5752b987c13a0ef24b677f1970c9e3c0d4417fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20R=C3=B6hrl?= Date: Mon, 28 Sep 2020 14:38:54 +0200 Subject: [PATCH] undo with toasts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakob Röhrl --- src/components/board/Stack.vue | 5 ++++- src/components/cards/CardMenu.vue | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/board/Stack.vue b/src/components/board/Stack.vue index 782d4255e..8d3fb9009 100644 --- a/src/components/board/Stack.vue +++ b/src/components/board/Stack.vue @@ -117,9 +117,11 @@ import { mapGetters, mapState } from 'vuex' import { Container, Draggable } from 'vue-smooth-dnd' import { Actions, ActionButton, Modal } from '@nextcloud/vue' -import { showError } from '@nextcloud/dialogs' +import { showError, showUndo } from '@nextcloud/dialogs' import CardItem from '../cards/CardItem' +import '@nextcloud/dialogs/styles/toast.scss' + export default { name: 'Stack', components: { @@ -210,6 +212,7 @@ export default { }, deleteStack(stack) { this.$store.dispatch('deleteStack', stack) + showUndo(t('deck', 'List deleted'), () => this.$store.dispatch('stackUndoDelete', stack)) }, archiveAllCardsFromStack(stack) { diff --git a/src/components/cards/CardMenu.vue b/src/components/cards/CardMenu.vue index f75e305d8..e0ca222a7 100644 --- a/src/components/cards/CardMenu.vue +++ b/src/components/cards/CardMenu.vue @@ -75,6 +75,8 @@ import { mapGetters, mapState } from 'vuex' import axios from '@nextcloud/axios' import { generateUrl } from '@nextcloud/router' import { getCurrentUser } from '@nextcloud/auth' +import { showUndo } from '@nextcloud/dialogs' +import '@nextcloud/dialogs/styles/toast.scss' export default { name: 'CardMenu', @@ -129,6 +131,7 @@ export default { }, deleteCard() { this.$store.dispatch('deleteCard', this.card) + showUndo(t('deck', 'Card deleted'), () => this.$store.dispatch('cardUndoDelete', this.card)) }, archiveUnarchiveCard() { this.$store.dispatch('archiveUnarchiveCard', { ...this.card, archived: !this.card.archived })