48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
ReactiveTabs.createInterface({
|
|
template: 'teacherTabs',
|
|
onChange: function (slug, template) {
|
|
// This callback runs every time a tab changes.
|
|
// The `template` instance is unique per {{#basicTabs}} block.
|
|
console.log('[tabs] Tab has changed! Current tab:', slug);
|
|
console.log('[tabs] Template instance calling onChange:', template);
|
|
}
|
|
});
|
|
|
|
Template.teacher.helpers({
|
|
tabs: function () {
|
|
// Every tab object MUST have a name and a slug!
|
|
return [
|
|
{ name: 'Single', slug: 'single' },
|
|
{ name: 'Carts', slug: 'carts' }
|
|
];
|
|
}
|
|
});
|
|
|
|
Template.teacher.helpers({
|
|
chromebooks: function() {
|
|
return Chromebooks.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");
|
|
}
|
|
}
|
|
}); |