Fix modalTags

This commit is contained in:
Brieuc Dubois 2024-01-09 02:26:44 +01:00
parent 7aee5b03bb
commit 3c505670ed
4 changed files with 7 additions and 12 deletions

View File

@ -20,13 +20,11 @@
}
}}
>
<div class="title">{card.id} - {card.title}</div>
<div class="title">{card.title}</div>
<div class="tags">
{#each card.cardTags as tag}
{#if tag.option}
<span class="tag" style="border: 1px solid #333"
>{tag.projectTag.id}: {tag.option.id} ({tag.option.value})</span
>
<span class="tag" style="border: 1px solid #333">{tag.option.value}</span>
{:else if tag.value}
<span class="tag" style="border: 1px solid #333">{tag.value}</span>
{/if}

View File

@ -28,7 +28,7 @@
await $currentDraggedCard.addTag(primaryTag, option, null);
} else if (currentOption && !option) {
if (!currentCardTag) return;
await $currentDraggedCard.removeTag(currentCardTag);
await $currentDraggedCard.deleteTag(currentCardTag);
} else if (currentOption && option) {
if (!currentCardTag) return;
await $currentDraggedCard.updateTag(currentCardTag, option, null);

View File

@ -5,8 +5,6 @@
import CardTag from '$lib/types/CardTag';
import type ProjectTag from '$lib/types/ProjectTag';
import type TagOption from '$lib/types/TagOption';
import api, { processError } from '$lib/utils/api';
import status from '$lib/utils/status';
import TrashIcon from '../icons/TrashIcon.svelte';
export const multiple: boolean = false;
@ -25,12 +23,11 @@
if (cardTag) {
if (option) await cardTag.update(option, null);
else await cardTag.delete();
else await card.deleteTag(cardTag);
} else {
if (option) await CardTag.create(card, projectTag, option, null);
if (option) await card.addTag(projectTag, option, null);
}
isOpen = false;
cards.reload();
}
@ -55,7 +52,7 @@
<div class="tags">
{#if cardTag}
<span class="tag">
{cardTag.value}
{cardTag.option?.value}
<button class="real" on:click={() => selectOption(null)}>✗</button>
</span>
{/if}

View File

@ -102,7 +102,7 @@ export default class Card {
return true;
}
async removeTag(cardTag: CardTag): Promise<boolean> {
async deleteTag(cardTag: CardTag): Promise<boolean> {
const res = await cardTag.delete();
if (!res) return false;