mirror of
https://github.com/vale981/Vulcan
synced 2025-03-09 20:16:39 -04:00
43 lines
No EOL
1.2 KiB
JavaScript
43 lines
No EOL
1.2 KiB
JavaScript
Template[getTemplate('postContent')].helpers({
|
|
postHeading: function () {
|
|
return postHeading;
|
|
},
|
|
postMeta: function () {
|
|
return postMeta;
|
|
},
|
|
getTemplate: function () {
|
|
return getTemplate(this.template);
|
|
},
|
|
sourceLink: function(){
|
|
return !!this.url ? this.url : "/posts/"+this._id;
|
|
},
|
|
current_domain: function(){
|
|
return "http://"+document.domain;
|
|
},
|
|
timestamp: function(){
|
|
time = this.status == STATUS_APPROVED ? this.postedAt : this.createdAt;
|
|
return moment(time).format("MMMM Do, h:mm:ss a");
|
|
},
|
|
userAvatar: function(){
|
|
var author = Meteor.users.findOne(this.userId, {reactive: false});
|
|
if(!!author)
|
|
return getAvatarUrl(author);
|
|
},
|
|
inactiveClass: function(){
|
|
return (isAdmin(Meteor.user()) && this.inactive) ? i18n.t('inactive') : "";
|
|
},
|
|
commentsDisplayText: function(){
|
|
return this.comments == 1 ? i18n.t('comment') : i18n.t('comments');
|
|
}
|
|
});
|
|
|
|
Template[getTemplate('postContent')].events({
|
|
'click .approve-link': function(e, instance){
|
|
Meteor.call('approvePost', this);
|
|
e.preventDefault();
|
|
},
|
|
'click .unapprove-link': function(e, instance){
|
|
Meteor.call('unapprovePost', this);
|
|
e.preventDefault();
|
|
}
|
|
}); |