This commit is contained in:
Yaman Qalieh 2016-08-12 17:14:32 -04:00
commit 8a34c1ab09

View File

@ -122,20 +122,14 @@ Template.profile.helpers({
} }
}, },
classes() { classes() {
return classes.find({ return classes.find(
status: { {
$eq: true status: {$eq: true},
}, privacy: {$eq: false}
privacy: { },
$eq: false {sort: {subscribers: -1 }},
} {limit: 20}
}, { ).fetch();
sort: {
subscribers: -1
}
}, {
limit: 20
}).fetch();
}, },
profClassHeight() { profClassHeight() {
return 0.6 * window.innerHeight.toString() + "px"; return 0.6 * window.innerHeight.toString() + "px";
@ -163,13 +157,18 @@ Template.profile.helpers({
autocompleteClasses() { autocompleteClasses() {
return Session.get("autocompleteDivs"); return Session.get("autocompleteDivs");
}, },
/*myclasses() { myclasses() {
if (Meteor.user().profile.classes === undefined || Meteor.user().profile.classes.length === 0) { if (Meteor.user().profile.classes === undefined || Meteor.user().profile.classes.length === 0) {
return []; return [];
} else { } else {
return Meteor.user().profile.classes; var array = [];
var courses = Meteor.user().profile.classes;
for(var i = 0; i < courses.length; i++) {
array.push(classes.findOne({_id:courses[i]}));
}
return array;
} }
},*/ },
notfound() { notfound() {
return Session.get("notfound"); return Session.get("notfound");
}, },
@ -315,21 +314,21 @@ Template.profile.events({
openDivFade(functionHolder);         openDivFade(functionHolder);        
}, 300);     }, 300);    
}, },
    'click .manageClass' () {             'click .manageClass' () {        
var functionHolder = document.getElementById("profClassInfoHolder"); var functionHolder = document.getElementById("profClassInfoHolder");
closeDivFade(functionHolder);         closeDivFade(functionHolder);        
setTimeout(function() {             setTimeout(function() {            
Session.set("profClassTab", "manClass");             Session.set("profClassTab", "manClass");            
openDivFade(functionHolder);         openDivFade(functionHolder);        
}, 300);     }, 300);    
}, },
    'click .createClass' () {             'click .createClass' () {        
var functionHolder = document.getElementById("profClassInfoHolder");         var functionHolder = document.getElementById("profClassInfoHolder");        
closeDivFade(functionHolder);         closeDivFade(functionHolder);        
setTimeout(function() {             setTimeout(function() {            
Session.set("profClassTab", "creClass");             Session.set("profClassTab", "creClass");            
openDivFade(functionHolder);         openDivFade(functionHolder);        
}, 300);     }, 300);    
}, },
'click .fa-search' () { 'click .fa-search' () {
Session.set("searching", true); Session.set("searching", true);
@ -366,7 +365,7 @@ Template.profile.events({
} catch (err) {} } catch (err) {}
}, },
'click .classBox' (event) { 'click .classBox' (event) {
if (event.target.id === "label") return; if (event.target.id === "label" || Session.get("profClassTab") === "manClass") 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 {