diff options
author | Drew DeVault <sir@cmpwn.com> | 2020-10-30 13:50:43 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-10-30 13:50:43 -0400 |
commit | 62e7cf89339ac585bdb72e78d90f0b468916436a (patch) | |
tree | 7a8fbfb2770202af06e1e9d2c84facdee8b03180 | |
parent | 417d9bbd646248daebde2ab0ccc2fcbcb8911426 (diff) | |
download | alps-62e7cf89339ac585bdb72e78d90f0b468916436a.tar.gz alps-62e7cf89339ac585bdb72e78d90f0b468916436a.zip |
Rig up button to remove attachments
-rw-r--r-- | themes/alps/assets/attachments.js | 6 | ||||
-rw-r--r-- | themes/alps/assets/style.css | 1 |
2 files changed, 7 insertions, 0 deletions
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 { |