Fixed the helper errors that appeared, fixed #3

This commit is contained in:
Kenneth Jao 2016-08-17 23:39:51 -04:00
parent 09e29aea96
commit 6fc1ec14c9
3 changed files with 31 additions and 13 deletions

View File

@ -4,11 +4,6 @@ import {
import './main.html';
Meteor.subscribe('schools');
Meteor.subscribe('classes');
Meteor.subscribe('work');
Meteor.subscribe('users');
var openValues = {
"menu": "-25%",
"options": "-20%"
@ -178,9 +173,11 @@ Template.main.helpers({
return "width:"+w.toString()+"px;height:"+h.toString()+"px;margin-left:"+-0.5*w.toString()+"px;margin-top:"+-0.5*h.toString()+"px";
},
work(value) {
if(Session.get("currentWork") === null) return;
return Session.get("currentReadableWork")[value];
},
workType() {
if(Session.get("currentWork") === null) return;
type = Session.get("currentWork").type;
if(type.includes("edit")) {
return;

View File

@ -195,6 +195,7 @@ Template.profile.helpers({
return Session.get("confirmText");
},
selectedClass(val) {
if(Session.get("selectedClass") === null) return;
var usertype = ["moderators","banned"];
var attribute = Session.get("selectClassId");
var array = classes.findOne({_id:attribute});

View File

@ -1,7 +1,17 @@
Router.route('/', function() {
if (!Meteor.userId()) {
this.redirect('/login');
} else {
Router.route('/', {
waitOn: function() {
if (!Meteor.userId()) {
this.redirect('/login');
} else {
return [
Meteor.subscribe('classes',this.params._id),
Meteor.subscribe('schools',this.params._id),
Meteor.subscribe('work',this.params._id),
Meteor.subscribe('users',this.params._id)
];
}
},
action: function() {
this.render("main");
}
});
@ -16,10 +26,20 @@ Router.route('/login', function() {
}
});
Router.route('/profile', function() {
if (!Meteor.userId()) {
this.redirect("/login");
} else {
Router.route('/profile', {
waitOn: function() {
if (!Meteor.userId()) {
this.redirect('/login');
} else {
return [
Meteor.subscribe('classes',this.params._id),
Meteor.subscribe('schools',this.params._id),
Meteor.subscribe('work',this.params._id),
Meteor.subscribe('users',this.params._id)
];
}
},
action: function() {
this.render("profile");
}
});