fully working add series

This commit is contained in:
kay.one 2013-06-30 12:57:26 -07:00
parent 57ccc51393
commit 96810c489c
21 changed files with 295 additions and 314 deletions

View file

@ -3,9 +3,8 @@ define(
[
'marionette',
'AddSeries/SearchResultView',
'AddSeries/Collection'
], function (Marionette, SearchResultView, SearchResultCollection) {
], function (Marionette, SearchResultView) {
return Marionette.CollectionView.extend({
@ -13,34 +12,19 @@ define(
initialize: function (options) {
this.isExisting = options.isExisting;
this.fullResult = options.fullResult;
this.listenTo(this.fullResult, 'sync', this._processResultCollection);
},
showAll: function () {
this.showingAll = true;
this.fullResult.each(function (searchResult) {
this.collection.add(searchResult);
});
this.render();
},
_processResultCollection: function () {
if (!this.showingAll && this.isExisting) {
this.collection = new SearchResultCollection();
this.collection.add(this.fullResult.shift());
}
else {
this.collection = this.fullResult;
appendHtml: function (collectionView, itemView, index) {
if (!this.isExisting || this.showingAll || index === 0) {
collectionView.$el.append(itemView.el);
}
}
});
});