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

View File

@ -86,6 +86,7 @@ Template.registerHelper('myClasses', () => {
} }
Session.set("noclass",false); Session.set("noclass",false);
return array; return array;
} }
}); });
@ -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,12 +312,14 @@ Template.main.events({
openDivFade(document.getElementsByClassName("overlay")[0]); openDivFade(document.getElementsByClassName("overlay")[0]);
}, },
'click .change' (event) { 'click .change' (event) {
if(!Session.get("newWork")) {
if(!(Meteor.userId() === Session.get("currentWork").creator || if(!(Meteor.userId() === Session.get("currentWork").creator ||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
classes.findOne({_id: Session.get("currentWork")._id}).moderators.indexOf(Meteor.userId()) !== -1 || classes.findOne({_id: Session.get("currentWork")._id}).moderators.indexOf(Meteor.userId()) !== -1 ||
classes.findOne({_id: Session.get("currentWork")._id}).blockEdit.indexOf(Meteor.userId()) !== -1 || classes.findOne({_id: Session.get("currentWork")._id}).blockEdit.indexOf(Meteor.userId()) !== -1 ||
classes.findOne({_id: Session.get("currentWork")._id}).banned.indexOf(Meteor.userId()) !== -1 classes.findOne({_id: Session.get("currentWork")._id}).banned.indexOf(Meteor.userId()) !== -1
)) return; )) return;
}
var ele = event.target; var ele = event.target;
var sessval = Session.get("modifying"); var sessval = Session.get("modifying");