2012-09-18 12:21:43 +09:00
|
|
|
|
Template.user_item.rendered = function(){
|
|
|
|
|
};
|
2012-09-18 15:43:37 +09:00
|
|
|
|
|
|
|
|
|
Template.user_item.avatar_url = function(){
|
|
|
|
|
return Gravatar.getGravatar(this, {
|
2012-09-28 10:09:29 +09:00
|
|
|
|
d: 'http://telesc.pe/img/default_avatar.png',
|
2012-09-18 15:43:37 +09:00
|
|
|
|
s: 30
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Template.user_item.created_at_formatted = function(){
|
2012-09-25 11:05:49 +09:00
|
|
|
|
return this.createdAt ? moment(this.createdAt).fromNow() : '–';
|
2012-09-18 16:23:33 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Template.user_item.email = function(){
|
2012-09-18 16:29:26 +09:00
|
|
|
|
if(this.emails){
|
2012-09-24 12:12:14 +09:00
|
|
|
|
return this.emails[0].address;
|
2012-09-18 16:29:26 +09:00
|
|
|
|
}
|
2012-09-18 16:23:33 +09:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 16:38:40 +09:00
|
|
|
|
Template.user_item.posts = function(){
|
2012-10-01 16:08:30 +09:00
|
|
|
|
return Posts.find({'userId':this._id});
|
2012-09-18 16:38:40 +09:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 16:23:33 +09:00
|
|
|
|
Template.user_item.posts_count = function(){
|
2012-10-01 16:08:30 +09:00
|
|
|
|
return Posts.find({'userId':this._id}).count();
|
2012-09-18 16:23:33 +09:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 16:38:40 +09:00
|
|
|
|
Template.user_item.comments = function(){
|
2012-10-01 16:08:30 +09:00
|
|
|
|
return Comments.find({'userId':this._id});
|
2012-09-18 16:38:40 +09:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 16:23:33 +09:00
|
|
|
|
Template.user_item.comments_count = function(){
|
|
|
|
|
// Posts.find({'user_id':this._id}).forEach(function(post){console.log(post.headline);});
|
2012-10-01 16:08:30 +09:00
|
|
|
|
return Comments.find({'userId':this._id}).count();
|
2012-09-19 10:15:03 +09:00
|
|
|
|
}
|