Tweak progress template to better handle reset to 0%

for those tasks which invoke the progress meter multiple times
This commit is contained in:
Lance Edgar 2017-02-16 19:44:31 -06:00
parent 24831af231
commit 35126e8e5b

View file

@ -78,16 +78,19 @@
$('#total').html('done!'); $('#total').html('done!');
$('#complete').css('width', '100%'); $('#complete').css('width', '100%');
$('#remaining').hide(); $('#remaining').hide();
$('#percentage').html('100%'); $('#percentage').html('100 %');
location.href = data.success_url; location.href = data.success_url;
} else { } else {
var width = parseInt(data.value) / parseInt(data.maximum); var width = parseInt(data.value) / parseInt(data.maximum);
width = Math.round(100 * width); width = Math.round(100 * width);
if (width > 0) { if (width) {
$('#complete').css('width', width+'%'); $('#complete').css('width', width+'%');
$('#remaining').css('width', 'auto'); $('#percentage').html(width+' %');
} else {
$('#complete').css('width', '0.01%');
$('#percentage').html('0 %');
} }
$('#percentage').html(width+'%'); $('#remaining').css('width', 'auto');
} }
} }
}, },