Vulcan/client/views/posts/modules/post_upvote.js

20 lines
525 B
JavaScript
Raw Normal View History

2014-07-05 12:30:56 +09:00
Template[getTemplate('postUpvote')].helpers({
oneBasedRank: function(){
if(typeof this.rank !== 'undefined')
return this.rank + 1;
}
2014-07-07 11:49:21 +09:00
});
Template[getTemplate('postUpvote')].events({
'click .upvote-link': function(e, instance){
var post = this;
e.preventDefault();
if(!Meteor.user()){
Router.go('/signin');
throwError(i18n.t("Please log in first"));
}
Meteor.call('upvotePost', post, function(error, result){
trackEvent("post upvoted", {'_id': post._id});
});
}
2014-07-05 12:30:56 +09:00
});