feat(task wizard): add label removal

This commit is contained in:
kolaente 2022-09-22 19:18:16 +02:00
parent 8c61d99393
commit bfb8ab407b
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 11 additions and 0 deletions

View File

@ -45,6 +45,7 @@
:style="{'background': label.hexColor, 'color': label.textColor}"
class="tag mr-2">
<span>{{ label.title }}</span>
<BaseButton @click="removeLabel(label)" class="delete is-small"/>
</span>
</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() {
if (newTask.value.title === '') {
errorMessage.value = t('list.create.addTitleRequired')