#1472: Implement addLabelToBoardAndCard to also create Labels from the CardSidebar

Signed-off-by: Felix Schnabel <f.schnabel@tum.de>
This commit is contained in:
fschn
2022-11-28 17:40:02 +01:00
committed by Julius Härtl
parent d3cad6adf0
commit 6ed19bd2b0
3 changed files with 26 additions and 4 deletions

View File

@@ -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
})