Change to user / userId

This commit is contained in:
shaialon 2014-09-26 23:06:12 +03:00
parent 94e114cc6f
commit 6592f5761a
4 changed files with 13 additions and 9 deletions

View file

@ -15,7 +15,7 @@
<span>{{i18n "downvote"}}</span>
</a>
</div>
<div class="user-avatar"><img src="{{user_avatar}}" /></div>
<div class="user-avatar">{{>gravatar userId=userId class=""}}</div>
<div class="comment-main">
<div class="comment-meta">
<a class="comment-username" href="{{profileUrl}}">{{authorName}}</a>

View file

@ -79,10 +79,6 @@ Template[getTemplate('comment_item')].helpers({
authorName: function(){
return getAuthorName(this);
},
user_avatar: function(){
if(author=Meteor.users.findOne(this.userId))
return getAvatarUrl(author);
},
can_edit: function(){
if(this.userId && Meteor.userId())
return Meteor.user().isAdmin || (Meteor.userId() === this.userId);
@ -107,7 +103,7 @@ Template[getTemplate('comment_item')].helpers({
var user = Meteor.users.findOne(this.userId);
if(user)
return getProfileUrl(user);
}
}
});
Template[getTemplate('comment_item')].rendered=function(){
@ -122,7 +118,7 @@ Template[getTemplate('comment_item')].rendered=function(){
// // note: testing on the class works because Meteor apparently preserves newly assigned CSS classes
// // across template renderings
// // TODO: save scroll position
// // get comment author name
// var user=Meteor.users.findOne(comment.userId);
// var author=getDisplayName(user);

View file

@ -1,6 +1,14 @@
Template[getTemplate('gravatar')].helpers({
gravatarUrl: function () {
return getAvatarUrl(this.email);
if (this.user){
return getAvatarUrl(this.user);
}
else if (this.userId) {
var user=Meteor.users.findOne(this.userId);
if (user){
return getAvatarUrl(user);
}
}
},
cssClass: function(){
if (this.class){

View file

@ -3,7 +3,7 @@
<div class="user-profile grid grid-module">
<table>
<tr>
<td colspan="2">{{>gravatar email=this}}</td>
<td colspan="2">{{>gravatar user=this}}</td>
</tr>
{{#if isAdmin}}
<tr>