Vulcan/client/views/users/user_item.js

30 lines
749 B
JavaScript
Raw Normal View History

2012-09-18 12:21:43 +09:00
Template.user_item.rendered = function(){
};
2012-09-18 15:43:37 +09:00
2012-10-03 16:33:28 +09:00
Template.user_item.helpers({
avatar_url: function(){
return getAvatarUrl(this);
},
created_at_formatted: function(){
return this.createdAt ? moment(this.createdAt).fromNow() : '';
},
display_name: function(){
return getDisplayName(this);
},
email: function(){
return getEmail(this);
},
posts: function(){
return Posts.find({'userId':this._id});
},
posts_count: function(){
return Posts.find({'userId':this._id}).count();
},
comments: function(){
return Comments.find({'userId':this._id});
},
comments_count: function(){
// Posts.find({'user_id':this._id}).forEach(function(post){console.log(post.headline);});
return Comments.find({'userId':this._id}).count();
2012-09-18 16:29:26 +09:00
}
2012-10-03 16:33:28 +09:00
});