Fixed leave class, #51
This commit is contained in:
parent
7b1219716e
commit
1533f24cda
@ -93,9 +93,11 @@ Template.registerHelper('myClasses', () => {
|
|||||||
for(var i = 0; i < courses.length; i++) {
|
for(var i = 0; i < courses.length; i++) {
|
||||||
found = classes.findOne({_id:courses[i]});
|
found = classes.findOne({_id:courses[i]});
|
||||||
found.subscribers = found.subscribers.length/17;
|
found.subscribers = found.subscribers.length/17;
|
||||||
|
|
||||||
if(found.admin === Meteor.userId()) found.box = " owned";
|
|
||||||
found.mine = true;
|
found.mine = true;
|
||||||
|
if(found.admin === Meteor.userId()) {
|
||||||
|
found.box = " owned";
|
||||||
|
found.mine = false;
|
||||||
|
}
|
||||||
array.push(found);
|
array.push(found);
|
||||||
|
|
||||||
var thisWork = work.find({class: courses[i]}).fetch();
|
var thisWork = work.find({class: courses[i]}).fetch();
|
||||||
|
|||||||
@ -432,7 +432,10 @@ Template.profile.events({
|
|||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
},
|
},
|
||||||
'click .classBox' (event) {
|
'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") {
|
if (event.target.className !== "classBox") {
|
||||||
var attribute = event.target.parentNode.getAttribute("classid");
|
var attribute = event.target.parentNode.getAttribute("classid");
|
||||||
} else {
|
} else {
|
||||||
@ -508,8 +511,11 @@ Template.profile.events({
|
|||||||
},
|
},
|
||||||
'click .classBox .fa-times' (event) {
|
'click .classBox .fa-times' (event) {
|
||||||
var box = event.target.parentNode;
|
var box = event.target.parentNode;
|
||||||
|
var classid = box.getAttribute("classid");
|
||||||
Session.set("serverData", 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) {
|
'click .userBox .fa-times' (event) {
|
||||||
var box = event.target.parentNode;
|
var box = event.target.parentNode;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user