From 6b418276b6876065323ad71349664201bc547a05 Mon Sep 17 00:00:00 2001 From: kayone Date: Tue, 19 Nov 2013 17:43:31 -0800 Subject: [PATCH] removed ServerStatus.js --- .../Notifications/NotificationFactory.cs | 3 -- src/UI/Calendar/CalendarView.js | 5 +-- src/UI/Content/theme.less | 4 +++ src/UI/ServerStatus.js | 25 ------------- src/UI/System/StatusModel.js | 8 ++--- src/UI/app.js | 36 ++++++++----------- src/UI/index.html | 11 +++--- 7 files changed, 32 insertions(+), 60 deletions(-) delete mode 100644 src/UI/ServerStatus.js diff --git a/src/NzbDrone.Core/Notifications/NotificationFactory.cs b/src/NzbDrone.Core/Notifications/NotificationFactory.cs index 57163b9e0..54037acef 100644 --- a/src/NzbDrone.Core/Notifications/NotificationFactory.cs +++ b/src/NzbDrone.Core/Notifications/NotificationFactory.cs @@ -14,12 +14,9 @@ namespace NzbDrone.Core.Notifications public class NotificationFactory : ProviderFactory, INotificationFactory { - private IEnumerable _providers; - public NotificationFactory(INotificationRepository providerRepository, IEnumerable providers, IContainer container, Logger logger) : base(providerRepository, providers, container, logger) { - _providers = providers; } public List OnGrabEnabled() diff --git a/src/UI/Calendar/CalendarView.js b/src/UI/Calendar/CalendarView.js index 727c8f578..003d0a6f6 100644 --- a/src/UI/Calendar/CalendarView.js +++ b/src/UI/Calendar/CalendarView.js @@ -6,8 +6,9 @@ define( 'marionette', 'moment', 'Calendar/Collection', + 'System/StatusModel', 'fullcalendar' - ], function (vent, Marionette, moment, CalendarCollection) { + ], function (vent, Marionette, moment, CalendarCollection, StatusModel) { var _instance; @@ -24,7 +25,7 @@ define( allDayDefault : false, ignoreTimezone: false, weekMode : 'variable', - firstDay : window.NzbDrone.ServerStatus.startOfWeek, + firstDay : StatusModel.get('startOfWeek'), timeFormat : 'h(:mm)tt', header : { left : 'prev,next today', diff --git a/src/UI/Content/theme.less b/src/UI/Content/theme.less index 2eb6e6481..3cf7edb0a 100644 --- a/src/UI/Content/theme.less +++ b/src/UI/Content/theme.less @@ -179,3 +179,7 @@ footer { .error { .formFieldState(@errorText, @errorText, @errorBackground); } + +#errors{ + display : none; +} \ No newline at end of file diff --git a/src/UI/ServerStatus.js b/src/UI/ServerStatus.js deleted file mode 100644 index 95e1fd968..000000000 --- a/src/UI/ServerStatus.js +++ /dev/null @@ -1,25 +0,0 @@ -window.NzbDrone.ApiRoot = '/api'; - -var statusText = window.$.ajax({ - type : 'GET', - url : window.NzbDrone.ApiRoot + '/system/status', - async: false, - headers: { - Authorization: window.NzbDrone.ApiKey - } -}).responseText; - -window.NzbDrone.ServerStatus = JSON.parse(statusText); - -var footerText = window.NzbDrone.ServerStatus.version; - -window.$(document).ready(function () { - if (window.NzbDrone.ServerStatus.branch !== 'master') { - footerText += '
' + window.NzbDrone.ServerStatus.branch; - } - window.$('#footer-region .version').html(footerText); -}); - - - - diff --git a/src/UI/System/StatusModel.js b/src/UI/System/StatusModel.js index 97dc696ca..0ffaf2b79 100644 --- a/src/UI/System/StatusModel.js +++ b/src/UI/System/StatusModel.js @@ -1,14 +1,14 @@ 'use strict'; define( [ - 'backbone' - ], function (Backbone) { + 'backbone', + 'api!system/status' + ], function (Backbone, statusData) { var StatusModel = Backbone.Model.extend({ url: window.NzbDrone.ApiRoot + '/system/status' }); - var instance = new StatusModel(); - instance.fetch(); + var instance = new StatusModel(statusData); return instance; }); diff --git a/src/UI/app.js b/src/UI/app.js index 0c0dd9cc0..3fc2e355b 100644 --- a/src/UI/app.js +++ b/src/UI/app.js @@ -1,5 +1,6 @@ 'use strict'; require.config({ + urlArgs: 'v=' + window.NzbDrone.Version, paths: { 'backbone' : 'JsLibraries/backbone', 'moment' : 'JsLibraries/moment', @@ -28,19 +29,15 @@ require.config({ }, shim: { - - jquery :{ exports: '$' }, - signalR: { deps: [ 'jquery' ] }, - bootstrap: { deps: [ @@ -52,14 +49,12 @@ require.config({ }); } }, - backstrech: { deps: [ 'jquery' ] }, - underscore: { deps : [ @@ -67,7 +62,6 @@ require.config({ ], exports: '_' }, - backbone: { deps: [ @@ -75,14 +69,10 @@ require.config({ 'underscore', 'Mixins/jquery.ajax', 'jQuery/ToTheTop' - ], exports: 'Backbone' }, - - - marionette: { deps: [ @@ -98,21 +88,18 @@ require.config({ } }, - 'jquery.knob': { deps: [ 'jquery' ] }, - 'jquery.dotdotdot': { deps: [ 'jquery' ] }, - 'backbone.pageable': { deps: [ @@ -139,7 +126,6 @@ require.config({ 'backbone' ] }, - backgrid : { deps: [ @@ -189,10 +175,6 @@ require.config({ } }); -require.config({ - urlArgs: 'v=' + window.NzbDrone.ServerStatus.version -}); - define( [ 'jquery', @@ -205,9 +187,10 @@ define( 'Series/SeriesController', 'Router', 'Shared/Modal/Controller', + 'System/StatusModel', 'Instrumentation/StringFormat', 'LifeCycle' - ], function ($, Backbone, Marionette, RouteBinder, SignalRBroadcaster, NavbarView, AppLayout, SeriesController, Router, ModalController) { + ], function ($, Backbone, Marionette, RouteBinder, SignalRBroadcaster, NavbarView, AppLayout, SeriesController, Router, ModalController, serverStatusModel) { new SeriesController(); new ModalController(); @@ -230,5 +213,16 @@ define( $('body').addClass('started'); }); + app.addInitializer(function () { + + var footerText = serverStatusModel.get('version'); + + if (serverStatusModel.get('branch') !== 'master') { + footerText += '
' + serverStatusModel.get('branch'); + } + + $('#footer-region .version').html(footerText); + }); + app.start(); - }); + }); \ No newline at end of file diff --git a/src/UI/index.html b/src/UI/index.html index 515edecb9..14a071113 100644 --- a/src/UI/index.html +++ b/src/UI/index.html @@ -61,18 +61,19 @@ -
-
+
-