summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Koch Michael <charlie8913@gmail.com> 2014-06-01 22:16:13 +0200
committerGravatar Koch Michael <charlie8913@gmail.com> 2014-06-01 22:27:52 +0200
commit29d6ab2c5f5089f7e3f6c0de67a0212eacbbd068 (patch)
tree03fbebcc6d46cca08ad7873ace5e13d4e7e87ea6
parentRevert "Merge branch 'fix-uploadedto'" (diff)
downloadpyload-29d6ab2c5f5089f7e3f6c0de67a0212eacbbd068.tar.xz
Show correct Value for 'Traffic left' in Accounts View
afaik all the traffic values are in KiB, so the byte-value it has to be multiplied by 1024 for the accounts View to show it correctly
-rw-r--r--pyload/web/app/scripts/helpers/formatSize.js8
-rw-r--r--pyload/web/app/templates/default/accounts/account.html4
2 files changed, 8 insertions, 4 deletions
diff --git a/pyload/web/app/scripts/helpers/formatSize.js b/pyload/web/app/scripts/helpers/formatSize.js
index f72d62158..ddd62a1a5 100644
--- a/pyload/web/app/scripts/helpers/formatSize.js
+++ b/pyload/web/app/scripts/helpers/formatSize.js
@@ -3,7 +3,11 @@ define('helpers/formatSize', ['handlebars', 'utils/i18n'], function(Handlebars,
'use strict';
var sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB'];
- function formatSize(bytes, options) {
+ function formatSize(bytes, options, multiplier) {
+ //multiplier 1024 is used for trafficleft because trafficleft is in KiB
+ if (typeof multiplier === 'number')
+ bytes = bytes * multiplier;
+
if (!bytes || bytes === 0) return '0 B';
if (bytes === -1)
return i18n.gettext('not available');
@@ -17,4 +21,4 @@ define('helpers/formatSize', ['handlebars', 'utils/i18n'], function(Handlebars,
Handlebars.registerHelper('formatSize', formatSize);
return formatSize;
-}); \ No newline at end of file
+});
diff --git a/pyload/web/app/templates/default/accounts/account.html b/pyload/web/app/templates/default/accounts/account.html
index 7039eae8c..65704db10 100644
--- a/pyload/web/app/templates/default/accounts/account.html
+++ b/pyload/web/app/templates/default/accounts/account.html
@@ -22,7 +22,7 @@
</div>
<div class="span2 account-data">
{{_ "Traffic left:"}}<br>
- {{ formatSize trafficleft }}
+ {{ formatSize trafficleft 0 1024 }}
</div>
<div class="span2 account-data">
{{_ "Valid until:"}}<br>
@@ -38,4 +38,4 @@
<button type="button" class="btn btn-blue"><i class="icon-pencil"></i></button>
<button type="button" class="btn btn-yellow"><i class="icon-refresh"></i></button>
<button type="button" class="btn btn-danger"><i class="icon-trash"></i></button>
-</div> \ No newline at end of file
+</div>