Fixed leave class, #51

This commit is contained in:
Kenneth Jao 2016-08-23 22:09:07 -04:00
parent 7b1219716e
commit 1533f24cda
2 changed files with 12 additions and 4 deletions

View File

@ -93,9 +93,11 @@ Template.registerHelper('myClasses', () => {
for(var i = 0; i < courses.length; i++) {
found = classes.findOne({_id:courses[i]});
found.subscribers = found.subscribers.length/17;
if(found.admin === Meteor.userId()) found.box = " owned";
found.mine = true;
if(found.admin === Meteor.userId()) {
found.box = " owned";
found.mine = false;
}
array.push(found);
var thisWork = work.find({class: courses[i]}).fetch();

View File

@ -432,7 +432,10 @@ Template.profile.events({
} catch (err) {}
},
'click .classBox' (event) {
if (event.target.id === "label" || Session.get("profClassTab") === "manClass") return;
if (event.target.id === "label" ||
Session.get("profClassTab") === "manClass" ||
event.target.className.includes("fa-times")) return;
if (event.target.className !== "classBox") {
var attribute = event.target.parentNode.getAttribute("classid");
} else {
@ -508,8 +511,11 @@ Template.profile.events({
},
'click .classBox .fa-times' (event) {
var box = event.target.parentNode;
var classid = box.getAttribute("classid");
Session.set("serverData", box.getAttribute("classid"));
sendData("leaveClass");
Session.set("confirm","leaveClass");
Session.set("confirmText", "Leave this class?");
openDivFade(document.getElementsByClassName("overlay")[0]);
},
'click .userBox .fa-times' (event) {
var box = event.target.parentNode;