Merge pull request #4344 from nextcloud/tag_creation_from_card_view
Tag creation from card view
This commit is contained in:
@@ -36,7 +36,8 @@
|
||||
label="title"
|
||||
track-by="id"
|
||||
@select="addLabelToCard"
|
||||
@remove="removeLabelFromCard">
|
||||
@remove="removeLabelFromCard"
|
||||
@tag="addLabelToBoardAndCard">
|
||||
<template #option="scope">
|
||||
<div :style="{ backgroundColor: '#' + scope.option.color, color: textColor(scope.option.color)}" class="tag">
|
||||
{{ scope.option.title }}
|
||||
@@ -342,8 +343,18 @@ export default {
|
||||
this.$store.dispatch('addLabel', data)
|
||||
},
|
||||
|
||||
removeLabelFromCard(removedLabel) {
|
||||
async addLabelToBoardAndCard(name) {
|
||||
const newLabel = await this.$store.dispatch('addLabelToCurrentBoardAndCard', {
|
||||
card: this.copiedCard,
|
||||
newLabel: {
|
||||
title: name,
|
||||
color: this.randomColor(),
|
||||
},
|
||||
})
|
||||
this.assignedLabels.push(newLabel)
|
||||
},
|
||||
|
||||
removeLabelFromCard(removedLabel) {
|
||||
const removeIndex = this.copiedCard.labels.findIndex((label) => {
|
||||
return label.id === removedLabel.id
|
||||
})
|
||||
|
||||
@@ -91,6 +91,8 @@ export default {
|
||||
return false
|
||||
|
||||
},
|
||||
|
||||
randomColor() {
|
||||
return Math.floor(Math.random() * (0xffffff + 1)).toString(16).padStart(6, '0')
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -273,7 +273,6 @@ export default new Vuex.Store({
|
||||
labelToUpdate.color = newLabel.color
|
||||
},
|
||||
addLabelToCurrentBoard(state, newLabel) {
|
||||
|
||||
state.currentBoard.labels.push(newLabel)
|
||||
},
|
||||
|
||||
@@ -465,6 +464,16 @@ export default new Vuex.Store({
|
||||
commit('addLabelToCurrentBoard', newLabel)
|
||||
})
|
||||
},
|
||||
async addLabelToCurrentBoardAndCard({ dispatch, commit }, { newLabel, card }) {
|
||||
newLabel.boardId = this.state.currentBoard.id
|
||||
const label = await apiClient.createLabel(newLabel)
|
||||
commit('addLabelToCurrentBoard', label)
|
||||
dispatch('addLabel', {
|
||||
card,
|
||||
labelId: label.id,
|
||||
})
|
||||
return label
|
||||
},
|
||||
|
||||
// acl actions
|
||||
async addAclToCurrentBoard({ dispatch, commit }, newAcl) {
|
||||
|
||||
Reference in New Issue
Block a user