State templates minor fixes (#1736)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov 2022-05-13 12:31:41 +06:00 committed by GitHub
parent 3019d1e790
commit 5e7c320fb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 21 deletions

View File

@ -55,6 +55,19 @@
title: 'New Template'
})
await client.addCollection(
task.class.StateTemplate,
space as Ref<Doc> as Ref<Space>,
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)}
<div class="ac-column__list-item" class:selected={t._id === template?._id} on:click={() => select(t)}>
<AttributeEditor maxWidth={'15rem'} _class={task.class.KanbanTemplate} object={t} key="title" />
<div
class="hover-trans"
on:click|stopPropagation={(ev) => {
showPopup(ContextMenu, { object: t }, eventToHTMLElement(ev), () => {})
}}
>
<IconMoreH size={'medium'} />
</div>
{#if templates.length > 1}
<div
class="hover-trans"
on:click|stopPropagation={(ev) => {
showPopup(ContextMenu, { object: t }, eventToHTMLElement(ev), () => {})
}}
>
<IconMoreH size={'medium'} />
</div>
{/if}
</div>
{/each}
</div>

View File

@ -118,19 +118,21 @@
<div class="flex-grow caption-color">
<AttributeEditor maxWidth={'20rem'} _class={state._class} object={state} key="title" />
</div>
<div
class="tool hover-trans"
on:click={(ev) => {
showPopup(
StatusesPopup,
{ onDelete: () => dispatch('delete', { state }) },
eventToHTMLElement(ev),
() => {}
)
}}
>
<IconMoreH size={'medium'} />
</div>
{#if states.length > 1}
<div
class="tool hover-trans"
on:click={(ev) => {
showPopup(
StatusesPopup,
{ onDelete: () => dispatch('delete', { state }) },
eventToHTMLElement(ev),
() => {}
)
}}
>
<IconMoreH size={'medium'} />
</div>
{/if}
</div>
{/if}
{/each}

View File

@ -257,6 +257,12 @@ export async function createKanban (
templateId?: Ref<KanbanTemplate>
): Promise<Ref<Kanban>> {
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, {