Skip to content

Commit

Permalink
Board: Add checklists info (#1772)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dvinyanin authored May 18, 2022
1 parent 56c6288 commit 077f666
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/board-resources/src/components/KanbanCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import DatePresenter from './presenters/DatePresenter.svelte'
import { hasDate, openCardPanel, updateCard, updateCardMembers } from '../utils/CardUtils'
import { getElementPopupAlignment } from '../utils/PopupUtils'
import CheckListsPresenter from './presenters/ChecklistsPresenter.svelte'
export let object: WithLookup<Card>
Expand Down Expand Up @@ -186,6 +187,11 @@
<CommentsPresenter value={object} />
</div>
{/if}
{#if (object.todoItems ?? 0) > 0}
<div class="float-left">
<CheckListsPresenter value={object} />
</div>
{/if}
</div>
</div>
{#if (object.members?.length ?? 0) > 0}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script lang="ts">
import { Icon } from '@anticrm/ui'
import board, { Card } from '@anticrm/board'
import { createQuery } from '@anticrm/presentation'
import task, { TodoItem } from '@anticrm/task'
import { Ref } from '@anticrm/core'
export let value: Card
export let size: 'small' | 'medium' | 'large' = 'small'
const todoListQuery = createQuery()
let todoLists: Ref<TodoItem>[]
$: todoListQuery.query(task.class.TodoItem, { space: value.space, attachedTo: value._id }, (result) => {
todoLists = result.map(({ _id }) => _id)
})
const query = createQuery()
let done: number, total: number
$: query.query(task.class.TodoItem, { space: value.space, attachedTo: { $in: todoLists } }, (result) => {
total = result.total
done = result.filter((t) => t.done).length
})
</script>

{#if value && (total ?? 0) > 0}
<div class="sm-tool-icon ml-1 mr-1">
<Icon icon={board.icon.Card} {size} />
&nbsp;{done}/{total}
</div>
{/if}

0 comments on commit 077f666

Please sign in to comment.