undelete note WIP

This commit is contained in:
zadam
2020-01-03 13:14:43 +01:00
parent c1d0a1e07b
commit 14f3c783f2
7 changed files with 300 additions and 130 deletions

View File

@@ -41,9 +41,26 @@ export async function showDialog() {
$noteLink = $("<span>").text(change.current_title);
if (change.canBeUndeleted) {
const $undeleteLink = $(`<a href="javascript:">`)
.text("undelete")
.on('click', async () => {
const confirmDialog = await import('../dialogs/confirm.js');
const text = 'Do you want to undelete this note and its sub-notes?';
if (await confirmDialog.confirm(text)) {
await server.put(`notes/${change.noteId}/undelete`);
$dialog.modal('hide');
await treeCache.reloadNotes([change.noteId]);
treeService.activateNote(change.noteId);
}
});
$noteLink
.append(' (')
.append($(`<a href="">`).text("undelete"))
.append($undeleteLink)
.append(')');
}
}