|
|
@ -1,15 +1,16 @@
|
|
|
|
'use strict';
|
|
|
|
'use strict';
|
|
|
|
define(
|
|
|
|
define(
|
|
|
|
[
|
|
|
|
[
|
|
|
|
|
|
|
|
'underscore',
|
|
|
|
'vent',
|
|
|
|
'vent',
|
|
|
|
'marionette',
|
|
|
|
'marionette',
|
|
|
|
'AddSeries/AddSeriesCollection',
|
|
|
|
'AddSeries/AddSeriesCollection',
|
|
|
|
'AddSeries/SearchResultCollectionView',
|
|
|
|
'AddSeries/SearchResultCollectionView',
|
|
|
|
'AddSeries/EmptyView',
|
|
|
|
'AddSeries/EmptyView',
|
|
|
|
'AddSeries/NotFoundView',
|
|
|
|
'AddSeries/NotFoundView',
|
|
|
|
'Shared/LoadingView',
|
|
|
|
'AddSeries/ErrorView',
|
|
|
|
'underscore'
|
|
|
|
'Shared/LoadingView'
|
|
|
|
], function (vent, Marionette, AddSeriesCollection, SearchResultCollectionView, EmptyView, NotFoundView, LoadingView, _) {
|
|
|
|
], function (_, vent, Marionette, AddSeriesCollection, SearchResultCollectionView, EmptyView, NotFoundView, ErrorView, LoadingView) {
|
|
|
|
return Marionette.Layout.extend({
|
|
|
|
return Marionette.Layout.extend({
|
|
|
|
template: 'AddSeries/AddSeriesViewTemplate',
|
|
|
|
template: 'AddSeries/AddSeriesViewTemplate',
|
|
|
|
|
|
|
|
|
|
|
@ -83,6 +84,7 @@ define(
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
search: function (options) {
|
|
|
|
search: function (options) {
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
|
|
this.collection.reset();
|
|
|
|
this.collection.reset();
|
|
|
|
|
|
|
|
|
|
|
@ -96,6 +98,10 @@ define(
|
|
|
|
data: { term: options.term }
|
|
|
|
data: { term: options.term }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.currentSearchPromise.fail(function () {
|
|
|
|
|
|
|
|
self._showError();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return this.currentSearchPromise;
|
|
|
|
return this.currentSearchPromise;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
@ -155,6 +161,13 @@ define(
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
this._clearResults();
|
|
|
|
this._clearResults();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_showError: function () {
|
|
|
|
|
|
|
|
if (!this.isClosed) {
|
|
|
|
|
|
|
|
this.ui.searchBar.show();
|
|
|
|
|
|
|
|
this.searchResult.show(new ErrorView({term: this.collection.term}));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|