EpisodeActivity cleanup

This commit is contained in:
Mark McDowall 2013-10-05 16:55:32 -07:00
parent 6cff6122a1
commit 7d2c6339bc
2 changed files with 8 additions and 16 deletions

View File

@ -11,18 +11,15 @@ define(
originalFetch: Backbone.Collection.prototype.fetch, originalFetch: Backbone.Collection.prototype.fetch,
initialize: function (options) { initialize: function (options) {
if (!options.episodeId) {
throw 'episodeId is required';
}
this.episodeId = options.episodeId; this.episodeId = options.episodeId;
}, },
fetch: function (options) { fetch: function (options) {
if (!this.episodeId) { options = options || {};
throw 'episodeId is required';
}
if (!options) {
options = {};
}
options.data = { episodeId: this.episodeId }; options.data = { episodeId: this.episodeId };
return this.originalFetch.call(this, options); return this.originalFetch.call(this, options);

View File

@ -48,17 +48,12 @@ define(
this.series = options.series; this.series = options.series;
this.collection = new EpisodeActivityCollection({ episodeId: this.model.id }); this.collection = new EpisodeActivityCollection({ episodeId: this.model.id });
this.collection.fetch();
this.listenTo(this.collection, 'sync', this._showTable);
}, },
onShow: function () { onRender: function () {
var self = this;
this.activityTable.show(new LoadingView()); this.activityTable.show(new LoadingView());
var promise = this.collection.fetch();
promise.done(function () {
self._showTable();
});
}, },
_showTable: function () { _showTable: function () {