full autocomplete search

This commit is contained in:
Kenneth Jao 2016-10-22 17:40:42 -04:00
parent d7dcf0be86
commit a5d3193f0e

View File

@ -37,24 +37,24 @@ Template.profile.helpers({
return "Custom"; return "Custom";
},*/ },*/
classSettings() { // Returns autocomplete array for classes. classSettings() { // Returns autocomplete array for classes.
return { var hi = {
position: "bottom", position: "bottom",
limit: 10, limit: 10,
rules: [{ rules: [{
token: '', token: '',
collection: classes, collection: classes,
field: 'name',
template: Template.classDisplay, template: Template.classDisplay,
filter: { filter: {
privacy: false, privacy: false,
status: true status: true
}, },
selector: (match) => { selector: (match) => {
match = new RegExp(match, 'i'); regex = new RegExp(match, 'i');
return {or: [{'name': match}, {'teacher': match}, {'hour': match}]}; return {$or: [{'name': regex}, {'teacher': regex}, {'hour': regex}]};
} }
}] }]
}; };
return hi;
}, },
schoolComplete() { // Returns autocomplete array for schools. schoolComplete() { // Returns autocomplete array for schools.
return { return {
@ -564,7 +564,7 @@ Template.profile.events({
Session.set("restrictText", newSetting); Session.set("restrictText", newSetting);
}, },
// AUTOCOMPLETE HANDLING // AUTOCOMPLETE HANDLING
'keyup #profClassSearch' (event) { // Auto-complete updater 'input #profClassSearch' (event) { // Auto-complete updater
if (event.target.value.length === 0) { if (event.target.value.length === 0) {
Session.set("notsearching", true); Session.set("notsearching", true);
} else { } else {