Added /admin

This commit is contained in:
Yaman 2015-01-01 02:20:24 -05:00
parent 19362dd6a6
commit 5ba92d597d
3 changed files with 35 additions and 11 deletions

View 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>

View File

@ -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");
}
}
}); });

View File

@ -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');
}
}); });