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"> <div class="tags">
{#each card.cardTags as tag} {#each card.cardTags as tag}
{#if tag.option} {#if tag.option}
<span class="tag" style="border: 1px solid #333" <span class="tag" style="border: 1px solid #333">{tag.option.value}</span>
>{tag.projectTag.id}: {tag.option.id} ({tag.option.value})</span
>
{:else if tag.value} {:else if tag.value}
<span class="tag" style="border: 1px solid #333">{tag.value}</span> <span class="tag" style="border: 1px solid #333">{tag.value}</span>
{/if} {/if}

View File

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

View File

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

View File

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