Merge pull request #1853 from nextcloud/enh/archiveAllCardsFromStack

This commit is contained in:
Julius Härtl
2020-08-18 08:17:13 +02:00
committed by GitHub

View File

@@ -43,6 +43,9 @@
</form> </form>
</transition> </transition>
<Actions v-if="canManage && !isArchived" :force-menu="true"> <Actions v-if="canManage && !isArchived" :force-menu="true">
<ActionButton icon="icon-archive" @click="modalArchivAllCardsShow=true">
{{ t('deck', 'Archive all cards') }}
</ActionButton>
<ActionButton icon="icon-delete" @click="deleteStack(stack)"> <ActionButton icon="icon-delete" @click="deleteStack(stack)">
{{ t('deck', 'Delete list') }} {{ t('deck', 'Delete list') }}
</ActionButton> </ActionButton>
@@ -54,6 +57,19 @@
</Actions> </Actions>
</div> </div>
<Modal v-if="modalArchivAllCardsShow" @close="modalArchivAllCardsShow=false">
<div class="modal__content">
<h3>{{ t('deck', 'Archive all cards in this list') }}</h3>
<progress :value="stackTransfer.current" :max="stackTransfer.total" />
<button class="primary" @click="archiveAllCardsFromStack(stack)">
{{ t('deck', 'Archive all cards') }}
</button>
<button @click="modalArchivAllCardsShow=false">
{{ t('deck', 'Cancel') }}
</button>
</div>
</Modal>
<transition name="slide-top" appear> <transition name="slide-top" appear>
<div v-if="showAddCard" class="stack--card-add"> <div v-if="showAddCard" class="stack--card-add">
<form :class="{ 'icon-loading-small': stateCardCreating }" <form :class="{ 'icon-loading-small': stateCardCreating }"
@@ -99,7 +115,8 @@
import { mapGetters, mapState } from 'vuex' import { mapGetters, mapState } from 'vuex'
import { Container, Draggable } from 'vue-smooth-dnd' import { Container, Draggable } from 'vue-smooth-dnd'
import { Actions, ActionButton } from '@nextcloud/vue'
import { Actions, ActionButton, Modal } from '@nextcloud/vue'
import { showError } from '@nextcloud/dialogs' import { showError } from '@nextcloud/dialogs'
import CardItem from '../cards/CardItem' import CardItem from '../cards/CardItem'
@@ -111,6 +128,7 @@ export default {
CardItem, CardItem,
Container, Container,
Draggable, Draggable,
Modal,
}, },
props: { props: {
@@ -127,6 +145,11 @@ export default {
showAddCard: false, showAddCard: false,
stateCardCreating: false, stateCardCreating: false,
animate: false, animate: false,
modalArchivAllCardsShow: false,
stackTransfer: {
total: 0,
current: null,
},
} }
}, },
computed: { computed: {
@@ -183,6 +206,15 @@ export default {
deleteStack(stack) { deleteStack(stack) {
this.$store.dispatch('deleteStack', stack) this.$store.dispatch('deleteStack', stack)
}, },
archiveAllCardsFromStack(stack) {
this.stackTransfer.total = this.cardsByStack.length
this.cardsByStack.forEach((card, index) => {
this.stackTransfer.current = index
this.$store.dispatch('archiveUnarchiveCard', { ...card, archived: true })
})
this.modalArchivAllCardsShow = false
},
startEditing(stack) { startEditing(stack) {
this.copiedStack = Object.assign({}, stack) this.copiedStack = Object.assign({}, stack)
this.editing = true this.editing = true
@@ -315,4 +347,21 @@ export default {
height: 0px; height: 0px;
} }
.modal__content {
width: 25vw;
min-width: 250px;
min-height: 100px;
text-align: center;
margin: 20px 20px 20px 20px;
}
.modal__content button {
float: right;
}
progress {
margin-top: 3px;
margin-bottom: 30px;
}
</style> </style>