mirror of
https://github.com/2ec0b4/kaamelott-soundboard.git
synced 2025-12-08 23:53:24 +00:00
WIP - Filtre les sons
This commit is contained in:
@@ -11,13 +11,13 @@ define(
|
||||
var Sounds = Backbone.Collection.extend({
|
||||
model: Sound,
|
||||
url: 'sounds/sounds.json',
|
||||
search : function(search){
|
||||
filterByTitle: function(search){
|
||||
if( search == "" ) {
|
||||
return this;
|
||||
}
|
||||
|
||||
var pattern = new RegExp('^'+search, 'gi');
|
||||
return _(this.filter(function(data) {
|
||||
return new Sounds(this.filter(function(data) {
|
||||
return pattern.test(data.get('title'));
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user