feat(task wizard): add label removal

This commit is contained in:
kolaente 2022-09-22 19:18:16 +02:00
parent 8c61d99393
commit bfb8ab407b
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

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