1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-23 02:05:27 +02:00
Sonarr/NzbDrone.Web/_backboneApp/app.js

89 lines
2.2 KiB
JavaScript
Raw Normal View History

2013-01-23 04:23:27 +03:00
/// <reference path="JsLibraries/jquery.js" />
2013-01-23 02:58:08 +03:00
/// <reference path="JsLibraries/underscore.js" />
2013-01-25 20:54:45 +03:00
/// <reference path="JsLibraries/sugar.js" />
2013-01-23 02:58:08 +03:00
/// <reference path="JsLibraries/backbone.js" />
/// <reference path="JsLibraries/handlebars.js" />
/// <reference path="JsLibraries/backbone.modelbinder.js" />
2013-01-25 20:54:45 +03:00
/// <reference path="JsLibraries/backbone.mutators.js" />
/// <reference path="JsLibraries/backbone.shortcuts.js" />
2013-01-23 02:58:08 +03:00
/// <reference path="JsLibraries/backbone.marionette.js" />
/// <reference path="JsLibraries/backbone.marionette.extend.js" />
2013-01-27 05:14:42 +03:00
/// <reference path="JsLibraries/backbone.marionette.viewswapper.js" />
/// <reference path="JsLibraries/backbone.modelbinder.js" />
2013-01-23 02:58:08 +03:00
/// <reference path="JsLibraries/bootstrap.js" />
/// <reference path="nzbdrone.logging.js" />
2013-01-23 02:58:08 +03:00
if (typeof console == "undefined") {
window.console = { log: function () { } };
}
2013-01-23 02:58:08 +03:00
NzbDrone = new Backbone.Marionette.Application();
2013-01-28 21:06:54 +03:00
NzbDrone.Series = NzbDrone.module("Series");
2013-01-23 02:58:08 +03:00
NzbDrone.AddSeries = NzbDrone.module("AddSeries");
NzbDrone.Quality = NzbDrone.module("Quality");
2013-01-26 23:05:08 +03:00
NzbDrone.Shared = NzbDrone.module("Shared");
2013-01-27 05:14:42 +03:00
/*
_.templateSettings = {
interpolate: /\{\{([\s\S]+?)\}\}/g
};
2013-01-27 05:14:42 +03:00
*/
NzbDrone.ModelBinder = new Backbone.ModelBinder();
2013-01-23 08:03:57 +03:00
NzbDrone.Constants = {
ApiRoot: '/api'
};
NzbDrone.Events = {
2013-01-28 21:06:54 +03:00
DisplayInMainRegion: "DisplayInMainRegion"
};
NzbDrone.Routes = {
Series: {
2013-01-28 21:06:54 +03:00
Add: 'series/add'
}
};
2013-01-26 23:05:08 +03:00
NzbDrone.Controller = Backbone.Marionette.Controller.extend({
2013-01-26 23:05:08 +03:00
addSeries: function () {
NzbDrone.mainRegion.show(new NzbDrone.AddSeries.AddSeriesLayout());
},
2013-01-26 23:05:08 +03:00
notFound: function () {
alert('route not found');
2013-01-28 21:06:54 +03:00
}
2013-01-26 23:05:08 +03:00
});
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",
2013-01-28 21:06:54 +03:00
errorRegion: "#error-region"
});
NzbDrone.Router = new NzbDrone.Router();
Backbone.history.start();
});