Add confirmation to delete a checklist (#1775)

This commit is contained in:
Alex 2022-05-18 11:03:48 +07:00 committed by GitHub
parent 077f666619
commit beb009acab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 11 deletions

View File

@ -104,6 +104,8 @@
"SwitchToCards": "Switch to cards", "SwitchToCards": "Switch to cards",
"SearchArchive": "Search archive...", "SearchArchive": "Search archive...",
"Size": "Size", "Size": "Size",
"RemoveCover": "Remove cover" "RemoveCover": "Remove cover",
"DeleteChecklist": "Delete checklist",
"DeleteChecklistConfirm": "Deleting a checklist is permanent and there is no way to get it back."
} }
} }

View File

@ -104,6 +104,8 @@
"SwitchToCards": "К карточкам", "SwitchToCards": "К карточкам",
"SearchArchive": "Поиск в архиве...", "SearchArchive": "Поиск в архиве...",
"Size": "Размер", "Size": "Размер",
"RemoveCover": "Удалить обложку" "RemoveCover": "Удалить обложку",
"DeleteChecklist": "Удалить список задач",
"DeleteChecklistConfirm": "Удаление списка задач необратимо, и не будет возможности его вернуть."
} }
} }

View File

@ -14,7 +14,7 @@
--> -->
<script lang="ts"> <script lang="ts">
import { Ref } from '@anticrm/core' import { Ref } from '@anticrm/core'
import { createQuery, getClient } from '@anticrm/presentation' import { createQuery, getClient, MessageBox } from '@anticrm/presentation'
import type { TodoItem } from '@anticrm/task' import type { TodoItem } from '@anticrm/task'
import task from '@anticrm/task' import task from '@anticrm/task'
import { Button, CheckBox, TextAreaEditor, Icon, IconMoreH, Progress, showPopup } from '@anticrm/ui' import { Button, CheckBox, TextAreaEditor, Icon, IconMoreH, Progress, showPopup } from '@anticrm/ui'
@ -39,13 +39,25 @@
if (!value) { if (!value) {
return return
} }
client.removeCollection( showPopup(
value._class, MessageBox,
value.space, {
value._id, label: board.string.DeleteChecklist,
value.attachedTo, message: board.string.DeleteChecklistConfirm
value.attachedToClass, },
value.collection undefined,
(result?: boolean) => {
if (result === true) {
client.removeCollection(
value._class,
value.space,
value._id,
value.attachedTo,
value.attachedToClass,
value.collection
)
}
}
) )
} }

View File

@ -125,7 +125,9 @@ export default mergeIds(boardId, board, {
SwitchToCards: '' as IntlString, SwitchToCards: '' as IntlString,
SearchArchive: '' as IntlString, SearchArchive: '' as IntlString,
Size: '' as IntlString, Size: '' as IntlString,
RemoveCover: '' as IntlString RemoveCover: '' as IntlString,
DeleteChecklist: '' as IntlString,
DeleteChecklistConfirm: '' as IntlString
}, },
component: { component: {
EditCard: '' as AnyComponent, EditCard: '' as AnyComponent,