diff --git a/simplestore/etc/static/js/simplestore-deposit.js b/simplestore/etc/static/js/simplestore-deposit.js index 27a60d7802..ad9ff19e7b 100755 --- a/simplestore/etc/static/js/simplestore-deposit.js +++ b/simplestore/etc/static/js/simplestore-deposit.js @@ -105,14 +105,17 @@ function simplestore_init_plupload(selector, url, delete_url, get_file_url) { }); function setDepositBtnState() { - var nowUploading = false; + var disableDeposit = false; + if (!uploader.files.length) { + disableDeposit = true; + } $.each(uploader.files, function(i, file) { if (file.loaded < file.size) { - nowUploading = true; + disableDeposit = true; } }); - $('#deposit').toggleClass('disabled', nowUploading) - .attr('disabled', nowUploading ? 'disabled' : null); + $('#deposit').toggleClass('disabled', disableDeposit) + .attr('disabled', disableDeposit ? 'disabled' : null); } uploader.init(); @@ -150,7 +153,7 @@ function simplestore_init_plupload(selector, url, delete_url, get_file_url) { type: "POST", url: delete_url, data: $.param({ - filename: file.unique_filename + filename: file.name, }) }); } @@ -242,6 +245,7 @@ function simplestore_init_plupload(selector, url, delete_url, get_file_url) { $('#filelist #' + file.id).show('fast'); $('#' + file.id + '_rm').on("click", function(event){ uploader.removeFile(file); + setDepositBtnState(); }); }); setDepositBtnState(); diff --git a/simplestore/etc/templates/simplestore-deposit.html b/simplestore/etc/templates/simplestore-deposit.html index 507eab15e7..57227aae69 100755 --- a/simplestore/etc/templates/simplestore-deposit.html +++ b/simplestore/etc/templates/simplestore-deposit.html @@ -160,7 +160,7 @@