Added /admin
This commit is contained in:
parent
19362dd6a6
commit
5ba92d597d
8
chromebook-checkout-meteor/client/admin.html
Normal file
8
chromebook-checkout-meteor/client/admin.html
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<template name="admin">
|
||||||
|
<div id="center">
|
||||||
|
<div id="sign-in">
|
||||||
|
<h5>Chromebook Checkout</h5>
|
||||||
|
<button id="submit">Checkout!</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@ -38,4 +38,12 @@ Template.chromebook.events({
|
|||||||
Chromebooks.update(this._id, {$set: {userid: null}});
|
Chromebooks.update(this._id, {$set: {userid: null}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
'click .cross': function() {
|
||||||
|
if (Roles.userIsInRole(Meteor.userId(), ['admin'])) {
|
||||||
|
Router.go('/admin');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
alert("Access Denied");
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
@ -1,19 +1,27 @@
|
|||||||
Router.route('/', function() {
|
Router.route('/', function() {
|
||||||
this.render("initial");
|
this.render("initial");
|
||||||
})
|
})
|
||||||
|
|
||||||
Router.route('/checkout', function() {
|
Router.route('/checkout', function() {
|
||||||
if (Meteor.user()) {
|
if (Meteor.user()) {
|
||||||
this.render("checkout");
|
this.render("checkout");
|
||||||
} else {
|
} else {
|
||||||
this.redirect('/login');
|
this.redirect('/login');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Router.route('/login', function() {
|
Router.route('/login', function() {
|
||||||
if (Meteor.user()) {
|
if (Meteor.user()) {
|
||||||
this.redirect('/checkout');
|
this.redirect('/checkout');
|
||||||
} else {
|
} else {
|
||||||
this.render("login");
|
this.render("login");
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Router.route('/admin', function() {
|
||||||
|
if (Meteor.user().roles[0]==='admin') {
|
||||||
|
this.render("admin");
|
||||||
|
} else {
|
||||||
|
this.redirect('/checkout');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user