fix
Merge branch 'master' of https://github.com/yamanq/chromebook-checkout-meteor
This commit is contained in:
commit
ecda6ae794
@ -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');
|
||||||
|
|||||||
@ -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');
|
||||||
}*/
|
}
|
||||||
});
|
});
|
||||||
@ -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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Loading…
x
Reference in New Issue
Block a user