mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 17:13:49 -07:00
added not found placeholder in add series
added path validation to add series
This commit is contained in:
parent
cdb195a44f
commit
ac18d6c704
9 changed files with 108 additions and 39 deletions
|
@ -5,8 +5,9 @@ define(
|
|||
'marionette',
|
||||
'AddSeries/Collection',
|
||||
'AddSeries/SearchResultCollectionView',
|
||||
'Shared/LoadingView'
|
||||
], function (App, Marionette, AddSeriesCollection, SearchResultCollectionView, LoadingView) {
|
||||
'AddSeries/NotFoundView',
|
||||
'Shared/LoadingView',
|
||||
], function (App, Marionette, AddSeriesCollection, SearchResultCollectionView, NotFoundView, LoadingView) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'AddSeries/AddSeriesTemplate',
|
||||
|
||||
|
@ -44,6 +45,8 @@ define(
|
|||
else {
|
||||
this.className = 'new-series';
|
||||
}
|
||||
|
||||
this.listenTo(this.collection, 'sync', this._showResults);
|
||||
},
|
||||
|
||||
_onSeriesAdded: function (options) {
|
||||
|
@ -78,8 +81,6 @@ define(
|
|||
|
||||
search: function (options) {
|
||||
|
||||
var self = this;
|
||||
|
||||
this.abortExistingSearch();
|
||||
|
||||
this.collection.reset();
|
||||
|
@ -89,20 +90,29 @@ define(
|
|||
}
|
||||
else {
|
||||
this.searchResult.show(new LoadingView());
|
||||
this.collection.term = options.term;
|
||||
this.currentSearchPromise = this.collection.fetch({
|
||||
data: { term: options.term }
|
||||
}).done(function () {
|
||||
if (!self.isClosed) {
|
||||
self.searchResult.show(self.resultCollectionView);
|
||||
if (!self.showingAll && self.isExisting) {
|
||||
self.ui.loadMore.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return this.currentSearchPromise;
|
||||
},
|
||||
|
||||
_showResults: function () {
|
||||
if (!this.isClosed) {
|
||||
|
||||
if (this.collection.length === 0) {
|
||||
this.searchResult.show(new NotFoundView({term: this.collection.term}));
|
||||
}
|
||||
else {
|
||||
this.searchResult.show(this.resultCollectionView);
|
||||
if (!this.showingAll && this.isExisting) {
|
||||
this.ui.loadMore.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
abortExistingSearch: function () {
|
||||
if (this.currentSearchPromise && this.currentSearchPromise.readyState > 0 && this.currentSearchPromise.readyState < 4) {
|
||||
console.log('aborting previous pending search request.');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue