diff --git a/.gitignore b/.gitignore index 5778ab74e..c391dc4da 100644 --- a/.gitignore +++ b/.gitignore @@ -129,3 +129,4 @@ UpdateLogs/ *//Bootstrap/*.css NzbDrone.Web/cassette-cache/* *.eq +NzbDrone.Web/_backboneApp/.idea/workspace.xml diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 30274e3a8..b96f11898 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -212,6 +212,8 @@ + + @@ -227,7 +229,6 @@ - diff --git a/NzbDrone.Web/Views/V2/Index.cshtml b/NzbDrone.Web/Views/V2/Index.cshtml index 375256c9b..9ecb12368 100644 --- a/NzbDrone.Web/Views/V2/Index.cshtml +++ b/NzbDrone.Web/Views/V2/Index.cshtml @@ -63,17 +63,22 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.extend.js b/NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.extend.js deleted file mode 100644 index 596a5ec17..000000000 --- a/NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.extend.js +++ /dev/null @@ -1,36 +0,0 @@ - -define(['underscore', 'marionette', 'handlebars', 'jquery'], function (_, Marionette, Handlebars, $) { - _.extend(Marionette.TemplateCache.prototype, { - - loadTemplate: function (templateId) { - - - var template; - - console.log("Loading template '" + templateId + "'"); - - $.ajax({ - url: '_backboneApp//' + templateId + '.html', - cache: false, - async: false - - }).done(function (data) { - template = data; - - }).fail(function (data) { - console.log("couldn't load template " + this.templateId + " Error: " + data.statusText); - template = "
Couldn't load template '" + templateId + "'. Status: " + data.statusText + "
"; - }); - - return template; - } - }); - - _.extend(Marionette.TemplateCache.prototype, { - - compileTemplate: function (rawTemplate) { - return Handlebars.compile(rawTemplate); - } - }); -}); - diff --git a/NzbDrone.Web/_backboneApp/Mixins/backbone.marionette.templates.js b/NzbDrone.Web/_backboneApp/Mixins/backbone.marionette.templates.js new file mode 100644 index 000000000..2fe3ce7fb --- /dev/null +++ b/NzbDrone.Web/_backboneApp/Mixins/backbone.marionette.templates.js @@ -0,0 +1,33 @@ +_.extend(Marionette.TemplateCache.prototype, { + + loadTemplate:function (templateId) { + + + var template; + + console.log("Loading template '" + templateId + "'"); + + $.ajax({ + url:'_backboneApp//' + templateId + '.html', + cache:false, + async:false + + }).done(function (data) { + template = data; + + }).fail(function (data) { + console.log("couldn't load template " + this.templateId + " Error: " + data.statusText); + template = "
Couldn't load template '" + templateId + "'. Status: " + data.statusText + "
"; + }); + + return template; + } +}); + +_.extend(Marionette.TemplateCache.prototype, { + + compileTemplate:function (rawTemplate) { + return Handlebars.compile(rawTemplate); + } +}); + diff --git a/NzbDrone.Web/_backboneApp/Shared/NotificationModel.js b/NzbDrone.Web/_backboneApp/Shared/NotificationModel.js index e6b8db709..798445423 100644 --- a/NzbDrone.Web/_backboneApp/Shared/NotificationModel.js +++ b/NzbDrone.Web/_backboneApp/Shared/NotificationModel.js @@ -1,16 +1,21 @@ define(['app'], function () { NzbDrone.Shared.NotificationModel = Backbone.Model.extend({ - mutators: { - pre: function () { - if (this.get('message')) { - return this.get('message').lines().lenght > 1; + mutators:{ + pre:function () { + try { + if (this.get('message')) { + return this.get('message').lines().lenght > 1; + } + } catch (error) { + return false; } + }, - iconClass: function () { + iconClass:function () { if (this.has('icon')) { - return "icon"; + return 'icon'; } if (this.get('level') === 'info') { @@ -25,10 +30,10 @@ } }, - defaults: { - "level": "info", - "title": "", - "message": "", + defaults:{ + "level":'info', + "title":'', + "message":'' } }); }); \ No newline at end of file diff --git a/NzbDrone.Web/_backboneApp/app.js b/NzbDrone.Web/_backboneApp/app.js index f38ffaea6..bd5a3c2b5 100644 --- a/NzbDrone.Web/_backboneApp/app.js +++ b/NzbDrone.Web/_backboneApp/app.js @@ -4,19 +4,15 @@ 'backbone': 'JsLibraries/backbone', 'underscore': 'JsLibraries/underscore', 'marionette': 'JsLibraries/backbone.marionette', - 'handlebars': 'JsLibraries/handlebars', - 'jquery': 'JsLibraries/jquery' + 'handlebars': 'JsLibraries/handlebars' }, shim: { - jquery:{ - exports:'$' - }, underscore: { exports: '_' }, backbone: { - deps: ['underscore', 'jquery'], + deps: ['underscore'], exports: 'Backbone' }, marionette: { @@ -25,23 +21,18 @@ }, handlebars: { exports: 'Handlebars' - }, - dataTable: { - deps: ['jquery'] } + } }); -define('app', ['jquery', 'JsLibraries/backbone.modelbinder', 'marionette', 'handlebars', 'JsLibraries/backbone.marionette.extend'], - function (jquery, modelBinder, marionette, handlebars) { - - - window.$ = jquery; - window.jquery = jquery; +define('app', function () { + //window.$ = jquery; + //window.jquery = jquery; - window.Backbone.ModelBinder = modelBinder; - window.Backbone.Marionette = marionette; - window.Handlebars = handlebars; + //window.Backbone.ModelBinder = modelBinder; + //window.Backbone.Marionette = marionette; + //window.Handlebars = handlebars; window.NzbDrone = new Backbone.Marionette.Application(); window.NzbDrone.Series = {};