1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-31 07:52:37 +01:00

series collection is now loaded on app start.

This commit is contained in:
Keivan Beigi 2013-08-01 17:24:00 -07:00
parent f44ef2ff5e
commit 1f7d57c2c2
5 changed files with 19 additions and 26 deletions

View File

@ -45,18 +45,6 @@ namespace NzbDrone.Api.Series
return GetSeriesResource(series); return GetSeriesResource(series);
} }
private Response GetSeriesBySlug(string slug)
{
var series = _seriesService.FindBySlug(slug);
if (series == null)
{
return new NotFoundResponse();
}
return GetSeriesResource(series).AsResponse();
}
private SeriesResource GetSeriesResource(Core.Tv.Series series) private SeriesResource GetSeriesResource(Core.Tv.Series series)
{ {
if (series == null) return null; if (series == null) return null;

View File

@ -18,24 +18,31 @@ define(
'System/Layout', 'System/Layout',
'Shared/NotFoundView', 'Shared/NotFoundView',
'Shared/Modal/Region' 'Shared/Modal/Region'
], function (App, Marionette, HistoryLayout, SettingsLayout, AddSeriesLayout, SeriesIndexLayout, SeriesDetailsLayout,SeriesCollection, MissingLayout, SeriesModel, CalendarLayout, ], function (App, Marionette, HistoryLayout, SettingsLayout, AddSeriesLayout, SeriesIndexLayout, SeriesDetailsLayout, SeriesCollection, MissingLayout, SeriesModel, CalendarLayout,
LogsLayout, LogFileLayout, ReleaseLayout, SystemLayout, NotFoundView) { LogsLayout, LogFileLayout, ReleaseLayout, SystemLayout, NotFoundView) {
return Marionette.Controller.extend({ return Marionette.Controller.extend({
series : function () { series: function () {
this._setTitle('NzbDrone'); this._setTitle('NzbDrone');
App.mainRegion.show(new SeriesIndexLayout()); App.mainRegion.show(new SeriesIndexLayout());
}, },
seriesDetails: function (query) { seriesDetails: function (query) {
var series = SeriesCollection.where({titleSlug: query});
var series = SeriesCollection.where({titleSlug : query}); if (series.length != 0) {
if(series.length != 0){
var targetSeries = series[0]; var targetSeries = series[0];
this._setTitle(targetSeries.get('title')); this._setTitle(targetSeries.get('title'));
App.mainRegion.show(new SeriesDetailsLayout({ model: targetSeries })); App.mainRegion.show(new SeriesDetailsLayout({ model: targetSeries }));
} }
else {
this.notFound();
}
},
_showSeriesDetail: function(seriesModel){
}, },
addSeries: function (action) { addSeries: function (action) {

View File

@ -4,8 +4,9 @@ require(
'app', 'app',
'marionette', 'marionette',
'Controller', 'Controller',
'Series/SeriesCollection',
'jQuery/RouteBinder' 'jQuery/RouteBinder'
], function (App, Marionette, Controller, RouterBinder) { ], function (App, Marionette, Controller, SeriesCollection, RouterBinder) {
var Router = Marionette.AppRouter.extend({ var Router = Marionette.AppRouter.extend({
@ -32,9 +33,12 @@ require(
App.addInitializer(function () { App.addInitializer(function () {
App.Router = new Router(); App.Router = new Router();
Backbone.history.start({ pushState: true });
RouterBinder.bind(App.Router); SeriesCollection.fetch()
.done(function(){
Backbone.history.start({ pushState: true });
RouterBinder.bind(App.Router);
})
}); });
return App.Router; return App.Router;

View File

@ -174,10 +174,6 @@ define(
}, },
_fetchCollection: function () { _fetchCollection: function () {
if (SeriesCollection.length === 0) {
this.seriesRegion.show(new LoadingView());
}
SeriesCollection.fetch(); SeriesCollection.fetch();
}, },

View File

@ -19,7 +19,5 @@ define(
}); });
var collection = new Collection(); var collection = new Collection();
collection.fetch();
return collection; return collection;
}); });