diff --git a/cms/templates/import.html b/cms/templates/import.html index d1b779f141..9690de6ed4 100644 --- a/cms/templates/import.html +++ b/cms/templates/import.html @@ -144,6 +144,7 @@ require(["jquery", "jquery.fileupload"], function($) { var file; +var bar = $('.progress-bar'); var fill = $('.progress-fill'); var percent = $('.percent'); var status = $('#status'); @@ -194,6 +195,7 @@ $('#fileupload').fileupload({ submitBtn.show(); bar.hide(); chooseBtn.html('${_("Choose new file")}').show(); + bar.hide(); } }); }); @@ -205,6 +207,7 @@ $('#fileupload').fileupload({ progressall: function(e, data){ var doneAt; var percentInt = data.loaded / data.total * 100 + var percentVal = parseInt(percentInt, 10) + "%"; // Firefox makes ProgressEvent.loaded equal ProgressEvent.total only // after receiving a response from the server (see Mozilla bug 637002), // so for Firefox we jump the gun a little. @@ -214,10 +217,16 @@ $('#fileupload').fileupload({ doneAt = 99; } if (percentInt >= doneAt) { + bar.hide(); startServerFeedback(feedbackUrl.replace("fillerName", file.name)); - } + } else { + bar.show(); + fill.width(percentVal); + percent.html(percentVal); + } }, done: function(e, data){ + bar.hide(); window.onbeforeunload = null; displayFinishedImport(); alert('${_("Your import was successful.")}');