sonarr-repo-only/NzbDrone.Web/_backboneApp/app.js

86 lines
2.1 KiB
JavaScript
Raw Normal View History

2013-01-23 01:23:27 +00:00
/// <reference path="JsLibraries/jquery.js" />
2013-01-22 23:58:08 +00:00
/// <reference path="JsLibraries/underscore.js" />
2013-01-25 17:54:45 +00:00
/// <reference path="JsLibraries/sugar.js" />
2013-01-22 23:58:08 +00:00
/// <reference path="JsLibraries/backbone.js" />
/// <reference path="JsLibraries/handlebars.js" />
/// <reference path="JsLibraries/backbone.modelbinder.js" />
2013-01-25 17:54:45 +00:00
/// <reference path="JsLibraries/backbone.mutators.js" />
/// <reference path="JsLibraries/backbone.shortcuts.js" />
2013-01-22 23:58:08 +00:00
/// <reference path="JsLibraries/backbone.marionette.js" />
/// <reference path="JsLibraries/backbone.marionette.extend.js" />
2013-01-27 02:14:42 +00:00
/// <reference path="JsLibraries/backbone.marionette.viewswapper.js" />
/// <reference path="JsLibraries/backbone.modelbinder.js" />
2013-01-22 23:58:08 +00:00
/// <reference path="JsLibraries/bootstrap.js" />
if (typeof console === undefined) {
window.console = { log: function () { } };
}
2013-01-22 23:58:08 +00:00
NzbDrone = new Backbone.Marionette.Application();
2013-01-31 22:40:51 +00:00
NzbDrone.Series = {};
NzbDrone.AddSeries = {};
NzbDrone.AddSeries.New = {};
NzbDrone.AddSeries.Existing = {};
NzbDrone.AddSeries.RootFolders = {};
NzbDrone.Quality = {};
NzbDrone.Shared = {};
2013-01-27 02:14:42 +00:00
/*
_.templateSettings = {
interpolate: /\{\{([\s\S]+?)\}\}/g
};
2013-01-27 02:14:42 +00:00
*/
NzbDrone.ModelBinder = new Backbone.ModelBinder();
2013-01-23 05:03:57 +00:00
NzbDrone.Constants = {
ApiRoot: '/api'
};
NzbDrone.Events = {
DisplayInMainRegion: 'DisplayInMainRegion'
};
2013-01-26 20:05:08 +00:00
NzbDrone.Controller = Backbone.Marionette.Controller.extend({
2013-01-29 02:00:35 +00:00
addSeries: function (action, query) {
NzbDrone.mainRegion.show(new NzbDrone.AddSeries.AddSeriesLayout(this, action, query));
2013-01-26 20:05:08 +00:00
},
2013-01-26 20:05:08 +00:00
notFound: function () {
alert('route not found');
2013-01-28 18:06:54 +00:00
}
2013-01-26 20:05:08 +00:00
});
NzbDrone.Router = Backbone.Marionette.AppRouter.extend({
controller: new NzbDrone.Controller(),
// "someMethod" must exist at controller.someMethod
appRoutes: {
'series/add': 'addSeries',
'series/add/:action(/:query)': 'addSeries',
':whatever': 'notFound'
}
});
NzbDrone.addInitializer(function (options) {
console.log('starting application');
NzbDrone.addRegions({
mainRegion: '#main-region',
notificationRegion: '#notification-region'
});
NzbDrone.Router = new NzbDrone.Router();
Backbone.history.start();
});