diff --git a/templates/web/prod/upload/upload.html.twig b/templates/web/prod/upload/upload.html.twig index b8e244b0f9..a77fac737d 100644 --- a/templates/web/prod/upload/upload.html.twig +++ b/templates/web/prod/upload/upload.html.twig @@ -150,7 +150,7 @@ $(document).ready(function () { var totalElement; var maxFileSize = {{ maxFileSize }}; - + UploaderManager.Preview.setOptions({ maxWidth: 160, maxHeight: 120, @@ -338,7 +338,7 @@ $(document).ready(function () { return false; }, fail: function(){ - //disabled cancel-all button, if queue is emepty and last upload fail + //disabled cancel-all button, if queue is empty and last upload fail if (UploaderManager.Queue.isEmpty()){ $("#cancel-all").attr("disabled", true); } @@ -395,10 +395,12 @@ $(document).ready(function () { if (errorThrown === 'abort') { return false; } else { - data.context.find('.upload-record p.error').append(jqXHR.responseText); + data.context.find('.upload-record p.error').append(jqXHR.status + " " + jqXHR.statusText).show(); } //Remove data UploaderManager.removeData(data.uploadIndex); + // Remove cancel button + $('button.remove-element', data.context).remove(); }); //cancel request diff --git a/www/prod/jquery.Upload.js b/www/prod/jquery.Upload.js index aafa7b8798..5bb62bf697 100644 --- a/www/prod/jquery.Upload.js +++ b/www/prod/jquery.Upload.js @@ -183,16 +183,19 @@ var p4 = p4 || {}; if (typeof bits !== 'number') { throw bits + ' is not a number'; } - if (bits >= 1073741824) { - return (bits / 1073741824).toFixed(2) + ' Gbit/s'; + // 1 byte = 8 bits + var bytes = (bits >> 3); + + if (bytes >= (1 << 30)) { + return (bytes / (1 << 30)).toFixed(2) + ' Go/s'; } - if (bits >= 1048576) { - return (bits / 1048576).toFixed(2) + ' Mbit/s'; + if (bytes >= (1 << 20)) { + return (bytes / (1 << 20)).toFixed(2) + ' Mo/s'; } - if (bits >= 1024) { - return (bits / 1024).toFixed(2) + ' Kbit/s'; + if (bytes >= (1 << 10)) { + return (bytes / (1 << 10)).toFixed(2) + ' Ko/s'; } - return bits + ' bit/s'; + return bytes + ' o/s'; }, pourcent: function(current, total){ return (current/ total * 100).toFixed(2)