1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

pluck and findWhere, not map and find

This commit is contained in:
Mark McDowall 2013-09-23 12:03:33 -07:00
parent ca3b4cb1d7
commit 1a2ae4bd2c

View File

@ -7,9 +7,7 @@ define(
$.fn.bindSearch = function () {
$(this).typeahead({
source : function () {
return SeriesCollection.map(function (model) {
return model.get('title');
});
return SeriesCollection.pluck('title');
},
sorter: function (items) {
@ -17,9 +15,7 @@ define(
},
updater: function (item) {
var series = SeriesCollection.find(function (model) {
return model.get('title') === item;
});
var series = SeriesCollection.findWhere({ title: item });
this.$element.blur();
App.Router.navigate('/series/{0}'.format(series.get('titleSlug')), { trigger: true });