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}});
|
||||
}
|
||||
}
|
||||
'click .cross': function() {
|
||||
if (Roles.userIsInRole(Meteor.userId(), ['admin'])) {
|
||||
Router.go('/admin');
|
||||
}
|
||||
else {
|
||||
alert("Access Denied");
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -1,19 +1,27 @@
|
||||
Router.route('/', function() {
|
||||
this.render("initial");
|
||||
this.render("initial");
|
||||
})
|
||||
|
||||
Router.route('/checkout', function() {
|
||||
if (Meteor.user()) {
|
||||
this.render("checkout");
|
||||
} else {
|
||||
this.redirect('/login');
|
||||
}
|
||||
if (Meteor.user()) {
|
||||
this.render("checkout");
|
||||
} else {
|
||||
this.redirect('/login');
|
||||
}
|
||||
});
|
||||
|
||||
Router.route('/login', function() {
|
||||
if (Meteor.user()) {
|
||||
this.redirect('/checkout');
|
||||
} else {
|
||||
this.render("login");
|
||||
}
|
||||
if (Meteor.user()) {
|
||||
this.redirect('/checkout');
|
||||
} else {
|
||||
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