Commit 4bbacb02 by Julian Arni

Re-add bar references

parent cab7c4ff
...@@ -144,6 +144,7 @@ ...@@ -144,6 +144,7 @@
require(["jquery", "jquery.fileupload"], function($) { require(["jquery", "jquery.fileupload"], function($) {
var file; var file;
var bar = $('.progress-bar');
var fill = $('.progress-fill'); var fill = $('.progress-fill');
var percent = $('.percent'); var percent = $('.percent');
var status = $('#status'); var status = $('#status');
...@@ -194,6 +195,7 @@ $('#fileupload').fileupload({ ...@@ -194,6 +195,7 @@ $('#fileupload').fileupload({
submitBtn.show(); submitBtn.show();
bar.hide(); bar.hide();
chooseBtn.html('${_("Choose new file")}').show(); chooseBtn.html('${_("Choose new file")}').show();
bar.hide();
} }
}); });
}); });
...@@ -205,6 +207,7 @@ $('#fileupload').fileupload({ ...@@ -205,6 +207,7 @@ $('#fileupload').fileupload({
progressall: function(e, data){ progressall: function(e, data){
var doneAt; var doneAt;
var percentInt = data.loaded / data.total * 100 var percentInt = data.loaded / data.total * 100
var percentVal = parseInt(percentInt, 10) + "%";
// Firefox makes ProgressEvent.loaded equal ProgressEvent.total only // Firefox makes ProgressEvent.loaded equal ProgressEvent.total only
// after receiving a response from the server (see Mozilla bug 637002), // after receiving a response from the server (see Mozilla bug 637002),
// so for Firefox we jump the gun a little. // so for Firefox we jump the gun a little.
...@@ -214,10 +217,16 @@ $('#fileupload').fileupload({ ...@@ -214,10 +217,16 @@ $('#fileupload').fileupload({
doneAt = 99; doneAt = 99;
} }
if (percentInt >= doneAt) { if (percentInt >= doneAt) {
bar.hide();
startServerFeedback(feedbackUrl.replace("fillerName", file.name)); startServerFeedback(feedbackUrl.replace("fillerName", file.name));
} } else {
bar.show();
fill.width(percentVal);
percent.html(percentVal);
}
}, },
done: function(e, data){ done: function(e, data){
bar.hide();
window.onbeforeunload = null; window.onbeforeunload = null;
displayFinishedImport(); displayFinishedImport();
alert('${_("Your import was successful.")}'); alert('${_("Your import was successful.")}');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment