From 176aecaa8a8613f7581bde4ad2ebd12d48b09d82 Mon Sep 17 00:00:00 2001 From: yamanq Date: Tue, 9 Aug 2016 17:46:22 -0400 Subject: [PATCH] added teacher autocomplete --- hourglass/client/main/main.html | 6 +++++- hourglass/client/main/main.js | 14 ++++++++++++++ hourglass/server/main.js | 5 ----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/hourglass/client/main/main.html b/hourglass/client/main/main.html index 9bc809a..a9a079b 100644 --- a/hourglass/client/main/main.html +++ b/hourglass/client/main/main.html @@ -58,7 +58,7 @@

Hour:



Teacher:


-
+ {{> inputAutocomplete settings=teachercomplete class="form-control creInput" type="text" name="teacher" placeholder="Example: Woods" }}

Class Name:



Privacy:


@@ -98,4 +98,8 @@ + + \ No newline at end of file diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 0539820..57e2276 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -115,6 +115,20 @@ Template.main.helpers({ } ] }; + }, + teachercomplete() { + return { + position: "bottom", + limit: 1, + rules: [ + { + token: '', + collection: classes, + field: 'teacher', + template: Template.teacherlist + } + ] + }; } }); diff --git a/hourglass/server/main.js b/hourglass/server/main.js index 9c0209e..1905c71 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -12,11 +12,6 @@ Meteor.methods({ }, //No Security 'createClass': function(input) { - var distinctEntries = _.uniq(classes.find({}, { - sort: {teacher: 1}, fields: {teacher: true} - }).fetch().map(function(x) { - return x.teacher; - }), true); classes.schema.validate(input); if(Meteor.user() != null && classes.find({status:false, admin:Meteor.userId()}).fetch().length < 5 && schools.find({name:input.school}).fetch().length > 0 && input.status === false) {