Skip to content

Commit

Permalink
fixes #1244 by enabling/disabling the 'Done' button based on the glob…
Browse files Browse the repository at this point in the history
…al upload progress, instead of individual file upload progress
  • Loading branch information
chalkos authored and luis100 committed Jun 5, 2018
1 parent 56b01f9 commit 6a13fd5
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ public static native void runMiniUploadForm() /*-{
$wnd.jQuery(this).parent().find('input').click();
});
$wnd.dropzoneUploaded = 0;
$wnd.dropzoneUploadTotal = 0;
// Initialize the jQuery File Upload plugin
$wnd
.jQuery('#upload')
Expand Down Expand Up @@ -171,6 +174,8 @@ public static native void runMiniUploadForm() /*-{
});
$wnd.dropzoneUploadTotal++;
// Automatically upload the file once it is added to the queue
var jqXHR = data.submit();
},
Expand All @@ -181,14 +186,22 @@ public static native void runMiniUploadForm() /*-{
var progress = parseInt(data.loaded
/ data.total * 100, 10);
if(progress == 100){
$wnd.dropzoneUploaded++;
}
var globalProgress = parseInt($wnd.dropzoneUploaded / $wnd.dropzoneUploadTotal * 100, 10);
// Update the hidden input field and trigger a change
// so that the jQuery knob plugin knows to update the dial
data.context.find('input').val(
progress).change();
if (progress == 100) {
data.context
.removeClass('working');
if(progress == 100){
data.context.removeClass('working');
}
if (globalProgress == 100) {
$wnd.jQuery('.btn').prop(
'disabled', false);
$wnd.jQuery('#upload-message')
Expand Down

0 comments on commit 6a13fd5

Please sign in to comment.