added teacher autocomplete
This commit is contained in:
parent
26fc6d05ce
commit
176aecaa8a
@ -58,7 +58,7 @@
|
|||||||
<p class="input">Hour:</p><br>
|
<p class="input">Hour:</p><br>
|
||||||
<input class="creInput" type="text" name="hour"><br>
|
<input class="creInput" type="text" name="hour"><br>
|
||||||
<p class="input">Teacher:</p><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>
|
<p class="input">Class Name:</p><br>
|
||||||
<input class="creInput" type="text" name="classname"><br>
|
<input class="creInput" type="text" name="classname"><br>
|
||||||
<p class="input">Privacy:</p><br>
|
<p class="input">Privacy:</p><br>
|
||||||
@ -98,4 +98,8 @@
|
|||||||
|
|
||||||
<template name="schoollist">
|
<template name="schoollist">
|
||||||
{{name}}
|
{{name}}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template name="teacherlist">
|
||||||
|
{{teacher}}
|
||||||
</template>
|
</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
|
//No Security
|
||||||
'createClass': function(input) {
|
'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);
|
classes.schema.validate(input);
|
||||||
if(Meteor.user() != null && classes.find({status:false, admin:Meteor.userId()}).fetch().length < 5 &&
|
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) {
|
schools.find({name:input.school}).fetch().length > 0 && input.status === false) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user