Skip to content
Merged
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
51 changes: 50 additions & 1 deletion src/components/board/Stack.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
</form>
</transition>
<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)">
{{ t('deck', 'Delete list') }}
</ActionButton>
Expand All @@ -54,6 +57,19 @@
</Actions>
</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>
<div v-if="showAddCard" class="stack--card-add">
<form :class="{ 'icon-loading-small': stateCardCreating }"
Expand Down Expand Up @@ -99,7 +115,8 @@

import { mapGetters, mapState } from 'vuex'
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 CardItem from '../cards/CardItem'

Expand All @@ -111,6 +128,7 @@ export default {
CardItem,
Container,
Draggable,
Modal,
},

props: {
Expand All @@ -127,6 +145,11 @@ export default {
showAddCard: false,
stateCardCreating: false,
animate: false,
modalArchivAllCardsShow: false,
stackTransfer: {
total: 0,
current: null,
},
}
},
computed: {
Expand Down Expand Up @@ -183,6 +206,15 @@ export default {
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) {
this.copiedStack = Object.assign({}, stack)
this.editing = true
Expand Down Expand Up @@ -315,4 +347,21 @@ export default {
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>