From 62e7cf89339ac585bdb72e78d90f0b468916436a Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 30 Oct 2020 13:50:43 -0400 Subject: Rig up button to remove attachments --- themes/alps/assets/attachments.js | 6 ++++++ themes/alps/assets/style.css | 1 + 2 files changed, 7 insertions(+) (limited to 'themes/alps/assets') diff --git a/themes/alps/assets/attachments.js b/themes/alps/assets/attachments.js index e519c29..a57b4c5 100644 --- a/themes/alps/assets/attachments.js +++ b/themes/alps/assets/attachments.js @@ -75,6 +75,12 @@ function attachFile(file) { }; attachments.push(attachment); attachmentsNode.appendChild(node); + node.querySelector("button").addEventListener("click", ev => { + attachment.xhr.abort(); + attachments = attachments.filter(a => a !== attachment); + node.remove(); + updateState(); + }); let formData = new FormData(); formData.append("attachments", file); diff --git a/themes/alps/assets/style.css b/themes/alps/assets/style.css index 389079c..388f25f 100644 --- a/themes/alps/assets/style.css +++ b/themes/alps/assets/style.css @@ -234,6 +234,7 @@ main.create-update #attachment-list .upload .filename { main.create-update #attachment-list .upload button { padding: inherit; + min-width: inherit; } main.create-update #attachment-list .upload .progress { -- cgit v1.2.3