From 2669e6ae54a24e37c2eb71a24da7d88be55aaf1c Mon Sep 17 00:00:00 2001 From: Emanuel Dima Date: Wed, 26 Mar 2014 10:34:46 +0100 Subject: [PATCH] bug fix: deposit button disabled when there are no uploaded files --- simplestore/etc/static/js/simplestore-deposit.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/simplestore/etc/static/js/simplestore-deposit.js b/simplestore/etc/static/js/simplestore-deposit.js index 19c1c6e172..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();