From fe9b051c8799ec09ca407ee9cc9d13ff73150e46 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Wed, 25 Feb 2015 20:49:46 -0800 Subject: [PATCH] fix for derpie behavior of successmultiple firing for each upload --- views/dashboard.erb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/views/dashboard.erb b/views/dashboard.erb index 2683b1fe..d55d2a01 100644 --- a/views/dashboard.erb +++ b/views/dashboard.erb @@ -227,6 +227,8 @@ $('#uploadingOverlay').css('display', 'none') } + allUploadsComplete = false + Dropzone.options.uploads = { paramName: 'files', maxFilesize: <%= current_site.remaining_space.to_mb %>, @@ -235,8 +237,9 @@ dictDefaultMessage: '', uploadMultiple: true, init: function() { - this.on("successmultiple", function(file) { - location.reload() + this.on("completemultiple", function(file) { + if(allUploadsComplete == true) + location.reload() }) this.on("error", function(file, errorMessage) { @@ -246,6 +249,9 @@ }) this.on("totaluploadprogress", function(progress, totalBytes, totalBytesSent) { + if(progress == 100) + allUploadsComplete = true + showUploadProgress() $('#progressBar').css('display', 'block') $('#uploadingProgress').css('width', progress+'%')