wip attachment widget

This commit is contained in:
zadam
2023-04-01 13:58:53 +02:00
parent fa406d3ded
commit 53aebf1448
4 changed files with 31 additions and 104 deletions

View File

@@ -1,5 +1,6 @@
import BasicWidget from "../basic_widget.js";
import server from "../../services/server.js";
import dialogService from "../../services/dialog.js";
const TPL = `
<div class="dropdown attachment-actions">
@@ -39,9 +40,12 @@ export default class AttachmentActionsWidget extends BasicWidget {
doRender() {
this.$widget = $(TPL);
this.$widget.on('click', '.dropdown-item', () => this.$widget.find("[data-toggle='dropdown']").dropdown('toggle'));
}
async deleteAttachmentCommand() {
await server.remove(`notes/${this.attachment.parentId}/attachments/${this.attachment.attachmentId}`);
if (await dialogService.confirm(`Are you sure you want to delete attachment '${this.attachment.title}'?`)) {
await server.remove(`notes/${this.attachment.parentId}/attachments/${this.attachment.attachmentId}`);
}
}
}