mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-13 16:43:58 -07:00
fully working add series
This commit is contained in:
parent
57ccc51393
commit
96810c489c
21 changed files with 295 additions and 314 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue