1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-18 23:48:35 +02:00
Sonarr/src/UI/Router.js

66 lines
2.2 KiB
JavaScript
Raw Normal View History

2013-06-26 04:00:56 +03:00
'use strict';
2013-06-21 04:43:58 +03:00
require(
[
2013-06-21 08:19:41 +03:00
'app',
'backbone',
2013-06-21 04:43:58 +03:00
'marionette',
2013-06-21 08:19:41 +03:00
'Controller',
'Series/SeriesCollection',
'ProgressMessaging/ProgressMessageCollection',
2013-09-11 09:33:47 +03:00
'Commands/CommandMessengerCollectionView',
'History/Queue/QueueCollection',
'Navbar/NavbarView',
'jQuery/RouteBinder',
'jquery'
], function (App,
Backbone,
Marionette,
Controller,
SeriesCollection,
ProgressMessageCollection,
CommandMessengerCollectionView,
QueueCollection,
NavbarView,
RouterBinder,
$) {
2013-06-21 04:43:58 +03:00
var Router = Marionette.AppRouter.extend({
2013-06-21 04:43:58 +03:00
controller: new Controller(),
2013-06-21 04:43:58 +03:00
appRoutes : {
2013-06-26 04:00:56 +03:00
'' : 'series',
'series' : 'series',
'addseries' : 'addSeries',
'addseries/:action(/:query)': 'addSeries',
'series/:query' : 'seriesDetails',
'calendar' : 'calendar',
'settings' : 'settings',
'settings/:action(/:query)' : 'settings',
'missing' : 'missing',
'history' : 'history',
'history/:action' : 'history',
2013-06-26 04:00:56 +03:00
'rss' : 'rss',
2013-07-28 23:20:26 +03:00
'system' : 'system',
'system/:action' : 'system',
'seasonpass' : 'seasonPass',
2013-06-26 04:00:56 +03:00
':whatever' : 'notFound'
2013-06-21 04:43:58 +03:00
}
});
2013-06-21 08:19:41 +03:00
App.addInitializer(function () {
2013-06-21 08:19:41 +03:00
App.Router = new Router();
2013-06-21 08:19:41 +03:00
SeriesCollection.fetch().done(function () {
2013-09-11 09:33:47 +03:00
Backbone.history.start({ pushState: true });
RouterBinder.bind(App.Router);
App.navbarRegion.show(new NavbarView());
$('body').addClass('started');
});
2013-06-21 08:19:41 +03:00
});
return App.Router;
2013-06-21 08:19:41 +03:00
2013-06-21 04:43:58 +03:00
});