35 lines
670 B
JavaScript
Raw Normal View History

2014-12-23 21:09:30 -05:00
var statusmap = {
0: "available",
1: "checkedout",
2: "unavailable"
}
2014-12-25 17:42:54 -05:00
Meteor.subscribe('chromebook');
2014-12-23 21:09:30 -05:00
Template.chromebook.helpers({
status_class: function() {
return statusmap[this.status];
},
time_ago: function() {
if (this.last_checkout === null) {
return "";
} else {
return moment(this.last_checkout).fromNow();
}
},
2015-02-09 20:00:56 -05:00
page: function() {
return Router.current().route.path().replace("/", "");
2014-12-23 21:09:30 -05:00
}
});
Template.chromebook.events({
2015-01-12 21:05:09 -05:00
2014-12-23 21:09:30 -05:00
'click .available': function() {
2015-02-07 11:27:10 -05:00
Meteor.call('availablechromebook', this);
2014-12-23 21:09:30 -05:00
},
'click .checkedout': function() {
2015-02-07 11:27:10 -05:00
Meteor.call('checkedoutchromebook', this);
2015-01-01 02:20:24 -05:00
}
});