new functions

Signed-off-by: Jakob <jakob.roehrl@web.de>
This commit is contained in:
Jakob
2019-07-16 14:17:51 +02:00
committed by Julius Härtl
parent 70d3fba187
commit 38dc7945dd
8 changed files with 141 additions and 29 deletions

View File

@@ -12,7 +12,6 @@
</ul>
<h3>{{ t('deck', 'Deleted cards') }}</h3>
<ul>
<!-- <li ng-repeat="deletedCard in cardservice.deleted">
<span class="icon icon-deck"></span>
@@ -48,12 +47,7 @@ export default {
...mapState({
deletedStacks: state => state.deletedStacks
// deletedCards: state => state.deletedCards
}),
deletedCards() {
console.log(store.state.deletedCards)
return store.state.deletedCards
}
})
},
created() {

View File

@@ -120,7 +120,7 @@ export default {
boardId: this.stack.boardId
}
this.$store.dispatch('addCard', newCard)
},
}
}
}
</script>

View File

@@ -22,13 +22,37 @@
<template>
<app-sidebar v-if="currentCard != null"
:actions="[]"
:actions="toolbarActions"
:title="currentCard.title"
:subtitle="subtitle"
@close="closeSidebar">
<template #action />
<AppSidebarTab name="Details" icon="icon-home">
<p>Tags</p>
<multiselect v-model="addedLabelToCard" :options="currentBoard.labels" label="label"
@input="clickaddLabelToCard">
<template #option="scope">
{{ scope.option.title }}
</template>
</multiselect>
<p>Assign to user</p>
<multiselect v-model="addAclToCard" :options="unallocatedSharees" label="label"
@input="clickAddAclToCard" @search-change="asyncFind">
<template #option="scope">
{{ scope.option.label }}
</template>
</multiselect>
<p>Due to</p>
<DatetimePicker />
</AppSidebarTab>
<AppSidebarTab name="Description" icon="icon-description">
{{ currentCard.description }}
<textarea v-model="copiedCard.description" type="text" autofocus />
<input type="button" class="icon-confirm" @click="saveDesc()">
</AppSidebarTab>
<AppSidebarTab name="Attachments" icon="icon-files-dark">
{{ currentCard.attachments }}
@@ -40,33 +64,101 @@
</template>
<script>
import { AppSidebar, AppSidebarTab } from 'nextcloud-vue'
import { AppSidebar, AppSidebarTab, Multiselect, DatetimePicker } from 'nextcloud-vue'
import { mapState } from 'vuex'
export default {
name: 'CardSidebar',
components: {
AppSidebar,
AppSidebarTab
AppSidebarTab,
Multiselect,
DatetimePicker
},
data() {
return {
addAclToCard: null,
addedLabelToCard: null,
isLoading: false,
copiedCard: null
}
},
computed: {
...mapState({
currentCard: state => state.currentCard
currentCard: state => state.currentCard,
currentBoard: state => state.currentBoard,
sharees: 'sharees'
}),
subtitle() {
let lastModified = this.currentCard.lastModified
let createdAt = this.currentCard.createdAt
return t('deck', 'Modified') + ': ' + lastModified + ' ' + t('deck', 'Created') + ': ' + createdAt
},
unallocatedSharees() {
return this.sharees
/* return this.sharees.filter((sharee) => {
return Object.values(this.board.acl).findIndex((acl) => {
return acl.participant.uid === sharee.value.shareWith
})
}) */
},
toolbarActions() {
return [
{
action: () => {
},
icon: 'icon-archive-dark',
text: t('deck', 'Assign to me')
},
{
action: () => {
},
icon: 'icon-archive',
text: t('deck', (this.showArchived ? 'Unarchive card' : 'Archive card'))
}
]
}
},
watch: {
currentCard() {
this.copiedCard = JSON.parse(JSON.stringify(this.currentCard))
}
},
methods: {
saveDesc() {
this.$store.dispatch('updateCard', this.copiedCard)
},
asyncFind(query) {
this.isLoading = true
this.$store.dispatch('loadSharees').then(response => {
this.isLoading = false
})
},
closeSidebar() {
this.$router.push({ name: 'board' })
},
clickAddAclToCard() {
/* this.addAclForAPI = {
type: 0,
participant: this.addAcl.value.shareWith,
permissionEdit: false,
permissionShare: false,
permissionManage: false
}
this.$store.dispatch('addAclToCurrentBoard', this.addAclForAPI) */
},
clickaddLabelToCard() {
this.copiedCard.labels.push(this.addedLabelToCard)
let data = {
cardId: this.copiedCard.id,
labelId: this.addedLabelToCard.id
}
this.$store.dispatch('assignLabel', data)
}
}
}

View File

@@ -22,9 +22,9 @@
<template>
<div class="badges">
<div v-if="true" class="card-files icon icon-files-dark" />
<div v-if="true" class="card-comments icon icon-comment" />
<div v-if="true" :class="{'icon-calendar': true, 'icon-calendar-dark': false}" class="due icon now">
<div v-if="card.attechments" class="card-files icon icon-files-dark" />
<div v-if="card.description" class="card-comments icon icon-comment" />
<div v-if="card.duedate" :class="{'icon-calendar': true, 'icon-calendar-dark': false}" class="due icon now">
<span>Now</span>
</div>
<div v-if="true" class="card-tasks icon icon-checkmark">
@@ -50,6 +50,9 @@ export default {
computed: {
compactMode() {
return false
},
card() {
return this.$store.getters.cardById(this.id)
}
}
}

View File

@@ -34,10 +34,10 @@
</transition>
</div>
<ul class="labels">
<li v-for="label in labels" :key="label.id" :style="labelStyle(label)"><span>{{ label.title }}</span></li>
<li v-for="label in card.labels" :key="label.id" :style="labelStyle(label)"><span>{{ label.title }}</span></li>
</ul>
<div v-show="!compactMode" class="card-controls compact-item">
<card-badges />
<card-badges :id="id" />
</div>
</div>
</template>
@@ -82,12 +82,6 @@ export default {
menu() {
return []
},
labels() {
return [
{ id: 1, title: 'ToDo', color: 'aa0000' },
{ id: 2, title: 'Done', color: '33ff33' }
]
},
labelStyle() {
return (label) => {
return {

View File

@@ -75,7 +75,7 @@ export class CardApi {
}
assignUser(card) {
return axios.post(this.url(`/cards/${card.id}/assignUser`), card.newUserUid)
return axios.post(this.url(`/cards/${card.id}/assign`), card.newUserUid)
.then(
(response) => {
return Promise.resolve(response.data)
@@ -119,4 +119,19 @@ export class CardApi {
})
}
assignLabelToCard(data) {
return axios.post(this.url(`/cards/${data.cardId}/label/${data.labelId}`))
.then(
(response) => {
return Promise.resolve(response.data)
},
(err) => {
return Promise.reject(err)
}
)
.catch((err) => {
return Promise.reject(err)
})
}
}

View File

@@ -64,10 +64,18 @@ export default {
},
assignCardToMe(state, card) {
console.log(card)
let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
if (existingIndex !== -1) {
// let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
/* if (existingIndex !== -1) {
}
} */
},
updateCard(state, card) {
// console.log(card)
// new card is not returned!
// let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
/* if (existingIndex !== -1) {
state.cards[existingIndex] = card
} */
}
},
actions: {
@@ -105,6 +113,12 @@ export default {
.then((card) => {
commit('assignCardToMe', card)
})
},
assignLabel({ commit }, data) {
apiClient.assignLabelToCard(data)
.then((card) => {
commit('updateCard', card)
})
}
}
}