pluginmanager: case handling and submit binding

- Convert query term to lower case so that it is case insensitive both ways
    - Knockout submit binding takes the form element as parameter and return
    value determines whether the form submit occurs. See http://knockoutjs.com/documentation/submit-binding.html
This commit is contained in:
Mark Walker 2015-07-07 14:24:27 -07:00
parent a1e0078ce5
commit 4a2cc5382d

View file

@ -147,19 +147,17 @@ $(function() {
} }
}); });
self.performRepositorySearch = function(e) { self.performRepositorySearch = function(formElement) {
if (e !== undefined) {
e.preventDefault();
}
var query = self.repositorySearchQuery(); var query = self.repositorySearchQuery();
if (query !== undefined && query.trim() != "") { if (query !== undefined && query.trim() != "") {
query = query.toLocaleLowerCase()
self.repositoryplugins.changeSearchFunction(function(entry) { self.repositoryplugins.changeSearchFunction(function(entry) {
return entry && (entry["title"].toLocaleLowerCase().indexOf(query) > -1 || entry["description"].toLocaleLowerCase().indexOf(query) > -1); return entry && (entry["title"].toLocaleLowerCase().indexOf(query) > -1 || entry["description"].toLocaleLowerCase().indexOf(query) > -1);
}); });
} else { } else {
self.repositoryplugins.resetSearch(); self.repositoryplugins.resetSearch();
} }
return false;
}; };
self.fromResponse = function(data) { self.fromResponse = function(data) {