|
|
|
@ -85,6 +85,8 @@ define([
|
|
|
|
|
search: function () {
|
|
|
|
|
var icon = this.ui.searchButton.find('icon');
|
|
|
|
|
|
|
|
|
|
var deferred = $.Deferred();
|
|
|
|
|
|
|
|
|
|
this.collection.reset();
|
|
|
|
|
icon.removeClass('icon-search').addClass('icon-spin icon-spinner disabled');
|
|
|
|
|
|
|
|
|
@ -92,11 +94,15 @@ define([
|
|
|
|
|
data : { term: this.ui.searchText.val() },
|
|
|
|
|
success: function (collection) {
|
|
|
|
|
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
|
|
|
|
deferred.resolve();
|
|
|
|
|
},
|
|
|
|
|
fail : function () {
|
|
|
|
|
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
|
|
|
|
deferred.reject();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return deferred.promise();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
keyDown: function (e) {
|
|
|
|
@ -141,15 +147,27 @@ define([
|
|
|
|
|
|
|
|
|
|
refreshItems: function () {
|
|
|
|
|
this.collection.importItems(this.model);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
NzbDrone.AddSeries.Existing.ImportSeriesView = Backbone.Marionette.CollectionView.extend({
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
itemView: NzbDrone.AddSeries.Existing.RootFolderCompositeView,
|
|
|
|
|
showCollection: function () {
|
|
|
|
|
this.showAndSearch(0);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
initialize: function () {
|
|
|
|
|
this.collection = rootFolders;
|
|
|
|
|
showAndSearch: function (index) {
|
|
|
|
|
|
|
|
|
|
var model = this.collection.at(index);
|
|
|
|
|
if (model) {
|
|
|
|
|
var that = this;
|
|
|
|
|
var currentIndex = index;
|
|
|
|
|
this.addItemView(model, this.getItemView(), index);
|
|
|
|
|
console.log('start');
|
|
|
|
|
$.when(this.children.findByModel(model).search())
|
|
|
|
|
.then(function () {
|
|
|
|
|
console.log('done');
|
|
|
|
|
that.showAndSearch(currentIndex + 1);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|