From dd82165c77287acbf9ae1636fee99465cfb4ac60 Mon Sep 17 00:00:00 2001 From: Anna No Date: Mon, 25 Apr 2022 15:32:02 +0700 Subject: [PATCH] Board: Add open card inline menu (#1511) Signed-off-by: Anna No --- plugins/board-assets/lang/en.json | 1 + plugins/board-assets/lang/ru.json | 1 + .../src/components/KanbanCard.svelte | 8 ++--- .../editor/CardInlineActions.svelte | 10 ++++++ plugins/board-resources/src/index.ts | 21 ++++++------ plugins/board-resources/src/plugin.ts | 1 + .../board-resources/src/utils/BoardUtils.ts | 2 +- .../src/utils/CardActionUtils.ts | 5 +-- .../board-resources/src/utils/CardUtils.ts | 34 +++++++++++++------ 9 files changed, 54 insertions(+), 29 deletions(-) diff --git a/plugins/board-assets/lang/en.json b/plugins/board-assets/lang/en.json index 1740d2af96..e5c4c2ca8f 100644 --- a/plugins/board-assets/lang/en.json +++ b/plugins/board-assets/lang/en.json @@ -2,6 +2,7 @@ "string": { "Name": "Name", "CreateBoard": "Create board", + "OpenCard": "Open Card", "CreateCard": "Create card", "CardName": "Card name", "Cards": "Cards", diff --git a/plugins/board-assets/lang/ru.json b/plugins/board-assets/lang/ru.json index 53671d55b5..856d259414 100644 --- a/plugins/board-assets/lang/ru.json +++ b/plugins/board-assets/lang/ru.json @@ -2,6 +2,7 @@ "string": { "Name": "Название", "CreateBoard": "Создать", + "OpenCard": "Открыть", "CreateCard": "Создать", "CardName": "Название", "Cards": "Cards", diff --git a/plugins/board-resources/src/components/KanbanCard.svelte b/plugins/board-resources/src/components/KanbanCard.svelte index 5cdafd7a0b..c040207d64 100644 --- a/plugins/board-resources/src/components/KanbanCard.svelte +++ b/plugins/board-resources/src/components/KanbanCard.svelte @@ -21,13 +21,13 @@ import type { Ref, WithLookup } from '@anticrm/core' import notification from '@anticrm/notification' import { getClient, UserBoxList } from '@anticrm/presentation' - import { Button, Component, EditBox, IconEdit, Label, showPanel, showPopup } from '@anticrm/ui' + import { Button, Component, EditBox, IconEdit, Label, showPopup } from '@anticrm/ui' import board from '../plugin' - import { hasDate, updateCard } from '../utils/CardUtils' - import { getElementPopupAlignment } from '../utils/PopupUtils' import CardInlineActions from './editor/CardInlineActions.svelte' import CardLabels from './editor/CardLabels.svelte' import DatePresenter from './presenters/DatePresenter.svelte' + import { hasDate, openCardPanel, updateCard } from '../utils/CardUtils' + import { getElementPopupAlignment } from '../utils/PopupUtils' export let object: WithLookup @@ -53,7 +53,7 @@ } function showCard () { - showPanel(board.component.EditCard, object._id, object._class, 'middle') + openCardPanel(object) } function canDropAttachment (e: DragEvent): boolean { diff --git a/plugins/board-resources/src/components/editor/CardInlineActions.svelte b/plugins/board-resources/src/components/editor/CardInlineActions.svelte index 18472665b6..3a69a51a0e 100644 --- a/plugins/board-resources/src/components/editor/CardInlineActions.svelte +++ b/plugins/board-resources/src/components/editor/CardInlineActions.svelte @@ -17,14 +17,23 @@ import { getResource } from '@anticrm/platform' import { getClient } from '@anticrm/presentation' import { Button, Component } from '@anticrm/ui' + import { createEventDispatcher } from 'svelte' + import board from '../../plugin' import { cardActionSorter, getCardActions } from '../../utils/CardActionUtils' + import { openCardPanel } from '../../utils/CardUtils'; export let value: Card const client = getClient() + const dispatch = createEventDispatcher() let actions: CardAction[] = [] + function openCard () { + openCardPanel(value) + dispatch('close') + } + async function fetch () { actions = [] const result = await getCardActions(client, { isInline: true }) @@ -46,6 +55,7 @@ {#if value && !value.isArchived}
+