mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
Added search bar under nav bar to jump to series by searching
This commit is contained in:
parent
8ff34aac4d
commit
48dbc127a7
6 changed files with 98 additions and 33 deletions
29
UI/Navbar/Search.js
Normal file
29
UI/Navbar/Search.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'Series/SeriesCollection'
|
||||
], function (App, SeriesCollection) {
|
||||
$.fn.bindSearch = function () {
|
||||
$(this).typeahead({
|
||||
source : function () {
|
||||
return SeriesCollection.map(function (model) {
|
||||
return model.get('title');
|
||||
});
|
||||
},
|
||||
|
||||
sorter: function (items) {
|
||||
return items.sort();
|
||||
},
|
||||
|
||||
updater: function (item) {
|
||||
var series = SeriesCollection.find(function (model) {
|
||||
return model.get('title') === item;
|
||||
});
|
||||
|
||||
this.$element.blur();
|
||||
App.Router.navigate('/series/{0}'.format(series.get('titleSlug')), { trigger: true });
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue