mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-31 04:38:02 +00:00
Use standart action for archive state (#1818)
Signed-off-by: Dvinyanin Alexandr <dvinyanin.alexandr@gmail.com>
This commit is contained in:
parent
efa67f4b4f
commit
f1af4bf2e4
@ -510,4 +510,30 @@ export function createModel (builder: Builder): void {
|
|||||||
},
|
},
|
||||||
task.action.Move
|
task.action.Move
|
||||||
)
|
)
|
||||||
|
|
||||||
|
createAction(
|
||||||
|
builder,
|
||||||
|
{
|
||||||
|
action: view.actionImpl.UpdateDocument,
|
||||||
|
actionProps: {
|
||||||
|
key: 'isArchived',
|
||||||
|
value: true,
|
||||||
|
ask: true,
|
||||||
|
label: task.string.Archive,
|
||||||
|
message: task.string.ArchiveConfirm
|
||||||
|
},
|
||||||
|
query: {
|
||||||
|
isArchived: { $nin: [true] }
|
||||||
|
},
|
||||||
|
label: task.string.Archive,
|
||||||
|
icon: task.icon.TaskState,
|
||||||
|
input: 'any',
|
||||||
|
category: task.category.Task,
|
||||||
|
target: task.class.State,
|
||||||
|
context: {
|
||||||
|
mode: ['context', 'browser']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
task.action.ArchiveState
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ export default mergeIds(taskId, task, {
|
|||||||
EditStatuses: '' as Ref<Action>,
|
EditStatuses: '' as Ref<Action>,
|
||||||
ArchiveSpace: '' as Ref<Action>,
|
ArchiveSpace: '' as Ref<Action>,
|
||||||
UnarchiveSpace: '' as Ref<Action>,
|
UnarchiveSpace: '' as Ref<Action>,
|
||||||
|
ArchiveState: '' as Ref<Action>,
|
||||||
Move: '' as Ref<Action>
|
Move: '' as Ref<Action>
|
||||||
},
|
},
|
||||||
actionImpl: {
|
actionImpl: {
|
||||||
|
@ -1,25 +1,29 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Button, Component, getPlatformColor, IconEdit, showPopup } from '@anticrm/ui'
|
import { Button, Component, getPlatformColor, IconEdit, showPopup } from '@anticrm/ui'
|
||||||
import { State } from '@anticrm/task'
|
import { State } from '@anticrm/task'
|
||||||
import { getElementPopupAlignment } from '../utils/PopupUtils'
|
|
||||||
import ListInlineActions from './editor/ListInlineActions.svelte'
|
|
||||||
import notification from '@anticrm/notification'
|
import notification from '@anticrm/notification'
|
||||||
|
import { ContextMenu } from '@anticrm/view-resources'
|
||||||
export let state: State
|
export let state: State
|
||||||
|
|
||||||
let ref: HTMLElement
|
const showMenu = async (ev: MouseEvent): Promise<void> => {
|
||||||
|
ev.preventDefault()
|
||||||
function onArchive () {
|
showPopup(
|
||||||
showPopup(ListInlineActions, { value: state }, getElementPopupAlignment(ref, { h: 'right', v: 'bottom' }))
|
ContextMenu,
|
||||||
|
{ object: state },
|
||||||
|
{
|
||||||
|
getBoundingClientRect: () => DOMRect.fromRect({ width: 1, height: 1, x: ev.clientX, y: ev.clientY })
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex-col h-16">
|
<div class="flex-col h-16">
|
||||||
<div class="h-2 border-radius-1" style="background-color: {getPlatformColor(state.color)}" />
|
<div class="h-2 border-radius-1" style="background-color: {getPlatformColor(state.color)}" />
|
||||||
<div class="flex-between h-full font-medium pr-2 pl-4" bind:this={ref}>
|
<div class="flex-between h-full font-medium pr-2 pl-4">
|
||||||
<span class="lines-limit-2">{state.title}</span>
|
<span class="lines-limit-2">{state.title}</span>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<Component is={notification.component.LastViewEditor} props={{ value: state }} />
|
<Component is={notification.component.LastViewEditor} props={{ value: state }} />
|
||||||
<Button icon={IconEdit} kind="transparent" on:click={onArchive} />
|
<Button icon={IconEdit} kind="transparent" on:click={showMenu} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { getClient } from '@anticrm/presentation'
|
|
||||||
import { State } from '@anticrm/task'
|
|
||||||
import { Button } from '@anticrm/ui'
|
|
||||||
import board from '../../plugin'
|
|
||||||
|
|
||||||
export let value: State
|
|
||||||
|
|
||||||
const client = getClient()
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#if value && !value.isArchived}
|
|
||||||
<div class="flex-col flex-gap-1">
|
|
||||||
<Button
|
|
||||||
icon={board.icon.Card}
|
|
||||||
label={board.string.ToArchive}
|
|
||||||
kind="no-border"
|
|
||||||
justify="left"
|
|
||||||
on:click={async () => {
|
|
||||||
client.update(value, { isArchived: true })
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
Loading…
Reference in New Issue
Block a user