This commit is contained in:
Yaman Qalieh 2016-08-18 19:05:50 -04:00
commit 5c3025363f

View File

@ -85,13 +85,14 @@ Template.registerHelper('myClasses', () => {
array[i].thisClassWork = thisWork; array[i].thisClassWork = thisWork;
} }
Session.set("noclass",false); Session.set("noclass",false);
return array; return array;
} }
}); });
Template.main.helpers({ Template.main.helpers({
schoolName() { schoolName() {
Session.set("calendarclasses", Meteor.user().profile.classes); Session.set("calendarclasses", Meteor.user().profile.classes);
return " - " + Meteor.user().profile.school; return " - " + Meteor.user().profile.school;
}, },
iconColor(icon) { iconColor(icon) {
@ -143,7 +144,7 @@ Template.main.helpers({
calendarOptions() { calendarOptions() {
var events = []; var events = [];
calendarclasses = Session.get("calendarclasses"); calendarclasses = Session.get("calendarclasses");
var cursor = work.find({class: {$in: userclasses}}); var cursor = work.find({class: {$in: calendarclasses}});
cursor.forEach(function(current) { cursor.forEach(function(current) {
backgroundColor = calendarColors[current.type]; backgroundColor = calendarColors[current.type];
title = current.name; title = current.name;
@ -311,14 +312,16 @@ Template.main.events({
openDivFade(document.getElementsByClassName("overlay")[0]); openDivFade(document.getElementsByClassName("overlay")[0]);
}, },
'click .change' (event) { 'click .change' (event) {
if(!(Meteor.userId() === Session.get("currentWork").creator || if(!Session.get("newWork")) {
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || if(!(Meteor.userId() === Session.get("currentWork").creator ||
classes.findOne({_id: Session.get("currentWork")._id}).moderators.indexOf(Meteor.userId()) !== -1 || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
classes.findOne({_id: Session.get("currentWork")._id}).blockEdit.indexOf(Meteor.userId()) !== -1 || classes.findOne({_id: Session.get("currentWork")._id}).moderators.indexOf(Meteor.userId()) !== -1 ||
classes.findOne({_id: Session.get("currentWork")._id}).banned.indexOf(Meteor.userId()) !== -1 classes.findOne({_id: Session.get("currentWork")._id}).blockEdit.indexOf(Meteor.userId()) !== -1 ||
)) return; classes.findOne({_id: Session.get("currentWork")._id}).banned.indexOf(Meteor.userId()) !== -1
)) return;
}
var ele = event.target; var ele = event.target;
var sessval = Session.get("modifying"); var sessval = Session.get("modifying");
if (ele.id !== sessval && sessval !== null) closeInput(sessval); if (ele.id !== sessval && sessval !== null) closeInput(sessval);