projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6d25b93
)
upload.js: moved the delete-an-attachment skeleton code to its own function
author
Art Cancro
<ajc@citadel.org>
Thu, 9 Nov 2023 23:44:52 +0000
(13:44 -1000)
committer
Art Cancro
<ajc@citadel.org>
Thu, 9 Nov 2023 23:44:52 +0000
(13:44 -1000)
webcit-ng/static/js/upload.js
patch
|
blob
|
history
diff --git
a/webcit-ng/static/js/upload.js
b/webcit-ng/static/js/upload.js
index 2d0751bafe0abfe382a103730e95b78560b9e7ad..ac72bbee8e8afc96f0ead6e61d499e767bd1201f 100644
(file)
--- a/
webcit-ng/static/js/upload.js
+++ b/
webcit-ng/static/js/upload.js
@@
-74,6
+74,19
@@
function handle_upload_files(files) {
}
}
+// Delete an uploaded item from the list
+delete_upload = async(ref) => {
+
+ response = await fetch(
+ "/ctdl/p/" + ref, { method: "DELETE" }
+ );
+
+ if (response.ok) { // If the server accepted the delete, remove it from the screen
+ // FIXME do the delete
+ }
+}
+
+
function upload_file(file) {
var url = '/ctdl/p/';
var xhr = new XMLHttpRequest();
function upload_file(file) {
var url = '/ctdl/p/';
var xhr = new XMLHttpRequest();
@@
-94,7
+107,7
@@
function upload_file(file) {
j_response.forEach((item) => {
let new_upl = document.createElement("li");
// item["ref"] is what we need
j_response.forEach((item) => {
let new_upl = document.createElement("li");
// item["ref"] is what we need
- new_upl.innerHTML = `<i class="fa-solid fa-circle-xmark" style="color:red" onClick="
alert
('` + item["ref"] + `')"></i>`
+ new_upl.innerHTML = `<i class="fa-solid fa-circle-xmark" style="color:red" onClick="
delete_upload
('` + item["ref"] + `')"></i>`
+ ` `
+ item["uploadfilename"] + " (" + item["contenttype"] + ", " + item["contentlength"] + " " + _("bytes") + ")";
document.getElementById("ctdl-upload_list").appendChild(new_upl);
+ ` `
+ item["uploadfilename"] + " (" + item["contenttype"] + ", " + item["contentlength"] + " " + _("bytes") + ")";
document.getElementById("ctdl-upload_list").appendChild(new_upl);