UI Cleanup - Updated root tree.

This commit is contained in:
Taloth Saldono 2015-02-13 22:06:34 +01:00
parent 70bfad4e6a
commit 29d9e3dadf
11 changed files with 181 additions and 166 deletions

View File

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

View File

@ -1,9 +1,6 @@
'use strict';
define(
[
'vent'
], function (vent) {
return {
var vent = require('./vent');
module.exports = {
Events : {
ConfigUpdatedEvent : 'ConfigUpdatedEvent'
},
@ -43,11 +40,13 @@ define(
try {
window.localStorage.setItem(key, value);
vent.trigger(this.Events.ConfigUpdatedEvent, {key: key, value: value});
vent.trigger(this.Events.ConfigUpdatedEvent, {
key : key,
value : value
});
}
catch (error) {
console.error('Unable to save config: [{0}] => [{1}]'.format(key, value));
}
}
};
});

View File

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

View File

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

View File

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

View File

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

View File

@ -1,16 +1,11 @@
window.console = window.console || {};
window.console.log = window.console.log || function(){
};
window.console.group = window.console.group || function(){
};
window.console.groupEnd = window.console.groupEnd || function(){
};
window.console.debug = window.console.debug || function(){
};
window.console.warn = window.console.warn || function(){
};
window.console.assert = window.console.assert || function(){
};
window.console.log = window.console.log || function() {};
window.console.group = window.console.group || function() {};
window.console.groupEnd = window.console.groupEnd || function() {};
window.console.debug = window.console.debug || function() {};
window.console.warn = window.console.warn || function() {};
window.console.assert = window.console.assert || function() {};
if (!String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', {
enumerable : false,
@ -22,6 +17,7 @@ if(!String.prototype.startsWith) {
}
});
}
if (!String.prototype.endsWith) {
Object.defineProperty(String.prototype, 'endsWith', {
enumerable : false,
@ -35,6 +31,7 @@ if(!String.prototype.endsWith) {
}
});
}
if (!('contains' in String.prototype)) {
String.prototype.contains = function(str, startIndex) {
return -1 !== String.prototype.indexOf.call(this, str, startIndex);

View File

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

View File

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

View File

@ -1,8 +1,7 @@
var Wreqr = require('./JsLibraries/backbone.wreqr');
module.exports = (function(){
'use strict';
var vent = new Wreqr.EventAggregator();
vent.Events = {
SeriesAdded : 'series:added',
SeriesDeleted : 'series:deleted',
@ -10,6 +9,7 @@ module.exports = (function(){
ServerUpdated : 'server:updated',
EpisodeFileDeleted : 'episodefile:deleted'
};
vent.Commands = {
EditSeriesCommand : 'EditSeriesCommand',
DeleteSeriesCommand : 'DeleteSeriesCommand',
@ -26,10 +26,11 @@ module.exports = (function(){
OpenControlPanelCommand : 'OpenControlPanelCommand',
CloseControlPanelCommand : 'CloseControlPanelCommand'
};
vent.Hotkeys = {
NavbarSearch : 'navbar:search',
SaveSettings : 'settings:save',
ShowHotkeys : 'hotkeys:show'
};
return vent;
}).call(this);
module.exports = vent;