mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-23 22:12:44 +03:00
Add ArchiveCard action (#1456)
Signed-off-by: Dvinyanin Alexandr <dvinyanin.alexandr@gmail.com>
This commit is contained in:
parent
f043b7a2e1
commit
5b54ab7c46
@ -28,7 +28,7 @@ import KanbanView from './components/KanbanView.svelte'
|
||||
import CardLabelsPicker from './components/popups/CardLabelsPicker.svelte'
|
||||
import MoveView from './components/popups/MoveCard.svelte'
|
||||
import DateRangePicker from './components/popups/DateRangePicker.svelte'
|
||||
import { addCurrentUser, canAddCurrentUser, isArchived, isUnarchived } from './utils/CardUtils'
|
||||
import { addCurrentUser, canAddCurrentUser, isArchived, isUnarchived, archiveCard, unarchiveCard, deleteCard } from './utils/CardUtils'
|
||||
|
||||
async function showMoveCardPopup (object: Card): Promise<void> {
|
||||
showPopup(MoveView, { object })
|
||||
@ -57,7 +57,10 @@ export default async (): Promise<Resources> => ({
|
||||
Join: addCurrentUser,
|
||||
Move: showMoveCardPopup,
|
||||
Dates: showDatePickerPopup,
|
||||
Labels: showCardLabelsPopup
|
||||
Labels: showCardLabelsPopup,
|
||||
Archive: archiveCard,
|
||||
SendToBoard: unarchiveCard,
|
||||
Delete: deleteCard
|
||||
},
|
||||
cardActionSupportedHandler: {
|
||||
Join: canAddCurrentUser,
|
||||
|
@ -9,6 +9,10 @@ export function updateCard (client: Client, card: Card, field: string, value: an
|
||||
client.update(card, { [field]: value })
|
||||
}
|
||||
|
||||
export function deleteCard (card: Card, client: Client): void {
|
||||
client.remove(card)
|
||||
}
|
||||
|
||||
export function isArchived (card: Card): boolean {
|
||||
return !!card.isArchived
|
||||
}
|
||||
@ -45,3 +49,11 @@ export function addCurrentUser (card: Card, client: Client): void {
|
||||
members.push(employee)
|
||||
updateCard(client, card, 'members', members)
|
||||
}
|
||||
|
||||
export function archiveCard (card: Card, client: Client): void {
|
||||
updateCard(client, card, 'isArchived', true)
|
||||
}
|
||||
|
||||
export function unarchiveCard (card: Card, client: Client): void {
|
||||
updateCard(client, card, 'isArchived', false)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user