mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-27 12:33:00 +02:00
pluck and findWhere, not map and find
This commit is contained in:
@@ -7,9 +7,7 @@ define(
|
|||||||
$.fn.bindSearch = function () {
|
$.fn.bindSearch = function () {
|
||||||
$(this).typeahead({
|
$(this).typeahead({
|
||||||
source : function () {
|
source : function () {
|
||||||
return SeriesCollection.map(function (model) {
|
return SeriesCollection.pluck('title');
|
||||||
return model.get('title');
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
sorter: function (items) {
|
sorter: function (items) {
|
||||||
@@ -17,9 +15,7 @@ define(
|
|||||||
},
|
},
|
||||||
|
|
||||||
updater: function (item) {
|
updater: function (item) {
|
||||||
var series = SeriesCollection.find(function (model) {
|
var series = SeriesCollection.findWhere({ title: item });
|
||||||
return model.get('title') === item;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.$element.blur();
|
this.$element.blur();
|
||||||
App.Router.navigate('/series/{0}'.format(series.get('titleSlug')), { trigger: true });
|
App.Router.navigate('/series/{0}'.format(series.get('titleSlug')), { trigger: true });
|
||||||
|
Reference in New Issue
Block a user