2013-06-21 03:43:58 +02:00
|
|
|
|
'use strict';
|
|
|
|
|
define(
|
|
|
|
|
[
|
|
|
|
|
'marionette',
|
2013-06-22 02:48:23 +02:00
|
|
|
|
'AddSeries/SearchResultView',
|
|
|
|
|
|
2013-06-30 21:57:26 +02:00
|
|
|
|
], function (Marionette, SearchResultView) {
|
2013-06-21 03:43:58 +02:00
|
|
|
|
|
|
|
|
|
return Marionette.CollectionView.extend({
|
|
|
|
|
|
2013-06-22 02:48:23 +02:00
|
|
|
|
itemView: SearchResultView,
|
|
|
|
|
|
|
|
|
|
initialize: function (options) {
|
|
|
|
|
this.isExisting = options.isExisting;
|
2013-08-09 05:58:44 +02:00
|
|
|
|
this.showing = 1;
|
2013-06-22 02:48:23 +02:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
showAll: function () {
|
|
|
|
|
this.showingAll = true;
|
|
|
|
|
this.render();
|
|
|
|
|
},
|
|
|
|
|
|
2013-08-09 05:58:44 +02:00
|
|
|
|
showMore: function () {
|
|
|
|
|
this.showing += 5;
|
|
|
|
|
this.render();
|
|
|
|
|
|
|
|
|
|
return this.showing >= this.collection.length;
|
|
|
|
|
},
|
|
|
|
|
|
2013-06-30 21:57:26 +02:00
|
|
|
|
appendHtml: function (collectionView, itemView, index) {
|
2013-08-09 05:58:44 +02:00
|
|
|
|
if (!this.isExisting || index < this.showing || index === 0) {
|
2013-06-30 21:57:26 +02:00
|
|
|
|
collectionView.$el.append(itemView.el);
|
2013-06-22 02:48:23 +02:00
|
|
|
|
}
|
2013-06-21 03:43:58 +02:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|