now with a nice modal

Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
This commit is contained in:
Jakob Röhrl
2020-05-13 12:12:25 +02:00
parent b53163d208
commit 1a917bb548

View File

@@ -40,12 +40,12 @@
</form> </form>
</transition> </transition>
<Actions v-if="canManage" :force-menu="true"> <Actions v-if="canManage" :force-menu="true">
<ActionButton icon="icon-archive" @click="modalShow=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>
<ActionButton icon="icon-archive" @click="archiveAllCardsFromStack(stack)">
{{ t('deck', 'Archive all cards in this list') }}
</ActionButton>
</Actions> </Actions>
<Actions v-if="canEdit && !showArchived"> <Actions v-if="canEdit && !showArchived">
<ActionButton icon="icon-add" @click.stop="showAddCard=true"> <ActionButton icon="icon-add" @click.stop="showAddCard=true">
@@ -54,6 +54,19 @@
</Actions> </Actions>
</div> </div>
<Modal v-if="modalShow" title="Archive all cards in this list" @close="modalShow=false">
<div class="modal__content">
<h3>Archive all cards in this list</h3>
<progress :value="archiveAllCardsProgress" :max="stackLen" />
<button class="primary" @click="archiveAllCardsFromStack(stack)">
{{ t('deck', 'Archive all cards') }}
</button>
<button @click="modalShow=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 +112,7 @@
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 CardItem from '../cards/CardItem' import CardItem from '../cards/CardItem'
export default { export default {
@@ -110,6 +123,7 @@ export default {
CardItem, CardItem,
Container, Container,
Draggable, Draggable,
Modal,
}, },
props: { props: {
@@ -126,6 +140,9 @@ export default {
showAddCard: false, showAddCard: false,
stateCardCreating: false, stateCardCreating: false,
animate: false, animate: false,
modalShow: false,
archiveAllCardsProgress: null,
stackLen: 0,
} }
}, },
computed: { computed: {
@@ -182,9 +199,13 @@ export default {
this.$store.dispatch('deleteStack', stack) this.$store.dispatch('deleteStack', stack)
}, },
archiveAllCardsFromStack(stack) { archiveAllCardsFromStack(stack) {
this.cardsByStack.forEach(card => {
this.stackLen = this.cardsByStack.length
this.cardsByStack.forEach((card, index) => {
this.archiveAllCardsProgress = index
this.$store.dispatch('archiveUnarchiveCard', { ...card, archived: true }) this.$store.dispatch('archiveUnarchiveCard', { ...card, archived: true })
}) })
this.modalShow = false
}, },
startEditing(stack) { startEditing(stack) {
this.copiedStack = Object.assign({}, stack) this.copiedStack = Object.assign({}, stack)
@@ -307,4 +328,25 @@ export default {
height: 0px; height: 0px;
} }
.modal__content {
width: 25vw;
min-width: 250px;
min-height: 100px;
text-align: center;
margin: 20px 20px 20px 20px;
.multiselect {
margin-bottom: 10px;
}
}
.modal__content button {
float: right;
}
progress {
margin-top: 3px;
margin-bottom: 30px;
}
</style> </style>