mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-13 16:43:58 -07:00
updating add existing series to use the common views.
This commit is contained in:
parent
1b55859eb2
commit
3c686808f2
9 changed files with 147 additions and 84 deletions
|
@ -2,15 +2,45 @@
|
|||
define(
|
||||
[
|
||||
'marionette',
|
||||
'AddSeries/SearchResultView'
|
||||
], function (Marionette, SearchResultView) {
|
||||
'AddSeries/SearchResultView',
|
||||
'AddSeries/Collection'
|
||||
|
||||
], function (Marionette, SearchResultView, SearchResultCollection) {
|
||||
|
||||
return Marionette.CollectionView.extend({
|
||||
|
||||
itemView : SearchResultView,
|
||||
initialize: function () {
|
||||
this.listenTo(this.collection, 'reset', this.render);
|
||||
itemView: SearchResultView,
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue