Sonarr/src/UI/AddSeries/SearchResultCollectionView.js

29 lines
733 B
JavaScript
Raw Normal View History

2015-02-03 01:18:45 +00:00
var Marionette = require('marionette');
var SearchResultView = require('./SearchResultView');
2013-06-21 01:43:58 +00:00
2015-02-03 01:18:45 +00:00
module.exports = Marionette.CollectionView.extend({
itemView : SearchResultView,
initialize : function(options) {
2015-02-03 01:18:45 +00:00
this.isExisting = options.isExisting;
this.showing = 1;
},
showAll : function() {
2015-02-03 01:18:45 +00:00
this.showingAll = true;
this.render();
},
showMore : function() {
2015-02-03 01:18:45 +00:00
this.showing += 5;
this.render();
2015-02-03 01:18:45 +00:00
return this.showing >= this.collection.length;
},
appendHtml : function(collectionView, itemView, index) {
if (!this.isExisting || index < this.showing || index === 0) {
2015-02-03 01:18:45 +00:00
collectionView.$el.append(itemView.el);
}
}
});