working on custom states for projects
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
estimated_time,
|
||||
show_closed,
|
||||
siblings,
|
||||
states = {},
|
||||
task
|
||||
} = $props();
|
||||
let children = $state(null);
|
||||
@@ -117,24 +118,24 @@
|
||||
</script>
|
||||
|
||||
{#if !deleted}
|
||||
<li draggable="true" {ondrop} ondragover={e => e.preventDefault()} {ondragstart} class="task {task.status.name.toLowerCase()}">
|
||||
<li draggable="true" {ondrop} ondragover={e => e.preventDefault()} {ondragstart} class="task {states[task.status].toLowerCase()}">
|
||||
<LineEditor bind:value={task.name} onclick={openTask} editable={true} onSet={setName} type="a" />
|
||||
{#if task.estimated_time}
|
||||
<span class="estimated_time">({+task.estimated_time} h)</span>
|
||||
{/if}
|
||||
{#if task.status.name != 'PENDING'}
|
||||
{#if states[task.status] != 'PENDING'}
|
||||
<button class="symbol" title={t('do_open')} onclick={() => patchTask({status:'PENDING'})}></button>
|
||||
{/if}
|
||||
{#if task.status.name != 'OPEN'}
|
||||
{#if states[task.status] != 'OPEN'}
|
||||
<button class="symbol" title={t('do_open')} onclick={() => patchTask({status:'OPEN'})}></button>
|
||||
{/if}
|
||||
{#if task.status.name != 'STARTED'}
|
||||
{#if states[task.status] != 'STARTED'}
|
||||
<button class="symbol" title={t('started')} onclick={() => patchTask({status:'STARTED'})}></button>
|
||||
{/if}
|
||||
{#if task.status.name != 'COMPLETE'}
|
||||
{#if states[task.status] != 'COMPLETE'}
|
||||
<button class="symbol" title={t('complete')} onclick={() => patchTask({status:'COMPLETE'})}></button>
|
||||
{/if}
|
||||
{#if task.status.name != 'CANCELLED'}
|
||||
{#if states[task.status] != 'CANCELLED'}
|
||||
<button class="symbol" title={t('abort')} onclick={() => patchTask({status:'CANCELLED'})} ></button>
|
||||
{/if}
|
||||
<button class="symbol" title={t('delete_task')} onclick={deleteTask} ></button>
|
||||
@@ -143,7 +144,7 @@
|
||||
<span class="error">{error}</span>
|
||||
{/if}
|
||||
{#if children}
|
||||
<TaskList tasks={children} {estimated_time} {show_closed} />
|
||||
<TaskList {states} tasks={children} {estimated_time} {show_closed} />
|
||||
{/if}
|
||||
</li>
|
||||
{/if}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import ListTask from './ListTask.svelte';
|
||||
|
||||
let { estimated_time, show_closed, tasks } = $props();
|
||||
let { estimated_time, show_closed, states = {}, tasks } = $props();
|
||||
|
||||
let sortedTasks = $derived.by(() => Object.values(tasks).sort((a, b) => a.name.localeCompare(b.name)));
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
|
||||
<ul>
|
||||
{#each sortedTasks as task}
|
||||
<ListTask {task} siblings={tasks} {estimated_time} show_closed={show_closed || task.show_closed} />
|
||||
<ListTask {states} {task} siblings={tasks} {estimated_time} show_closed={show_closed || task.show_closed} />
|
||||
{/each}
|
||||
</ul>
|
||||
@@ -181,7 +181,7 @@
|
||||
<tr>
|
||||
<th>{t('state')}</th>
|
||||
<td>
|
||||
<StateSelector selected={task.status.code} onchange={val => update({status:val})} project_id={task.project_id} />
|
||||
<StateSelector selected={task.status} onchange={val => update({status:val})} project_id={task.project_id} />
|
||||
</td>
|
||||
</tr>
|
||||
{#if task.description}
|
||||
|
||||
Reference in New Issue
Block a user