diff --git a/src/UI/Form/FormBuilder.js b/src/UI/Form/FormBuilder.js
index 8385628ce..e901cca5d 100644
--- a/src/UI/Form/FormBuilder.js
+++ b/src/UI/Form/FormBuilder.js
@@ -2,34 +2,40 @@ var Marionette = require('marionette');
var Handlebars = require('handlebars');
var _ = require('underscore');
-module.exports = (function(){
- var _fieldBuilder = function(field){
- if(!field.type) {
- return _templateRenderer.apply(field, ['Form/TextboxTemplate']);
- }
- if(field.type === 'password') {
- return _templateRenderer.apply(field, ['Form/PasswordTemplate']);
- }
- if(field.type === 'checkbox') {
- return _templateRenderer.apply(field, ['Form/CheckboxTemplate']);
- }
- if(field.type === 'select') {
- return _templateRenderer.apply(field, ['Form/SelectTemplate']);
- }
- if(field.type === 'path') {
- return _templateRenderer.apply(field, ['Form/PathTemplate']);
- }
- return _templateRenderer.apply(field, ['Form/TextboxTemplate']);
- };
- var _templateRenderer = function(templateName){
- var templateFunction = Marionette.TemplateCache.get(templateName);
- return new Handlebars.SafeString(templateFunction(this));
- };
- Handlebars.registerHelper('formBuilder', function(){
- var ret = '';
- _.each(this.fields, function(field){
- ret += _fieldBuilder(field);
- });
- return new Handlebars.SafeString(ret);
+var _templateRenderer = function(templateName) {
+ var templateFunction = Marionette.TemplateCache.get(templateName);
+ return new Handlebars.SafeString(templateFunction(this));
+};
+
+var _fieldBuilder = function(field) {
+ if (!field.type) {
+ return _templateRenderer.call(field, 'Form/TextboxTemplate');
+ }
+
+ if (field.type === 'password') {
+ return _templateRenderer.call(field, 'Form/PasswordTemplate');
+ }
+
+ if (field.type === 'checkbox') {
+ return _templateRenderer.call(field, 'Form/CheckboxTemplate');
+ }
+
+ if (field.type === 'select') {
+ return _templateRenderer.call(field, 'Form/SelectTemplate');
+ }
+
+ if (field.type === 'path') {
+ return _templateRenderer.call(field, 'Form/PathTemplate');
+ }
+
+ return _templateRenderer.call(field, 'Form/TextboxTemplate');
+};
+
+Handlebars.registerHelper('formBuilder', function() {
+ var ret = '';
+ _.each(this.fields, function(field) {
+ ret += _fieldBuilder(field);
});
-}).call(this);
\ No newline at end of file
+
+ return new Handlebars.SafeString(ret);
+});
\ No newline at end of file
diff --git a/src/UI/Handlebars/Handlebars.Debug.js b/src/UI/Handlebars/Handlebars.Debug.js
index 74dfb2648..84360f665 100644
--- a/src/UI/Handlebars/Handlebars.Debug.js
+++ b/src/UI/Handlebars/Handlebars.Debug.js
@@ -1,9 +1,7 @@
var Handlebars = require('handlebars');
-module.exports = (function(){
- Handlebars.registerHelper('debug', function(){
- console.group('Handlebar context');
- console.log(this);
- console.groupEnd();
- });
-}).call(this);
\ No newline at end of file
+Handlebars.registerHelper('debug', function() {
+ console.group('Handlebar context');
+ console.log(this);
+ console.groupEnd();
+});
\ No newline at end of file
diff --git a/src/UI/Handlebars/Helpers/DateTime.js b/src/UI/Handlebars/Helpers/DateTime.js
index 3e0923557..18a5f7cbc 100644
--- a/src/UI/Handlebars/Helpers/DateTime.js
+++ b/src/UI/Handlebars/Helpers/DateTime.js
@@ -3,70 +3,88 @@ var moment = require('moment');
var FormatHelpers = require('../../Shared/FormatHelpers');
var UiSettings = require('../../Shared/UiSettingsModel');
-module.exports = (function(){
- Handlebars.registerHelper('ShortDate', function(input){
- if(!input) {
- return '';
- }
- var date = moment(input);
- var result = '' + date.format(UiSettings.get('shortDateFormat')) + '';
- return new Handlebars.SafeString(result);
- });
- Handlebars.registerHelper('RelativeDate', function(input){
- if(!input) {
- return '';
- }
- var date = moment(input);
- var result = '{1}';
- var tooltip = date.format(UiSettings.longDateTime());
- var text;
- if(UiSettings.get('showRelativeDates')) {
- text = FormatHelpers.relativeDate(input);
- }
- else {
- text = date.format(UiSettings.get('shortDateFormat'));
- }
- result = result.format(tooltip, text);
- return new Handlebars.SafeString(result);
- });
- Handlebars.registerHelper('Day', function(input){
- if(!input) {
- return '';
- }
- return moment(input).format('DD');
- });
- Handlebars.registerHelper('Month', function(input){
- if(!input) {
- return '';
- }
- return moment(input).format('MMM');
- });
- Handlebars.registerHelper('StartTime', function(input){
- if(!input) {
- return '';
- }
- return moment(input).format(UiSettings.time(false, false));
- });
- Handlebars.registerHelper('LTS', function(input){
- if(!input) {
- return '';
- }
- return moment(input).format(UiSettings.time(true, true));
- });
- Handlebars.registerHelper('if_today', function(context, options){
- var date = moment(context).startOf('day');
- var today = moment().startOf('day');
- if(date.isSame(today)) {
- return options.fn(this);
- }
- return options.inverse(this);
- });
- Handlebars.registerHelper('unless_today', function(context, options){
- var date = moment(context).startOf('day');
- var today = moment().startOf('day');
- if(date.isSame(today)) {
- return options.inverse(this);
- }
+Handlebars.registerHelper('ShortDate', function(input) {
+ if (!input) {
+ return '';
+ }
+
+ var date = moment(input);
+ var result = '' + date.format(UiSettings.get('shortDateFormat')) + '';
+
+ return new Handlebars.SafeString(result);
+});
+
+Handlebars.registerHelper('RelativeDate', function(input) {
+ if (!input) {
+ return '';
+ }
+
+ var date = moment(input);
+ var result = '{1}';
+ var tooltip = date.format(UiSettings.longDateTime());
+ var text;
+
+ if (UiSettings.get('showRelativeDates')) {
+ text = FormatHelpers.relativeDate(input);
+ } else {
+ text = date.format(UiSettings.get('shortDateFormat'));
+ }
+
+ result = result.format(tooltip, text);
+
+ return new Handlebars.SafeString(result);
+});
+
+Handlebars.registerHelper('Day', function(input) {
+ if (!input) {
+ return '';
+ }
+
+ return moment(input).format('DD');
+});
+
+Handlebars.registerHelper('Month', function(input) {
+ if (!input) {
+ return '';
+ }
+
+ return moment(input).format('MMM');
+});
+
+Handlebars.registerHelper('StartTime', function(input) {
+ if (!input) {
+ return '';
+ }
+
+ return moment(input).format(UiSettings.time(false, false));
+});
+
+Handlebars.registerHelper('LTS', function(input) {
+ if (!input) {
+ return '';
+ }
+
+ return moment(input).format(UiSettings.time(true, true));
+});
+
+Handlebars.registerHelper('if_today', function(context, options) {
+ var date = moment(context).startOf('day');
+ var today = moment().startOf('day');
+
+ if (date.isSame(today)) {
return options.fn(this);
- });
-}).call(this);
\ No newline at end of file
+ }
+
+ return options.inverse(this);
+});
+
+Handlebars.registerHelper('unless_today', function(context, options) {
+ var date = moment(context).startOf('day');
+ var today = moment().startOf('day');
+
+ if (date.isSame(today)) {
+ return options.inverse(this);
+ }
+
+ return options.fn(this);
+});
\ No newline at end of file
diff --git a/src/UI/Handlebars/Helpers/EachReverse.js b/src/UI/Handlebars/Helpers/EachReverse.js
index 4f5aa7f9b..7e5e0983a 100644
--- a/src/UI/Handlebars/Helpers/EachReverse.js
+++ b/src/UI/Handlebars/Helpers/EachReverse.js
@@ -1,17 +1,16 @@
var Handlebars = require('handlebars');
-module.exports = (function(){
- Handlebars.registerHelper('eachReverse', function(context){
- var options = arguments[arguments.length - 1];
- var ret = '';
- if(context && context.length > 0) {
- for (var i = context.length - 1; i >= 0; i--) {
- ret += options.fn(context[i]);
- }
+Handlebars.registerHelper('eachReverse', function(context) {
+ var options = arguments[arguments.length - 1];
+ var ret = '';
+
+ if (context && context.length > 0) {
+ for (var i = context.length - 1; i >= 0; i--) {
+ ret += options.fn(context[i]);
}
- else {
- ret = options.inverse(this);
- }
- return ret;
- });
-}).call(this);
\ No newline at end of file
+ } else {
+ ret = options.inverse(this);
+ }
+
+ return ret;
+});
\ No newline at end of file
diff --git a/src/UI/Handlebars/Helpers/Enumerable.js b/src/UI/Handlebars/Helpers/Enumerable.js
index 8a2229485..ae7f8708d 100644
--- a/src/UI/Handlebars/Helpers/Enumerable.js
+++ b/src/UI/Handlebars/Helpers/Enumerable.js
@@ -1,18 +1,21 @@
var Handlebars = require('handlebars');
-module.exports = (function(){
- Handlebars.registerHelper('times', function(n, block){
- var accum = '';
- for (var i = 0; i < n; ++i) {
- accum += block.fn(i);
- }
- return accum;
- });
- Handlebars.registerHelper('for', function(from, to, incr, block){
- var accum = '';
- for (var i = from; i < to; i += incr) {
- accum += block.fn(i);
- }
- return accum;
- });
-}).call(this);
\ No newline at end of file
+Handlebars.registerHelper('times', function(n, block) {
+ var accum = '';
+
+ for (var i = 0; i < n; ++i) {
+ accum += block.fn(i);
+ }
+
+ return accum;
+});
+
+Handlebars.registerHelper('for', function(from, to, incr, block) {
+ var accum = '';
+
+ for (var i = from; i < to; i += incr) {
+ accum += block.fn(i);
+ }
+
+ return accum;
+});
\ No newline at end of file
diff --git a/src/UI/Handlebars/Helpers/Episode.js b/src/UI/Handlebars/Helpers/Episode.js
index c5c6210df..96f3f392a 100644
--- a/src/UI/Handlebars/Helpers/Episode.js
+++ b/src/UI/Handlebars/Helpers/Episode.js
@@ -3,51 +3,59 @@ var FormatHelpers = require('../../Shared/FormatHelpers');
var moment = require('moment');
require('../../Activity/Queue/QueueCollection');
-module.exports = (function(){
- Handlebars.registerHelper('EpisodeNumber', function(){
- if(this.series.seriesType === 'daily') {
- return moment(this.airDate).format('L');
+Handlebars.registerHelper('EpisodeNumber', function() {
+
+ if (this.series.seriesType === 'daily') {
+ return moment(this.airDate).format('L');
+ } else if (this.series.seriesType === 'anime' && this.absoluteEpisodeNumber !== undefined) {
+ return '{0}x{1} ({2})'.format(this.seasonNumber, FormatHelpers.pad(this.episodeNumber, 2), FormatHelpers.pad(this.absoluteEpisodeNumber, 2));
+ } else {
+ return '{0}x{1}'.format(this.seasonNumber, FormatHelpers.pad(this.episodeNumber, 2));
+ }
+});
+
+Handlebars.registerHelper('StatusLevel', function() {
+ var hasFile = this.hasFile;
+ var downloading = require('../../Activity/Queue/QueueCollection').findEpisode(this.id) || this.downloading;
+ var currentTime = moment();
+ var start = moment(this.airDateUtc);
+ var end = moment(this.end);
+
+ if (hasFile) {
+ return 'success';
+ }
+
+ if (downloading) {
+ return 'purple';
+ }
+
+ if (this.episodeNumber === 1) {
+ return 'premiere';
+ }
+
+ if (currentTime.isAfter(start) && currentTime.isBefore(end)) {
+ return 'warning';
+ }
+
+ if (start.isBefore(currentTime) && !hasFile) {
+ return 'danger';
+ }
+
+ return 'primary';
+});
+
+Handlebars.registerHelper('EpisodeProgressClass', function() {
+ if (this.episodeFileCount === this.episodeCount) {
+ if (this.status === 'continuing') {
+ return '';
}
- else if(this.series.seriesType === 'anime' && this.absoluteEpisodeNumber !== undefined) {
- return '{0}x{1} ({2})'.format(this.seasonNumber, FormatHelpers.pad(this.episodeNumber, 2), FormatHelpers.pad(this.absoluteEpisodeNumber, 2));
- }
- else {
- return '{0}x{1}'.format(this.seasonNumber, FormatHelpers.pad(this.episodeNumber, 2));
- }
- });
- Handlebars.registerHelper('StatusLevel', function(){
- var hasFile = this.hasFile;
- var downloading = require('../../Activity/Queue/QueueCollection').findEpisode(this.id) || this.downloading;
- var currentTime = moment();
- var start = moment(this.airDateUtc);
- var end = moment(this.end);
- if(hasFile) {
- return 'success';
- }
- if(downloading) {
- return 'purple';
- }
- if(this.episodeNumber === 1) {
- return 'premiere';
- }
- if(currentTime.isAfter(start) && currentTime.isBefore(end)) {
- return 'warning';
- }
- if(start.isBefore(currentTime) && !hasFile) {
- return 'danger';
- }
- return 'primary';
- });
- Handlebars.registerHelper('EpisodeProgressClass', function(){
- if(this.episodeFileCount === this.episodeCount) {
- if(this.status === 'continuing') {
- return '';
- }
- return 'progress-bar-success';
- }
- if(this.monitored) {
- return 'progress-bar-danger';
- }
- return 'progress-bar-warning';
- });
-}).call(this);
\ No newline at end of file
+
+ return 'progress-bar-success';
+ }
+
+ if (this.monitored) {
+ return 'progress-bar-danger';
+ }
+
+ return 'progress-bar-warning';
+});
\ No newline at end of file
diff --git a/src/UI/Handlebars/Helpers/Html.js b/src/UI/Handlebars/Helpers/Html.js
index 2d8aac92d..1866fd139 100644
--- a/src/UI/Handlebars/Helpers/Html.js
+++ b/src/UI/Handlebars/Helpers/Html.js
@@ -2,25 +2,29 @@ var $ = require('jquery');
var Handlebars = require('handlebars');
var StatusModel = require('../../System/StatusModel');
-module.exports = (function(){
- var placeholder = StatusModel.get('urlBase') + '/Content/Images/poster-dark.png';
- window.NzbDrone.imageError = function(img){
- if(!img.src.contains(placeholder)) {
- img.src = placeholder;
- $(img).addClass('placeholder-image');
- }
- img.onerror = null;
- };
- Handlebars.registerHelper('defaultImg', function(src, size){
- if(!src) {
- return new Handlebars.SafeString('onerror="window.NzbDrone.imageError(this);"');
- }
- if(size) {
- src = src.replace(/\.jpg($|\?)/g, '-' + size + '.jpg$1');
- }
- return new Handlebars.SafeString('src="{0}" onerror="window.NzbDrone.imageError(this);"'.format(src));
- });
- Handlebars.registerHelper('UrlBase', function(){
- return new Handlebars.SafeString(StatusModel.get('urlBase'));
- });
-}).call(this);
\ No newline at end of file
+var placeholder = StatusModel.get('urlBase') + '/Content/Images/poster-dark.png';
+
+window.NzbDrone.imageError = function(img) {
+ if (!img.src.contains(placeholder)) {
+ img.src = placeholder;
+ $(img).addClass('placeholder-image');
+ }
+
+ img.onerror = null;
+};
+
+Handlebars.registerHelper('defaultImg', function(src, size) {
+ if (!src) {
+ return new Handlebars.SafeString('onerror="window.NzbDrone.imageError(this);"');
+ }
+
+ if (size) {
+ src = src.replace(/\.jpg($|\?)/g, '-' + size + '.jpg$1');
+ }
+
+ return new Handlebars.SafeString('src="{0}" onerror="window.NzbDrone.imageError(this);"'.format(src));
+});
+
+Handlebars.registerHelper('UrlBase', function() {
+ return new Handlebars.SafeString(StatusModel.get('urlBase'));
+});
\ No newline at end of file
diff --git a/src/UI/Handlebars/Helpers/Numbers.js b/src/UI/Handlebars/Helpers/Numbers.js
index c91406bd7..19d7c63ab 100644
--- a/src/UI/Handlebars/Helpers/Numbers.js
+++ b/src/UI/Handlebars/Helpers/Numbers.js
@@ -1,14 +1,14 @@
var Handlebars = require('handlebars');
var FormatHelpers = require('../../Shared/FormatHelpers');
-module.exports = (function(){
- Handlebars.registerHelper('Bytes', function(size){
- return new Handlebars.SafeString(FormatHelpers.bytes(size));
- });
- Handlebars.registerHelper('Pad2', function(input){
- return FormatHelpers.pad(input, 2);
- });
- Handlebars.registerHelper('Number', function(input){
- return FormatHelpers.number(input);
- });
-}).call(this);
\ No newline at end of file
+Handlebars.registerHelper('Bytes', function(size) {
+ return new Handlebars.SafeString(FormatHelpers.bytes(size));
+});
+
+Handlebars.registerHelper('Pad2', function(input) {
+ return FormatHelpers.pad(input, 2);
+});
+
+Handlebars.registerHelper('Number', function(input) {
+ return FormatHelpers.number(input);
+});
diff --git a/src/UI/Handlebars/Helpers/Quality.js b/src/UI/Handlebars/Helpers/Quality.js
index b70618391..96b9c840f 100644
--- a/src/UI/Handlebars/Helpers/Quality.js
+++ b/src/UI/Handlebars/Helpers/Quality.js
@@ -1,12 +1,12 @@
var Handlebars = require('handlebars');
var ProfileCollection = require('../../Profile/ProfileCollection');
-module.exports = (function(){
- Handlebars.registerHelper('profile', function(profileId){
- var profile = ProfileCollection.get(profileId);
- if(profile) {
- return new Handlebars.SafeString('' + profile.get('name') + '');
- }
- return undefined;
- });
-}).call(this);
\ No newline at end of file
+Handlebars.registerHelper('profile', function(profileId) {
+ var profile = ProfileCollection.get(profileId);
+
+ if (profile) {
+ return new Handlebars.SafeString('' + profile.get('name') + '');
+ }
+
+ return undefined;
+});
\ No newline at end of file
diff --git a/src/UI/Handlebars/Helpers/Series.js b/src/UI/Handlebars/Helpers/Series.js
index ebe81435c..07186b12f 100644
--- a/src/UI/Handlebars/Helpers/Series.js
+++ b/src/UI/Handlebars/Helpers/Series.js
@@ -1,83 +1,79 @@
-'use strict';
-define(
- [
- 'handlebars',
- 'System/StatusModel',
- 'underscore'
- ], function (Handlebars, StatusModel, _) {
- Handlebars.registerHelper('poster', function () {
+var Handlebars = require('handlebars');
+var StatusModel = require('../../System/StatusModel');
+var _ = require('underscore');
- var placeholder = StatusModel.get('urlBase') + '/Content/Images/poster-dark.png';
- var poster = _.where(this.images, {coverType: 'poster'});
+Handlebars.registerHelper('poster', function() {
- if (poster[0]) {
- if (!poster[0].url.match(/^https?:\/\//)) {
- return new Handlebars.SafeString(''.format(Handlebars.helpers.defaultImg.call(null, poster[0].url, 250)));
- } else {
- return new Handlebars.SafeString(''.format(Handlebars.helpers.defaultImg.call(null, poster[0].url)));
- }
- }
+ var placeholder = StatusModel.get('urlBase') + '/Content/Images/poster-dark.png';
+ var poster = _.where(this.images, { coverType : 'poster' });
- return new Handlebars.SafeString(''.format(placeholder));
- });
+ if (poster[0]) {
+ if (!poster[0].url.match(/^https?:\/\//)) {
+ return new Handlebars.SafeString(''.format(Handlebars.helpers.defaultImg.call(null, poster[0].url, 250)));
+ } else {
+ return new Handlebars.SafeString(''.format(Handlebars.helpers.defaultImg.call(null, poster[0].url)));
+ }
+ }
- Handlebars.registerHelper('traktUrl', function () {
- return 'http://trakt.tv/show/' + this.titleSlug;
- });
+ return new Handlebars.SafeString(''.format(placeholder));
+});
- Handlebars.registerHelper('imdbUrl', function () {
- return 'http://imdb.com/title/' + this.imdbId;
- });
+Handlebars.registerHelper('traktUrl', function() {
+ return 'http://trakt.tv/show/' + this.titleSlug;
+});
- Handlebars.registerHelper('tvdbUrl', function () {
- return 'http://www.thetvdb.com/?tab=series&id=' + this.tvdbId;
- });
+Handlebars.registerHelper('imdbUrl', function() {
+ return 'http://imdb.com/title/' + this.imdbId;
+});
- Handlebars.registerHelper('tvRageUrl', function () {
- return 'http://www.tvrage.com/shows/id-' + this.tvRageId;
- });
+Handlebars.registerHelper('tvdbUrl', function() {
+ return 'http://www.thetvdb.com/?tab=series&id=' + this.tvdbId;
+});
- Handlebars.registerHelper('route', function () {
- return StatusModel.get('urlBase') + '/series/' + this.titleSlug;
- });
+Handlebars.registerHelper('tvRageUrl', function() {
+ return 'http://www.tvrage.com/shows/id-' + this.tvRageId;
+});
- Handlebars.registerHelper('percentOfEpisodes', function () {
- var episodeCount = this.episodeCount;
- var episodeFileCount = this.episodeFileCount;
+Handlebars.registerHelper('route', function() {
+ return StatusModel.get('urlBase') + '/series/' + this.titleSlug;
+});
- var percent = 100;
+Handlebars.registerHelper('percentOfEpisodes', function() {
+ var episodeCount = this.episodeCount;
+ var episodeFileCount = this.episodeFileCount;
- if (episodeCount > 0) {
- percent = episodeFileCount / episodeCount * 100;
- }
+ var percent = 100;
- return percent;
- });
+ if (episodeCount > 0) {
+ percent = episodeFileCount / episodeCount * 100;
+ }
- Handlebars.registerHelper('seasonCountHelper', function () {
- var seasonCount = this.seasonCount;
- var continuing = this.status === 'continuing';
+ return percent;
+});
- if (continuing) {
- return new Handlebars.SafeString('Season {0}'.format(seasonCount));
- }
+Handlebars.registerHelper('seasonCountHelper', function() {
+ var seasonCount = this.seasonCount;
+ var continuing = this.status === 'continuing';
- if (seasonCount === 1) {
- return new Handlebars.SafeString('{0} Season'.format(seasonCount));
- }
+ if (continuing) {
+ return new Handlebars.SafeString('Season {0}'.format(seasonCount));
+ }
- return new Handlebars.SafeString('{0} Seasons'.format(seasonCount));
- });
+ if (seasonCount === 1) {
+ return new Handlebars.SafeString('{0} Season'.format(seasonCount));
+ }
- Handlebars.registerHelper('titleWithYear', function () {
- if (this.title.endsWith(' ({0})'.format(this.year))) {
- return this.title;
- }
+ return new Handlebars.SafeString('{0} Seasons'.format(seasonCount));
+});
- if (!this.year) {
- return this.title;
- }
+Handlebars.registerHelper('titleWithYear', function() {
+ if (this.title.endsWith(' ({0})'.format(this.year))) {
+ return this.title;
+ }
- return new Handlebars.SafeString('{0} ({1})'.format(this.title, this.year));
- });
- });
+ if (!this.year) {
+ return this.title;
+ }
+
+ return new Handlebars.SafeString('{0} ({1})'.format(this.title, this.year));
+});
diff --git a/src/UI/Handlebars/Helpers/String.js b/src/UI/Handlebars/Helpers/String.js
index 2a24e1fcc..761f565c0 100644
--- a/src/UI/Handlebars/Helpers/String.js
+++ b/src/UI/Handlebars/Helpers/String.js
@@ -1,9 +1,7 @@
var Handlebars = require('handlebars');
-module.exports = (function(){
- Handlebars.registerHelper('TitleCase', function(input){
- return new Handlebars.SafeString(input.replace(/\w\S*/g, function(txt){
- return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
- }));
- });
-}).call(this);
\ No newline at end of file
+Handlebars.registerHelper('TitleCase', function(input) {
+ return new Handlebars.SafeString(input.replace(/\w\S*/g, function(txt) {
+ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
+ }));
+});
\ No newline at end of file
diff --git a/src/UI/Handlebars/Helpers/System.js b/src/UI/Handlebars/Helpers/System.js
index 1a8bff320..269414666 100644
--- a/src/UI/Handlebars/Helpers/System.js
+++ b/src/UI/Handlebars/Helpers/System.js
@@ -1,17 +1,18 @@
var Handlebars = require('handlebars');
var StatusModel = require('../../System/StatusModel');
-module.exports = (function(){
- Handlebars.registerHelper('if_windows', function(options){
- if(StatusModel.get('isWindows')) {
- return options.fn(this);
- }
- return options.inverse(this);
- });
- Handlebars.registerHelper('if_mono', function(options){
- if(StatusModel.get('isMono')) {
- return options.fn(this);
- }
- return options.inverse(this);
- });
-}).call(this);
\ No newline at end of file
+Handlebars.registerHelper('if_windows', function(options) {
+ if (StatusModel.get('isWindows')) {
+ return options.fn(this);
+ }
+
+ return options.inverse(this);
+});
+
+Handlebars.registerHelper('if_mono', function(options) {
+ if (StatusModel.get('isMono')) {
+ return options.fn(this);
+ }
+
+ return options.inverse(this);
+});
\ No newline at end of file
diff --git a/src/UI/Handlebars/backbone.marionette.templates.js b/src/UI/Handlebars/backbone.marionette.templates.js
index cf8679271..82bf4ec62 100644
--- a/src/UI/Handlebars/backbone.marionette.templates.js
+++ b/src/UI/Handlebars/backbone.marionette.templates.js
@@ -11,14 +11,17 @@ require('./Helpers/EachReverse');
require('./Helpers/String');
require('./Handlebars.Debug');
-module.exports = function(){
- this.get = function(templateId){
+module.exports = function() {
+ this.get = function(templateId) {
var templateKey = templateId.toLowerCase().replace('template', '');
+
var templateFunction = window.T[templateKey];
- if(!templateFunction) {
+
+ if (!templateFunction) {
throw 'couldn\'t find pre-compiled template ' + templateKey;
}
- return function(data){
+
+ return function(data) {
try {
var wrappedTemplate = Handlebars.template.call(Handlebars, templateFunction);
return wrappedTemplate(data);