UI Cleanup - Updated root tree.

pull/4/head
Taloth Saldono 9 years ago
parent 70bfad4e6a
commit 29d9e3dadf

@ -3,20 +3,18 @@ var ModalRegion = require('./Shared/Modal/ModalRegion');
var FileBrowserModalRegion = require('./Shared/FileBrowser/FileBrowserModalRegion'); var FileBrowserModalRegion = require('./Shared/FileBrowser/FileBrowserModalRegion');
var ControlPanelRegion = require('./Shared/ControlPanel/ControlPanelRegion'); var ControlPanelRegion = require('./Shared/ControlPanel/ControlPanelRegion');
module.exports = (function(){ var Layout = Marionette.Layout.extend({
'use strict'; regions : {
var Layout = Marionette.Layout.extend({ navbarRegion : '#nav-region',
regions : { mainRegion : '#main-region'
navbarRegion : '#nav-region', },
mainRegion : '#main-region'
}, initialize : function() {
initialize : function(){ this.addRegions({
this.addRegions({ modalRegion : ModalRegion,
modalRegion : ModalRegion, fileBrowserModalRegion : FileBrowserModalRegion,
fileBrowserModalRegion : FileBrowserModalRegion, controlPanelRegion : ControlPanelRegion
controlPanelRegion : ControlPanelRegion });
}); }
} });
}); module.exports = new Layout({ el : 'body' });
return new Layout({el : 'body'});
}).call(this);

@ -1,53 +1,52 @@
'use strict'; var vent = require('./vent');
define(
[ module.exports = {
'vent' Events : {
], function (vent) { ConfigUpdatedEvent : 'ConfigUpdatedEvent'
return { },
Events: {
ConfigUpdatedEvent: 'ConfigUpdatedEvent' Keys : {
}, DefaultProfileId : 'DefaultProfileId',
DefaultRootFolderId : 'DefaultRootFolderId',
Keys : { UseSeasonFolder : 'UseSeasonFolder',
DefaultProfileId : 'DefaultProfileId', DefaultSeriesType : 'DefaultSeriesType',
DefaultRootFolderId : 'DefaultRootFolderId', MonitorEpisodes : 'MonitorEpisodes',
UseSeasonFolder : 'UseSeasonFolder', AdvancedSettings : 'advancedSettings'
DefaultSeriesType : 'DefaultSeriesType', },
MonitorEpisodes : 'MonitorEpisodes',
AdvancedSettings : 'advancedSettings' getValueBoolean : function(key, defaultValue) {
}, defaultValue = defaultValue || false;
getValueBoolean: function (key, defaultValue) { return this.getValue(key, defaultValue.toString()) === 'true';
defaultValue = defaultValue || false; },
return this.getValue(key, defaultValue.toString()) === 'true'; getValue : function(key, defaultValue) {
}, var storeValue = window.localStorage.getItem(key);
getValue: function (key, defaultValue) { if (!storeValue) {
var storeValue = window.localStorage.getItem(key); return defaultValue;
}
if (!storeValue) {
return defaultValue; return storeValue.toString();
} },
return storeValue.toString(); setValue : function(key, value) {
},
console.log('Config: [{0}] => [{1}]'.format(key, value));
setValue: function (key, value) {
if (this.getValue(key) === value.toString()) {
console.log('Config: [{0}] => [{1}]'.format(key, value)); return;
}
if (this.getValue(key) === value.toString()) {
return; try {
} window.localStorage.setItem(key, value);
vent.trigger(this.Events.ConfigUpdatedEvent, {
try { key : key,
window.localStorage.setItem(key, value); value : value
vent.trigger(this.Events.ConfigUpdatedEvent, {key: key, value: value}); });
} }
catch (error) { catch (error) {
console.error('Unable to save config: [{0}] => [{1}]'.format(key, value)); console.error('Unable to save config: [{0}] => [{1}]'.format(key, value));
} }
} }
}; };
});

@ -12,39 +12,47 @@ var SeasonPassLayout = require('./SeasonPass/SeasonPassLayout');
var SeriesEditorLayout = require('./Series/Editor/SeriesEditorLayout'); var SeriesEditorLayout = require('./Series/Editor/SeriesEditorLayout');
module.exports = NzbDroneController.extend({ module.exports = NzbDroneController.extend({
addSeries : function(action){ addSeries : function(action) {
this.setTitle('Add Series'); this.setTitle('Add Series');
this.showMainRegion(new AddSeriesLayout({action : action})); this.showMainRegion(new AddSeriesLayout({ action : action }));
}, },
calendar : function(){
calendar : function() {
this.setTitle('Calendar'); this.setTitle('Calendar');
this.showMainRegion(new CalendarLayout()); this.showMainRegion(new CalendarLayout());
}, },
settings : function(action){
settings : function(action) {
this.setTitle('Settings'); this.setTitle('Settings');
this.showMainRegion(new SettingsLayout({action : action})); this.showMainRegion(new SettingsLayout({ action : action }));
}, },
wanted : function(action){
wanted : function(action) {
this.setTitle('Wanted'); this.setTitle('Wanted');
this.showMainRegion(new WantedLayout({action : action})); this.showMainRegion(new WantedLayout({ action : action }));
}, },
activity : function(action){
activity : function(action) {
this.setTitle('Activity'); this.setTitle('Activity');
this.showMainRegion(new ActivityLayout({action : action})); this.showMainRegion(new ActivityLayout({ action : action }));
}, },
rss : function(){
rss : function() {
this.setTitle('RSS'); this.setTitle('RSS');
this.showMainRegion(new ReleaseLayout()); this.showMainRegion(new ReleaseLayout());
}, },
system : function(action){
system : function(action) {
this.setTitle('System'); this.setTitle('System');
this.showMainRegion(new SystemLayout({action : action})); this.showMainRegion(new SystemLayout({ action : action }));
}, },
seasonPass : function(){
seasonPass : function() {
this.setTitle('Season Pass'); this.setTitle('Season Pass');
this.showMainRegion(new SeasonPassLayout()); this.showMainRegion(new SeasonPassLayout());
}, },
seriesEditor : function(){
seriesEditor : function() {
this.setTitle('Series Editor'); this.setTitle('Series Editor');
this.showMainRegion(new SeriesEditorLayout()); this.showMainRegion(new SeriesEditorLayout());
} }

@ -1,5 +1,3 @@
module.exports = (function(){ window.onbeforeunload = function() {
window.onbeforeunload = function(){ window.NzbDrone.unloading = true;
window.NzbDrone.unloading = true; };
};
}).call(this);

@ -19,7 +19,7 @@ module.exports = Marionette.AppRouter.extend({
'system' : 'system', 'system' : 'system',
'system/:action' : 'system', 'system/:action' : 'system',
'seasonpass' : 'seasonPass', 'seasonpass' : 'seasonPass',
'serieseditor' : 'seriesEditor', 'serieseditor' : 'seriesEditor',
':whatever' : 'showNotFound' ':whatever' : 'showNotFound'
} }
}); });

@ -34,18 +34,16 @@ require.config({
}, },
shim : { shim : {
api : {
api : {
deps : ['jquery'] deps : ['jquery']
}, },
jquery : { jquery : {
exports : '$' exports : '$'
}, },
messenger : { messenger : {
deps : ['jquery'], deps : ['jquery'],
exports : 'Messenger', exports : 'Messenger',
init : function(){ init : function() {
window.Messenger.options = { window.Messenger.options = {
theme : 'flat' theme : 'flat'
}; };
@ -58,7 +56,10 @@ require.config({
deps : ['jquery'] deps : ['jquery']
}, },
'bootstrap.tagsinput' : { 'bootstrap.tagsinput' : {
deps : ['bootstrap', 'typeahead'] deps : [
'bootstrap',
'typeahead'
]
}, },
backstrech : { backstrech : {
deps : ['jquery'] deps : ['jquery']
@ -68,18 +69,25 @@ require.config({
exports : '_' exports : '_'
}, },
backbone : { backbone : {
deps : ['jquery', 'Instrumentation/ErrorHandler', 'underscore', 'Mixins/jquery.ajax', 'jQuery/ToTheTop'], deps : [
'jquery',
'Instrumentation/ErrorHandler',
'underscore',
'Mixins/jquery.ajax',
'jQuery/ToTheTop'
],
exports : 'Backbone' exports : 'Backbone'
}, },
marionette : { marionette : {
deps : ['backbone', 'Handlebars/backbone.marionette.templates', 'Mixins/AsNamedView'], deps : [
'backbone',
'Handlebars/backbone.marionette.templates',
'Mixins/AsNamedView'
],
exports : 'Marionette', exports : 'Marionette',
init : function(Backbone, TemplateMixin, AsNamedView){ init : function(Backbone, TemplateMixin, AsNamedView) {
TemplateMixin.call(window.Marionette.TemplateCache); TemplateMixin.call(window.Marionette.TemplateCache);
AsNamedView.call(window.Marionette.ItemView.prototype); AsNamedView.call(window.Marionette.ItemView.prototype);
} }
}, },
'typeahead' : { 'typeahead' : {
@ -101,7 +109,10 @@ require.config({
deps : ['backbone'] deps : ['backbone']
}, },
'backbone.deepmodel' : { 'backbone.deepmodel' : {
deps : ['backbone', 'underscore'] deps : [
'backbone',
'underscore'
]
}, },
'backbone.validation' : { 'backbone.validation' : {
deps : ['backbone'], deps : ['backbone'],
@ -111,17 +122,17 @@ require.config({
deps : ['backbone'] deps : ['backbone']
}, },
'backbone.collectionview' : { 'backbone.collectionview' : {
deps : ['backbone', 'jquery-ui'], deps : [
'backbone',
'jquery-ui'
],
exports : 'Backbone.CollectionView' exports : 'Backbone.CollectionView'
}, },
backgrid : { backgrid : {
deps : ['backbone'], deps : ['backbone'],
exports : 'Backgrid', exports : 'Backgrid',
init : function() {
init : function(){ require(['Shared/Grid/HeaderCell'], function() {
require(['Shared/Grid/HeaderCell'], function(){
window.Backgrid.Column.prototype.defaults = { window.Backgrid.Column.prototype.defaults = {
name : undefined, name : undefined,
label : undefined, label : undefined,
@ -137,16 +148,12 @@ require.config({
} }
}, },
'backgrid.paginator' : { 'backgrid.paginator' : {
deps : ['backgrid'],
exports : 'Backgrid.Extension.Paginator', exports : 'Backgrid.Extension.Paginator'
deps : ['backgrid']
}, },
'backgrid.selectall' : { 'backgrid.selectall' : {
deps : ['backgrid'],
exports : 'Backgrid.Extension.SelectRowCell', exports : 'Backgrid.Extension.SelectRowCell'
deps : ['backgrid']
} }
} }
}); });

@ -1,4 +1,4 @@
var $ = require('jquery'); var $ = require('jquery');
var Backbone = require('backbone'); var Backbone = require('backbone');
var Marionette = require('marionette'); var Marionette = require('marionette');
var RouteBinder = require('./jQuery/RouteBinder'); var RouteBinder = require('./jQuery/RouteBinder');
@ -23,13 +23,18 @@ new SeriesController();
new ModalController(); new ModalController();
new ControlPanelController(); new ControlPanelController();
new Router(); new Router();
var app = new Marionette.Application(); var app = new Marionette.Application();
app.addInitializer(function(){
app.addInitializer(function() {
console.log('starting application'); console.log('starting application');
}); });
app.addInitializer(SignalRBroadcaster.appInitializer, {app : app});
app.addInitializer(Tooltip.appInitializer, {app : app}); app.addInitializer(SignalRBroadcaster.appInitializer, { app : app });
app.addInitializer(function(){
app.addInitializer(Tooltip.appInitializer, { app : app });
app.addInitializer(function() {
Backbone.history.start({ Backbone.history.start({
pushState : true, pushState : true,
root : serverStatusModel.get('urlBase') root : serverStatusModel.get('urlBase')
@ -38,13 +43,15 @@ app.addInitializer(function(){
AppLayout.navbarRegion.show(new NavbarLayout()); AppLayout.navbarRegion.show(new NavbarLayout());
$('body').addClass('started'); $('body').addClass('started');
}); });
app.addInitializer(function(){
app.addInitializer(function() {
var footerText = serverStatusModel.get('version'); var footerText = serverStatusModel.get('version');
if(serverStatusModel.get('branch') !== 'master') { if (serverStatusModel.get('branch') !== 'master') {
footerText += '</br>' + serverStatusModel.get('branch'); footerText += '</br>' + serverStatusModel.get('branch');
} }
$('#footer-region .version').html(footerText); $('#footer-region .version').html(footerText);
}); });
app.start(); app.start();
module.exports = app; module.exports = app;

@ -1,33 +1,29 @@
window.console = window.console || {}; window.console = window.console || {};
window.console.log = window.console.log || function(){ window.console.log = window.console.log || function() {};
}; window.console.group = window.console.group || function() {};
window.console.group = window.console.group || function(){ window.console.groupEnd = window.console.groupEnd || function() {};
}; window.console.debug = window.console.debug || function() {};
window.console.groupEnd = window.console.groupEnd || function(){ window.console.warn = window.console.warn || function() {};
}; window.console.assert = window.console.assert || function() {};
window.console.debug = window.console.debug || function(){
}; if (!String.prototype.startsWith) {
window.console.warn = window.console.warn || function(){
};
window.console.assert = window.console.assert || function(){
};
if(!String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', { Object.defineProperty(String.prototype, 'startsWith', {
enumerable : false, enumerable : false,
configurable : false, configurable : false,
writable : false, writable : false,
value : function(searchString, position){ value : function(searchString, position) {
position = position || 0; position = position || 0;
return this.indexOf(searchString, position) === position; return this.indexOf(searchString, position) === position;
} }
}); });
} }
if(!String.prototype.endsWith) {
if (!String.prototype.endsWith) {
Object.defineProperty(String.prototype, 'endsWith', { Object.defineProperty(String.prototype, 'endsWith', {
enumerable : false, enumerable : false,
configurable : false, configurable : false,
writable : false, writable : false,
value : function(searchString, position){ value : function(searchString, position) {
position = position || this.length; position = position || this.length;
position = position - searchString.length; position = position - searchString.length;
var lastIndex = this.lastIndexOf(searchString); var lastIndex = this.lastIndexOf(searchString);
@ -35,8 +31,9 @@ if(!String.prototype.endsWith) {
} }
}); });
} }
if(!('contains' in String.prototype)) {
String.prototype.contains = function(str, startIndex){ if (!('contains' in String.prototype)) {
String.prototype.contains = function(str, startIndex) {
return -1 !== String.prototype.indexOf.call(this, str, startIndex); return -1 !== String.prototype.indexOf.call(this, str, startIndex);
}; };
} }

@ -1,6 +1,7 @@
var Wreqr = require('./JsLibraries/backbone.wreqr'); var Wreqr = require('./JsLibraries/backbone.wreqr');
var reqres = new Wreqr.RequestResponse(); var reqres = new Wreqr.RequestResponse();
reqres.Requests = { reqres.Requests = {
GetEpisodeFileById : 'GetEpisodeFileById', GetEpisodeFileById : 'GetEpisodeFileById',
GetAlternateNameBySeasonNumber : 'GetAlternateNameBySeasonNumber' GetAlternateNameBySeasonNumber : 'GetAlternateNameBySeasonNumber'

@ -17,7 +17,6 @@ require('zero.clipboard');
require('bootstrap'); require('bootstrap');
require('bootstrap.tagsinput'); require('bootstrap.tagsinput');
/*Backbone*/ /*Backbone*/
require('backbone'); require('backbone');
require('backbone.deepmodel'); require('backbone.deepmodel');

@ -1,35 +1,36 @@
var Wreqr = require('./JsLibraries/backbone.wreqr'); var Wreqr = require('./JsLibraries/backbone.wreqr');
module.exports = (function(){ var vent = new Wreqr.EventAggregator();
'use strict';
var vent = new Wreqr.EventAggregator(); vent.Events = {
vent.Events = { SeriesAdded : 'series:added',
SeriesAdded : 'series:added', SeriesDeleted : 'series:deleted',
SeriesDeleted : 'series:deleted', CommandComplete : 'command:complete',
CommandComplete : 'command:complete', ServerUpdated : 'server:updated',
ServerUpdated : 'server:updated', EpisodeFileDeleted : 'episodefile:deleted'
EpisodeFileDeleted : 'episodefile:deleted' };
};
vent.Commands = { vent.Commands = {
EditSeriesCommand : 'EditSeriesCommand', EditSeriesCommand : 'EditSeriesCommand',
DeleteSeriesCommand : 'DeleteSeriesCommand', DeleteSeriesCommand : 'DeleteSeriesCommand',
OpenModalCommand : 'OpenModalCommand', OpenModalCommand : 'OpenModalCommand',
CloseModalCommand : 'CloseModalCommand', CloseModalCommand : 'CloseModalCommand',
ShowEpisodeDetails : 'ShowEpisodeDetails', ShowEpisodeDetails : 'ShowEpisodeDetails',
ShowHistoryDetails : 'ShowHistoryDetails', ShowHistoryDetails : 'ShowHistoryDetails',
ShowLogDetails : 'ShowLogDetails', ShowLogDetails : 'ShowLogDetails',
SaveSettings : 'saveSettings', SaveSettings : 'saveSettings',
ShowLogFile : 'showLogFile', ShowLogFile : 'showLogFile',
ShowRenamePreview : 'showRenamePreview', ShowRenamePreview : 'showRenamePreview',
ShowFileBrowser : 'showFileBrowser', ShowFileBrowser : 'showFileBrowser',
CloseFileBrowser : 'closeFileBrowser', CloseFileBrowser : 'closeFileBrowser',
OpenControlPanelCommand : 'OpenControlPanelCommand', OpenControlPanelCommand : 'OpenControlPanelCommand',
CloseControlPanelCommand : 'CloseControlPanelCommand' CloseControlPanelCommand : 'CloseControlPanelCommand'
}; };
vent.Hotkeys = {
NavbarSearch : 'navbar:search', vent.Hotkeys = {
SaveSettings : 'settings:save', NavbarSearch : 'navbar:search',
ShowHotkeys : 'hotkeys:show' SaveSettings : 'settings:save',
}; ShowHotkeys : 'hotkeys:show'
return vent; };
}).call(this);
module.exports = vent;
Loading…
Cancel
Save