summaryrefslogtreecommitdiffstats
path: root/pyload/web/app/scripts/helpers/linkStatus.js
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/web/app/scripts/helpers/linkStatus.js')
-rw-r--r--pyload/web/app/scripts/helpers/linkStatus.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/pyload/web/app/scripts/helpers/linkStatus.js b/pyload/web/app/scripts/helpers/linkStatus.js
new file mode 100644
index 000000000..2497785fb
--- /dev/null
+++ b/pyload/web/app/scripts/helpers/linkStatus.js
@@ -0,0 +1,18 @@
+define('helpers/linkStatus', ['underscore', 'handlebars', 'utils/apitypes', 'utils/i18n'],
+ function(_, Handlebars, Api, i18n) {
+ 'use strict';
+ function linkStatus(status) {
+ var s;
+ if (status === Api.DownloadStatus.Online)
+ s = '<span class="text-success">' + i18n.gettext('online') + '</span>';
+ else if (status === Api.DownloadState.Offline)
+ s = '<span class="text-error">' + i18n.gettext('offline') + '</span>';
+ else
+ s = '<span class="text-info">' + i18n.gettext('unknown') + '</span>';
+
+ return new Handlebars.SafeString(s);
+ }
+
+ Handlebars.registerHelper('linkStatus', linkStatus);
+ return linkStatus;
+ });