fix tabbing

This commit is contained in:
yamanq 2016-08-08 20:55:02 -04:00
parent e51d35eba9
commit cf7a586cf2

View File

@ -6,37 +6,39 @@ _uuid4 = function(cc) {
return (cc === 'x' ? rr : (rr & 0x3 | 0x8)).toString(16); return (cc === 'x' ? rr : (rr & 0x3 | 0x8)).toString(16);
} }
Meteor.methods({ Meteor.methods({
'genCode': function() { 'genCode': function() {
return 'xxxxxx'.replace(/[x]/g, _uuid4); return 'xxxxxx'.replace(/[x]/g, _uuid4);
}, },
'createClass': function(input) { //NOT COMPLETE V
if(Meteor.user() != null && Meteor.classes.find({status:true, admin:Meteor.userId()}).length < 5){ 'createClass': function(input) {
classes.schema.validate(input); if(Meteor.user() != null && Meteor.classes.find({status:true, admin:Meteor.userId()}).length < 5 &&
classes.insert(input); schools.find({name:input.school}).fetch().length > 0){
} classes.schema.validate(input);
}, classes.insert(input);
'editProfile': function(change) { }
current = Meteor.user().profile; },
current.school = change[0]; 'editProfile': function(change) {
current.grade = change[1]; current = Meteor.user().profile;
if (schools.find({name:current.school}).fetch().length > 0 && Number.isInteger(current.grade) && current.school = change[0];
current.grade >= 9 && current.grade <= 12) { current.grade = change[1];
Meteor.users.update({_id: Meteor.userId()}, {$set: {profile: current}}); if (schools.find({name:current.school}).fetch().length > 0 && Number.isInteger(current.grade) &&
return 1; current.grade >= 9 && current.grade <= 12) {
} else { Meteor.users.update({_id: Meteor.userId()}, {$set: {profile: current}});
return 0; return 1;
} } else {
}, return 0;
'joinClass': function(change, pass) {
found = classes.find({name: change}).fetch();
if (Meteor.user() != null && found.length > 0 && pass === found[0].code) {
current = Meteor.user().profile;
current.classes.append(change);
Meteor.users.update({_id: Meteor.userId()}, {$set: {profile: current}});
return 1;
} else {
return 0;
}
} }
}); },
'joinClass': function(change, pass) {
found = classes.find({name: change}).fetch();
if (Meteor.user() != null && found.length > 0 && pass === found[0].code) {
current = Meteor.user().profile;
current.classes.append(change);
Meteor.users.update({_id: Meteor.userId()}, {$set: {profile: current}});
return 1;
} else {
return 0;
}
}
});