Skip to content

Commit

Permalink
Board: Add checklist assignee (#1778)
Browse files Browse the repository at this point in the history
Signed-off-by: Dvinyanin Alexandr <dvinyanin.alexandr@gmail.com>
  • Loading branch information
Dvinyanin authored May 18, 2022
1 parent ae13a1f commit aa4f882
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions plugins/board-resources/src/components/editor/CardChecklist.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
-->
<script lang="ts">
import { Ref } from '@anticrm/core'
import { createQuery, getClient, MessageBox } from '@anticrm/presentation'
import { createQuery, getClient, UserBox, MessageBox } from '@anticrm/presentation'
import type { TodoItem } from '@anticrm/task'
import task from '@anticrm/task'
import { Button, CheckBox, TextAreaEditor, Icon, IconMoreH, Progress, showPopup } from '@anticrm/ui'
import { ContextMenu, HTMLPresenter } from '@anticrm/view-resources'
import contact, { Employee } from '@anticrm/contact'
import board from '../../plugin'
import { getPopupAlignment } from '../../utils/PopupUtils'
Expand Down Expand Up @@ -79,20 +80,18 @@
await client.addCollection(task.class.TodoItem, value.space, value._id, value._class, 'items', item)
}
function updateItemName (item: TodoItem, name: string) {
if (name === undefined || name.length === 0 || name === item.name) return
client.update(item, { name })
}
function updateName (event: CustomEvent<string>) {
isEditingName = false
const name = event.detail
if (name !== undefined && name.length > 0 && name !== value.name) {
value.name = name
client.update(value, { name: value.name })
}
updateItemName(value, event.detail)
}
function updateItemName (item: TodoItem, name: string) {
if (name !== undefined && name.length > 0 && name !== value.name) {
item.name = name
client.update(item, { name: item.name })
}
function updateItemAssignee (item: TodoItem, assignee: Ref<Employee>) {
client.update(item, { assignee })
}
async function setDoneToChecklistItem (item: TodoItem, event: CustomEvent<boolean>) {
Expand Down Expand Up @@ -208,6 +207,15 @@
<HTMLPresenter bind:value={item.name} />
</div>
<div class="flex-center">
<UserBox
_class={contact.class.Employee}
label={board.string.Assignee}
bind:value={item.assignee}
allowDeselect={true}
on:change={(e) => {
updateItemAssignee(item, e.detail)
}}
/>
<Button icon={IconMoreH} kind="transparent" size="small" on:click={(e) => showItemMenu(item, e)} />
</div>
{/if}
Expand Down

0 comments on commit aa4f882

Please sign in to comment.