You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readarr/NzbDrone.Web/_backboneApp/app.js

75 lines
1.6 KiB

/// <reference path="JsLibraries/jquery.js" />
/// <reference path="JsLibraries/underscore.js" />
/// <reference path="JsLibraries/backbone.js" />
/// <reference path="JsLibraries/backbone.modelbinder.js" />
/// <reference path="JsLibraries/backbone.marionette.js" />
/// <reference path="JsLibraries/backbone.marionette.extend.js" />
/// <reference path="JsLibraries/backbone.modelbinder.js" />
/// <reference path="JsLibraries/bootstrap.js" />
/// <reference path="errorHandler.js" />
if (typeof console == "undefined") {
window.console = { log: function () { } };
}
NzbDrone = new Backbone.Marionette.Application();
NzbDrone.AddSeries = NzbDrone.module("AddSeries");
NzbDrone.ModelBinder = new Backbone.ModelBinder();
NzbDrone.Constants = {
ApiRoot: '/api/'
};
NzbDrone.Events = {
DisplayInMainRegion: "DisplayInMainRegion",
};
NzbDrone.Routes = {
Series: {
Add: 'series/add',
},
};
NzbDrone.Controller = Backbone.Marionette.Controller.extend({
addSeries: function () {
NzbDrone.mainRegion.show(new NzbDrone.AddSeries.AddSeriesLayout());
},
notFound: function () {
alert('route not found');
},
});
NzbDrone.Router = 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.Router();
Backbone.history.start();
});