Vulcan/client/templates/user_item.js
Matt DeBergalis e07daec6f3 Use currentUser builtin to simplify templates.
* {{currentUser.isAdmin}} instead of custom helpers.
* drop currentUserIsAdmin session variable.

relies on fix to meteor's handlebars evaluator in 0.4.2.
2012-09-27 23:33:08 -07:00

36 lines
878 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Template.user_item.rendered = function(){
};
Template.user_item.avatar_url = function(){
return Gravatar.getGravatar(this, {
d: 'http://telesc.pe/img/default_avatar.png',
s: 30
});
};
Template.user_item.created_at_formatted = function(){
return this.createdAt ? moment(this.createdAt).fromNow() : '';
}
Template.user_item.email = function(){
if(this.emails){
return this.emails[0].address;
}
}
Template.user_item.posts = function(){
return Posts.find({'user_id':this._id});
}
Template.user_item.posts_count = function(){
return Posts.find({'user_id':this._id}).count();
}
Template.user_item.comments = function(){
return Comments.find({'user_id':this._id});
}
Template.user_item.comments_count = function(){
// Posts.find({'user_id':this._id}).forEach(function(post){console.log(post.headline);});
return Comments.find({'user_id':this._id}).count();
}