From 2cf160d497e501bf254bd8be054c0f5880ab90ca Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sat, 8 Jun 2013 17:37:43 +0200 Subject: restructured webui to single-page-app, removed jinja --- module/web/app/scripts/helpers/formatTime.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 module/web/app/scripts/helpers/formatTime.js (limited to 'module/web/app/scripts/helpers/formatTime.js') diff --git a/module/web/app/scripts/helpers/formatTime.js b/module/web/app/scripts/helpers/formatTime.js new file mode 100644 index 000000000..77d67a39c --- /dev/null +++ b/module/web/app/scripts/helpers/formatTime.js @@ -0,0 +1,17 @@ +// Format bytes in human readable format +define('helpers/formatTime', ['handlebars', 'utils/remaining'], function(Handlebars, Remaining) { + + + function formatTime(seconds, options) { + if (seconds === Infinity) + return '∞'; + else if (!seconds || seconds <= 0) + return "-"; + + // TODO: digital or written string + return Remaining.getStringDigital(seconds, window.dates); + } + + Handlebars.registerHelper('formatTime', formatTime); + return formatTime; +}); \ No newline at end of file -- cgit v1.2.3