1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00
Radarr/NzbDrone.Web/_backboneApp/app.js

83 lines
2.0 KiB
JavaScript
Raw Normal View History

2013-01-23 02:23:27 +01:00
/// <reference path="JsLibraries/jquery.js" />
2013-01-23 00:58:08 +01:00
/// <reference path="JsLibraries/underscore.js" />
2013-01-25 18:54:45 +01:00
/// <reference path="JsLibraries/sugar.js" />
2013-01-23 00:58:08 +01:00
/// <reference path="JsLibraries/backbone.js" />
/// <reference path="JsLibraries/handlebars.js" />
/// <reference path="JsLibraries/backbone.modelbinder.js" />
2013-01-25 18:54:45 +01:00
/// <reference path="JsLibraries/backbone.mutators.js" />
/// <reference path="JsLibraries/backbone.shortcuts.js" />
2013-01-23 00:58:08 +01:00
/// <reference path="JsLibraries/backbone.marionette.js" />
/// <reference path="JsLibraries/backbone.marionette.extend.js" />
/// <reference path="JsLibraries/backbone.modelbinder.js" />
2013-01-23 00:58:08 +01:00
/// <reference path="JsLibraries/bootstrap.js" />
2013-01-23 02:23:27 +01:00
/// <reference path="errorHandler.js" />
2013-01-23 00:58:08 +01:00
if (typeof console == "undefined") {
window.console = { log: function () { } };
}
2013-01-23 00:58:08 +01:00
NzbDrone = new Backbone.Marionette.Application();
NzbDrone.AddSeries = NzbDrone.module("AddSeries");
_.templateSettings = {
interpolate: /\{\{([\s\S]+?)\}\}/g
};
NzbDrone.ModelBinder = new Backbone.ModelBinder();
2013-01-23 06:03:57 +01:00
NzbDrone.Constants = {
2013-01-23 06:03:57 +01:00
ApiRoot: '/api/'
};
NzbDrone.Events = {
DisplayInMainRegion: "DisplayInMainRegion",
};
NzbDrone.Routes = {
Series: {
Add: 'series/add',
},
};
http://localhost:65079/_backboneApp/Content
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();
});