Vulcan/client/templates/post.js

23 lines
525 B
JavaScript
Raw Normal View History

2012-08-23 00:15:48 -04:00
Template.post.events = {
2012-08-30 21:35:48 -04:00
'click .discuss-link': function(){
Session.set('selected_post', this);
Session.set('state', 'view_post');
}
, 'click .upvote-link': function(){
Meteor.call('voteForPost', this);
2012-08-23 00:15:48 -04:00
}
};
2012-08-22 23:40:09 -04:00
Template.post.ago = function(){
var submitted = new Date(this.submitted);
return submitted.toString();
};
2012-08-30 21:35:48 -04:00
Template.post.voted = function(){
var user = Meteor.user();
if(!user) return false;
var myvote = MyVotes.findOne({post: this._id, user: user._id});
return !!myvote;
};