mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
fully working add series
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user