1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-27 18:30:45 +00:00
Radarr/UI/AddSeries/Existing/CollectionView.js
Keivan Beigi 24c77b4047 broken
2013-06-20 18:43:58 -07:00

40 lines
1.2 KiB
JavaScript

'use strict';
define(
[
'marionette',
'AddSeries/Existing/CompositeView',
'AddSeries/Existing/UnmappedFolderCollection'
], function (Marionette, UnmappedFolderCompositeView, UnmappedFolderCollection) {
return Marionette.CollectionView.extend({
itemView: UnmappedFolderCompositeView,
initialize: function () {
this.collection = new UnmappedFolderCollection();
this.refreshItems();
},
refreshItems: function () {
this.collection.importItems(this.model);
},
showCollection: function () {
this._showAndSearch(0);
},
_showAndSearch: function (index) {
var model = this.collection.at(index);
if (model) {
var that = this;
var currentIndex = index;
this.addItemView(model, this.getItemView(), index);
$.when(this.children.findByModel(model).search()).then(function () {
that._showAndSearch(currentIndex + 1);
});
}
}
});
});