fix add existing series.

This commit is contained in:
Keivan Beigi 2013-09-18 12:43:37 -07:00
parent 42efef0bb2
commit 904061c2f0
3 changed files with 17 additions and 11 deletions

View File

@ -1,14 +1,17 @@
{{#if folder.path}}
<div class="row well unmapped-folder-path">
<div class="row unmapped-folder-path">
<div class="span11">
{{folder.path}}
</div>
</div>
{{/if}}
</div>{{/if}}
<div class="row x-search-bar">
<div class="input-prepend nz-input-large add-series-search span11">
<i class="add-on icon-search"/>
{{#if folder}}
<input type="text" class="input-block-level x-series-search" value="{{folder.name}}">
{{else}}
<input type="text" class="input-block-level x-series-search" placeholder="Start typing the name of series you want to add ...">
{{/if}}
</div>
</div>
<div class="row">
@ -17,4 +20,4 @@
<div class="btn btn-block text-center new-series-loadmore x-load-more" style="display: none;">
<i class="icon-angle-down"/>
more
</div>
</div>{{debug}}

View File

@ -60,10 +60,10 @@ define(
_onLoadMore: function () {
var showingAll = this.resultCollectionView.showMore();
this.ui.searchBar.show();
if (showingAll) {
this.ui.loadMore.hide();
this.ui.searchBar.show();
}
},
@ -94,7 +94,7 @@ define(
this.collection.reset();
if (!options.term || options.term === this.collection.term) {
return;
return $.Deferred().resolve();
}
this.searchResult.show(new LoadingView());
@ -102,6 +102,8 @@ define(
this.currentSearchPromise = this.collection.fetch({
data: { term: options.term }
});
return this.currentSearchPromise;
},
_showResults: function () {

View File

@ -20,17 +20,18 @@ define(
},
_showAndSearch: function (index) {
var self = this;
var model = this.collection.at(index);
if (model) {
var self = this;
var currentIndex = index;
var folderName = model.get('folder').name;
this.addItemView(model, this.getItemView(), index);
$.when(this.children.findByModel(model).search({term: folderName})).then(function () {
self._showAndSearch(currentIndex + 1);
});
this.children.findByModel(model)
.search({term: folderName})
.always((function () {
self._showAndSearch(currentIndex + 1);
}));
}
},