Skip to content

Commit

Permalink
Merge pull request #147 from will-moore/improve_file_filter
Browse files Browse the repository at this point in the history
Improve file filter
  • Loading branch information
jburel committed Apr 14, 2016
2 parents 7b52b85 + e2193d7 commit 6f8a598
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ To concatenate js files into a single figure.js file that is used in the app:

$ grunt concat

During development, you'll want to have both of these run whenever the relevant are edited.
During development, you'll want to have both of these run whenever the relevant files are edited.
This can be achieved with:

$ grunt watch
Expand Down
10 changes: 7 additions & 3 deletions static/figure/figure.js
Original file line number Diff line number Diff line change
Expand Up @@ -3074,9 +3074,13 @@ var FigureFile = Backbone.Model.extend({
}
}
if (filter.name) {
if (this.get('name').toLowerCase().indexOf(filter.name) < 0) {
return false;
}
// Search for files that have all words in
var name = this.get('name').toLowerCase();
var words = $.trim(filter.name).split(" ");
var visible = words.reduce(function(prev, t){
return prev && name.indexOf(t) > -1
}, true);
return visible;
}
return true;
}
Expand Down
10 changes: 7 additions & 3 deletions static/figure/js/views/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ var FigureFile = Backbone.Model.extend({
}
}
if (filter.name) {
if (this.get('name').toLowerCase().indexOf(filter.name) < 0) {
return false;
}
// Search for files that have all words in
var name = this.get('name').toLowerCase();
var words = $.trim(filter.name).split(" ");
var visible = words.reduce(function(prev, t){
return prev && name.indexOf(t) > -1
}, true);
return visible;
}
return true;
}
Expand Down

0 comments on commit 6f8a598

Please sign in to comment.