parent
694714726c
commit
6ca17942f0
Binary file not shown.
@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Series/SeriesCollection',
|
||||
'Series/SeasonCollection',
|
||||
'SeasonPass/SeriesCollectionView',
|
||||
'Shared/LoadingView'
|
||||
], function (Marionette,
|
||||
SeriesCollection,
|
||||
SeasonCollection,
|
||||
SeriesCollectionView,
|
||||
LoadingView) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'SeasonPass/LayoutTemplate',
|
||||
|
||||
regions: {
|
||||
series: '#x-series'
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
var self = this;
|
||||
|
||||
this.series.show(new LoadingView());
|
||||
|
||||
this.seriesCollection = SeriesCollection;
|
||||
this.seasonCollection = new SeasonCollection();
|
||||
|
||||
var promise = this.seasonCollection.fetch();
|
||||
|
||||
promise.done(function () {
|
||||
self.series.show(new SeriesCollectionView({
|
||||
collection: self.seriesCollection,
|
||||
seasonCollection: self.seasonCollection
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'SeasonPass/SeriesLayout'
|
||||
], function (Marionette, SeriesLayout) {
|
||||
return Marionette.CollectionView.extend({
|
||||
|
||||
itemView: SeriesLayout,
|
||||
|
||||
initialize: function (options) {
|
||||
|
||||
if (!options.seasonCollection) {
|
||||
throw 'seasonCollection is needed';
|
||||
}
|
||||
|
||||
this.seasonCollection = options.seasonCollection;
|
||||
},
|
||||
|
||||
itemViewOptions: function () {
|
||||
return {
|
||||
seasonCollection: this.seasonCollection
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Reference in new issue