feat(task wizard): add label removal
This commit is contained in:
parent
8c61d99393
commit
bfb8ab407b
1 changed files with 11 additions and 0 deletions
|
@ -45,6 +45,7 @@
|
||||||
:style="{'background': label.hexColor, 'color': label.textColor}"
|
:style="{'background': label.hexColor, 'color': label.textColor}"
|
||||||
class="tag mr-2">
|
class="tag mr-2">
|
||||||
<span>{{ label.title }}</span>
|
<span>{{ label.title }}</span>
|
||||||
|
<BaseButton @click="removeLabel(label)" class="delete is-small"/>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -122,6 +123,16 @@ const realLabels = computed<ILabel[]>(() => {
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function removeLabel(label: ILabel) {
|
||||||
|
while (true) { // Using a loop to remove all labels, including possible duplicates added via quick add magic
|
||||||
|
const index = labels.value.findIndex(el => el.toLowerCase() === label.title.toLowerCase())
|
||||||
|
if (index === -1) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
labels.value.splice(index, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function create() {
|
async function create() {
|
||||||
if (newTask.value.title === '') {
|
if (newTask.value.title === '') {
|
||||||
errorMessage.value = t('list.create.addTitleRequired')
|
errorMessage.value = t('list.create.addTitleRequired')
|
||||||
|
|
Loading…
Reference in a new issue