Fix Navbar Search after new DB Schema (#60)

Fix Navbar Search after new DB Schema
pull/62/head
Qstick 7 years ago committed by GitHub
parent 2575403c6b
commit 0da6f6e3c7

@ -13,7 +13,7 @@ var substringMatcher = function() {
return function findMatches (q, cb) { return function findMatches (q, cb) {
var matches = _.select(ArtistCollection.toJSON(), function(artist) { var matches = _.select(ArtistCollection.toJSON(), function(artist) {
return artist.artistName.toLowerCase().indexOf(q.toLowerCase()) > -1; return artist.name.toLowerCase().indexOf(q.toLowerCase()) > -1;
}); });
cb(matches); cb(matches);
}; };
@ -26,13 +26,13 @@ $.fn.bindSearch = function() {
minLength : 1 minLength : 1
}, { }, {
name : 'artist', name : 'artist',
displayKey : 'artistName', displayKey : 'name',
source : substringMatcher() source : substringMatcher()
}); });
$(this).on('typeahead:selected typeahead:autocompleted', function(e, artist) { $(this).on('typeahead:selected typeahead:autocompleted', function(e, artist) {
this.blur(); this.blur();
$(this).val(''); $(this).val('');
Backbone.history.navigate('/artist/{0}'.format(artist.artistSlug), { trigger : true }); Backbone.history.navigate('/artist/{0}'.format(artist.nameSlug), { trigger : true });
}); });
}; };
Loading…
Cancel
Save