diff --git a/src/components/board/TagsTabSidebard.vue b/src/components/board/TagsTabSidebard.vue
index 187c41732..d742185fb 100644
--- a/src/components/board/TagsTabSidebard.vue
+++ b/src/components/board/TagsTabSidebard.vue
@@ -3,14 +3,14 @@
@@ -25,7 +25,8 @@ export default {
name: 'TagsTabSidebard',
data() {
return {
- editingLabelId: null
+ editingLabelId: null,
+ editingLabel: null
}
},
computed: {
@@ -34,11 +35,16 @@ export default {
})
},
methods: {
+ clickEdit(label) {
+ this.editingLabelId = label.id
+ this.editingLabel = Object.assign({}, label)
+ },
deleteLabel(id) {
this.$store.dispatch('removeLabelFromCurrentBoard', id)
},
- updateLabel(id, name) {
-
+ updateLabel(label) {
+ this.$store.dispatch('updateLabelFromCurrentBoard', this.editingLabel)
+ this.editingLabelId = null
}
}
}
diff --git a/src/store/main.js b/src/store/main.js
index d750fe2fe..4b6de5ee5 100644
--- a/src/store/main.js
+++ b/src/store/main.js
@@ -140,12 +140,21 @@ export default new Vuex.Store({
// label mutators
removeLabelFromCurrentBoard(state, labelId) {
const removeIndex = state.currentBoard.labels.findIndex((l) => {
- return labelId !== l.id
+ return labelId === l.id
})
if (removeIndex > -1) {
state.currentBoard.labels.splice(removeIndex, 1)
}
+ },
+ updateLabelFromCurrentBoard(state, newLabel) {
+
+ let labelToUpdate = state.currentBoard.labels.find((l) => {
+ return newLabel.id === l.id
+ })
+
+ labelToUpdate.title = newLabel.title
+ labelToUpdate.color = newLabel.color
}
},
actions: {
@@ -227,6 +236,9 @@ export default new Vuex.Store({
// label actions
removeLabelFromCurrentBoard({ commit }, labelId) {
commit('removeLabelFromCurrentBoard', labelId);
- }
+ },
+ updateLabelFromCurrentBoard({ commit }, newLabel) {
+ commit('updateLabelFromCurrentBoard', newLabel);
+ },
}
-})
+})
\ No newline at end of file