|
@@ -8,11 +8,20 @@ Template.postItem.helpers({
|
|
|
var a = document.createElement('a');
|
|
|
a.href = this.url;
|
|
|
return a.hostname;
|
|
|
+ },
|
|
|
+
|
|
|
+ upvotedClass: function () {
|
|
|
+ var userId = Meteor.userId();
|
|
|
+ if (userId && !_.include(this.upvoters, userId)) {
|
|
|
+ return "btn-primary upvotable";
|
|
|
+ } else {
|
|
|
+ return "disabled";
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
|
Template.postItem.events({
|
|
|
- 'click .upvote': function (e) {
|
|
|
+ 'click .upvotable': function (e) {
|
|
|
e.preventDefault();
|
|
|
Meteor.call('upvote', this._id);
|
|
|
}
|