diff --git a/plugins/setting-resources/src/components/statuses/Templates.svelte b/plugins/setting-resources/src/components/statuses/Templates.svelte index 63f7a9357a..c542045952 100644 --- a/plugins/setting-resources/src/components/statuses/Templates.svelte +++ b/plugins/setting-resources/src/components/statuses/Templates.svelte @@ -55,6 +55,19 @@ title: 'New Template' }) + await client.addCollection( + task.class.StateTemplate, + space as Ref as Ref, + template, + task.class.KanbanTemplate, + 'statesC', + { + title: 'New State', + color: 9, + rank: [...genRanks(1)][0] + } + ) + const ranks = [...genRanks(2)] const doneStates = [ { @@ -99,14 +112,16 @@ {#each templates as t (t._id)}
select(t)}> -
{ - showPopup(ContextMenu, { object: t }, eventToHTMLElement(ev), () => {}) - }} - > - -
+ {#if templates.length > 1} +
{ + showPopup(ContextMenu, { object: t }, eventToHTMLElement(ev), () => {}) + }} + > + +
+ {/if}
{/each} diff --git a/plugins/task-resources/src/components/state/StatesEditor.svelte b/plugins/task-resources/src/components/state/StatesEditor.svelte index 31e2c85155..31c6769b11 100644 --- a/plugins/task-resources/src/components/state/StatesEditor.svelte +++ b/plugins/task-resources/src/components/state/StatesEditor.svelte @@ -118,19 +118,21 @@
-
{ - showPopup( - StatusesPopup, - { onDelete: () => dispatch('delete', { state }) }, - eventToHTMLElement(ev), - () => {} - ) - }} - > - -
+ {#if states.length > 1} +
{ + showPopup( + StatusesPopup, + { onDelete: () => dispatch('delete', { state }) }, + eventToHTMLElement(ev), + () => {} + ) + }} + > + +
+ {/if} {/if} {/each} diff --git a/plugins/task/src/index.ts b/plugins/task/src/index.ts index 451a3f1718..688144093c 100644 --- a/plugins/task/src/index.ts +++ b/plugins/task/src/index.ts @@ -257,6 +257,12 @@ export async function createKanban ( templateId?: Ref ): Promise> { if (templateId === undefined) { + await client.createDoc(task.class.State, attachedTo, { + title: 'New State', + color: 9, + rank: [...genRanks(1)][0] + }) + const ranks = [...genRanks(2)] await Promise.all([ client.createDoc(task.class.WonState, attachedTo, {