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

73 lines
1.5 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" />
/// <reference path="JsLibraries/backbone.js" />
/// <reference path="JsLibraries/backbone.marionette.js" />
/// <reference path="JsLibraries/backbone.marionette.extend.js" />
/// <reference path="JsLibraries/bootstrap.js" />
2013-01-23 01:23:27 +00:00
/// <reference path="errorHandler.js" />
2013-01-22 23:58:08 +00:00
if (typeof console == "undefined") {
window.console = { log: function () { } };
}
2013-01-22 23:58:08 +00:00
NzbDrone = new Backbone.Marionette.Application();
NzbDrone.AddSeries = NzbDrone.module("AddSeries");
2013-01-23 05:03:57 +00:00
NzbDrone.Constants = {
2013-01-23 05:03:57 +00:00
ApiRoot: '/api/'
};
NzbDrone.Events = {
DisplayInMainRegion: "DisplayInMainRegion",
};
NzbDrone.Routes = {
Series: {
Add: 'series/add',
},
};
NzbDrone.Controller = Backbone.Marionette.Controller.extend({
addSeries: function () {
2013-01-23 01:23:27 +00:00
NzbDrone.mainRegion.show(new NzbDrone.AddSeries.AddSeriesLayout());
},
notFound: function () {
alert('route not found');
},
});
NzbDrone.MyRouter = Backbone.Marionette.AppRouter.extend({
controller: new NzbDrone.Controller(),
// "someMethod" must exist at controller.someMethod
appRoutes: {
"series/add": "addSeries",
":whatever": "notFound"
}
});
NzbDrone.addInitializer(function (options) {
console.log("starting application");
NzbDrone.addRegions({
mainRegion: "#main-region",
});
NzbDrone.Router = new NzbDrone.MyRouter();
Backbone.history.start();
});