added teacher autocomplete
This commit is contained in:
parent
26fc6d05ce
commit
176aecaa8a
@ -58,7 +58,7 @@
|
||||
<p class="input">Hour:</p><br>
|
||||
<input class="creInput" type="text" name="hour"><br>
|
||||
<p class="input">Teacher:</p><br>
|
||||
<input class="creInput" type="text" name="teacher"><br>
|
||||
{{> inputAutocomplete settings=teachercomplete class="form-control creInput" type="text" name="teacher" placeholder="Example: Woods" }}
|
||||
<p class="input">Class Name:</p><br>
|
||||
<input class="creInput" type="text" name="classname"><br>
|
||||
<p class="input">Privacy:</p><br>
|
||||
@ -99,3 +99,7 @@
|
||||
<template name="schoollist">
|
||||
{{name}}
|
||||
</template>
|
||||
|
||||
<template name="teacherlist">
|
||||
{{teacher}}
|
||||
</template>
|
||||
@ -115,6 +115,20 @@ Template.main.helpers({
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
teachercomplete() {
|
||||
return {
|
||||
position: "bottom",
|
||||
limit: 1,
|
||||
rules: [
|
||||
{
|
||||
token: '',
|
||||
collection: classes,
|
||||
field: 'teacher',
|
||||
template: Template.teacherlist
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user