2013-06-22 09:24:24 +03:00
|
|
|
'use strict';
|
2013-06-25 02:41:59 +03:00
|
|
|
define(
|
|
|
|
[
|
|
|
|
'marionette',
|
|
|
|
'Series/EpisodeCollection',
|
|
|
|
'Series/SeasonCollection',
|
|
|
|
'Series/Details/SeasonCollectionView',
|
|
|
|
'Shared/LoadingView',
|
|
|
|
'backstrech'
|
|
|
|
], function (Marionette, EpisodeCollection, SeasonCollection, SeasonCollectionView, LoadingView) {
|
|
|
|
return Marionette.Layout.extend({
|
2013-06-01 22:31:39 +03:00
|
|
|
|
|
|
|
itemViewContainer: '.x-series-seasons',
|
|
|
|
template : 'Series/Details/SeriesDetailsTemplate',
|
|
|
|
|
|
|
|
regions: {
|
|
|
|
seasons: '#seasons'
|
|
|
|
},
|
|
|
|
|
2013-06-07 08:15:07 +03:00
|
|
|
ui: {
|
|
|
|
header: '.x-header'
|
|
|
|
},
|
|
|
|
|
|
|
|
initialize: function () {
|
|
|
|
$('body').addClass('backdrop');
|
|
|
|
},
|
2013-06-01 22:31:39 +03:00
|
|
|
|
2013-06-07 08:15:07 +03:00
|
|
|
onShow: function () {
|
2013-06-01 22:31:39 +03:00
|
|
|
var self = this;
|
|
|
|
|
2013-06-14 03:39:53 +03:00
|
|
|
if (this.model.has('fanArt')) {
|
|
|
|
$.backstretch(this.model.get('fanArt'));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('body').removeClass('backdrop');
|
|
|
|
}
|
2013-06-07 08:15:07 +03:00
|
|
|
|
2013-06-25 02:41:59 +03:00
|
|
|
this.seasons.show(new LoadingView());
|
2013-06-01 22:31:39 +03:00
|
|
|
|
2013-06-25 02:41:59 +03:00
|
|
|
this.seasonCollection = new SeasonCollection();
|
|
|
|
this.episodeCollection = new EpisodeCollection();
|
2013-06-01 22:31:39 +03:00
|
|
|
|
2013-06-25 02:41:59 +03:00
|
|
|
$.when(this.episodeCollection.fetch({data: { seriesId: this.model.id }}), this.seasonCollection.fetch({data: { seriesId: this.model.id }})).done(function () {
|
|
|
|
self.seasons.show(new SeasonCollectionView({
|
|
|
|
collection : self.seasonCollection,
|
2013-06-29 03:35:21 +03:00
|
|
|
episodeCollection: self.episodeCollection,
|
|
|
|
series : self.model
|
2013-06-25 02:41:59 +03:00
|
|
|
}));
|
|
|
|
});
|
2013-06-01 22:31:39 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
onClose: function () {
|
|
|
|
$('.backstretch').remove();
|
2013-06-07 08:15:07 +03:00
|
|
|
$('body').removeClass('backdrop');
|
2013-06-01 22:31:39 +03:00
|
|
|
}
|
|
|
|
});
|
2013-06-25 02:41:59 +03:00
|
|
|
});
|