Merge branch 'master' of https://github.com/yamanq/chromebook-checkout-meteor
This commit is contained in:
Kenneth Jao 2015-01-12 21:56:33 -05:00
commit ecda6ae794
3 changed files with 6 additions and 48 deletions

View File

@ -6,25 +6,6 @@ Template.checkout.helpers({
Template.checkout.events({ Template.checkout.events({
'click .cross' : function() {
if (Roles.userIsInRole(Meteor.userId(), ['admin'])) {
if (this.status === 0) {
Chromebooks.update(this._id, {$set: {status: 2}});
Chromebooks.update(this._id, {$set: {user: null}});
}
else if (this.status ===1) {
Chromebooks.update(this._id, {$set: {status: 2}});
}
else {
Chromebooks.update(this._id, {$set: {status: 0}});
Chromebooks.update(this._id, {$set: {last_checkout: null}});
Chromebooks.update(this._id, {$set: {userid: null}});
}
}
else {
alert("Access Denied");
}
},
'click .edit': function() { 'click .edit': function() {
if (Roles.userIsInRole(Meteor.userId(), ['admin'])) { if (Roles.userIsInRole(Meteor.userId(), ['admin'])) {
Router.go('/admin'); Router.go('/admin');

View File

@ -19,17 +19,17 @@ Router.route('/login', function() {
}); });
Router.route('/admin', function() { Router.route('/admin', function() {
// if (Roles.userIsInRole(Meteor.userId(), ['admin'])) { if (Roles.userIsInRole(Meteor.userId(), ['admin'])) {
this.render("admin"); this.render("admin");
/* } else { } else {
this.redirect('/login'); this.redirect('/login');
}*/ }
}); });
Router.route('/teacher', function() { Router.route('/teacher', function() {
// if (Roles.userIsInRole(Meteor.userId(), ['admin', 'teacher'])) { if (Roles.userIsInRole(Meteor.userId(), ['admin', 'teacher'])) {
this.render("teacher"); this.render("teacher");
/* } else { } else {
this.redirect('/login'); this.redirect('/login');
}*/ }
}); });

View File

@ -22,26 +22,3 @@ Template.teacher.helpers({
return carts.find(); return carts.find();
} }
}); });
Template.teacher.events({
'click .cross' : function() {
if (Roles.userIsInRole(Meteor.userId(), ['admin'])) {
if (this.status === 0) {
Chromebooks.update(this._id, {$set: {status: 2}});
Chromebooks.update(this._id, {$set: {user: null}});
}
else if (this.status ===1) {
Chromebooks.update(this._id, {$set: {status: 2}});
}
else {
Chromebooks.update(this._id, {$set: {status: 0}});
Chromebooks.update(this._id, {$set: {last_checkout: null}});
Chromebooks.update(this._id, {$set: {userid: null}});
}
}
else {
alert("Access Denied");
}
}
});