Merge pull request #2330 from nextcloud/enh/ToastUndo2

undo with toasts
This commit is contained in:
Julius Härtl
2020-10-02 21:32:10 +02:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@@ -117,9 +117,11 @@ import { mapGetters, mapState } from 'vuex'
import { Container, Draggable } from 'vue-smooth-dnd' import { Container, Draggable } from 'vue-smooth-dnd'
import { Actions, ActionButton, Modal } from '@nextcloud/vue' import { Actions, ActionButton, Modal } from '@nextcloud/vue'
import { showError } from '@nextcloud/dialogs' import { showError, showUndo } from '@nextcloud/dialogs'
import CardItem from '../cards/CardItem' import CardItem from '../cards/CardItem'
import '@nextcloud/dialogs/styles/toast.scss'
export default { export default {
name: 'Stack', name: 'Stack',
components: { components: {
@@ -210,6 +212,7 @@ export default {
}, },
deleteStack(stack) { deleteStack(stack) {
this.$store.dispatch('deleteStack', stack) this.$store.dispatch('deleteStack', stack)
showUndo(t('deck', 'List deleted'), () => this.$store.dispatch('stackUndoDelete', stack))
}, },
archiveAllCardsFromStack(stack) { archiveAllCardsFromStack(stack) {

View File

@@ -75,6 +75,8 @@ import { mapGetters, mapState } from 'vuex'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import { getCurrentUser } from '@nextcloud/auth' import { getCurrentUser } from '@nextcloud/auth'
import { showUndo } from '@nextcloud/dialogs'
import '@nextcloud/dialogs/styles/toast.scss'
export default { export default {
name: 'CardMenu', name: 'CardMenu',
@@ -129,6 +131,7 @@ export default {
}, },
deleteCard() { deleteCard() {
this.$store.dispatch('deleteCard', this.card) this.$store.dispatch('deleteCard', this.card)
showUndo(t('deck', 'Card deleted'), () => this.$store.dispatch('cardUndoDelete', this.card))
}, },
archiveUnarchiveCard() { archiveUnarchiveCard() {
this.$store.dispatch('archiveUnarchiveCard', { ...this.card, archived: !this.card.archived }) this.$store.dispatch('archiveUnarchiveCard', { ...this.card, archived: !this.card.archived })