2013-10-09 20:50:26 +09:00
|
|
|
Template.user_profile.helpers({
|
|
|
|
avatarUrl: function() {
|
|
|
|
return getAvatarUrl(this);
|
|
|
|
},
|
|
|
|
canEditProfile: function() {
|
|
|
|
var currentUser = Meteor.user();
|
|
|
|
return currentUser && (this._id == currentUser._id || isAdmin(currentUser))
|
2013-10-23 19:43:42 +09:00
|
|
|
},
|
|
|
|
createdAtFormatted: function() {
|
|
|
|
return this.createdAt;
|
|
|
|
},
|
|
|
|
canInvite: function() {
|
|
|
|
// if the user is logged in, the target user hasn't been invited yet, invites are enabled, and user is not viewing their own profile
|
|
|
|
return Meteor.user() && Meteor.user()._id != this._id && !isInvited(this) && invitesEnabled() && canInvite(Meteor.user());
|
|
|
|
},
|
|
|
|
invitesCount: function() {
|
|
|
|
return Meteor.user().invitesCount;
|
2013-11-07 09:57:57 +09:00
|
|
|
},
|
|
|
|
getTwitter: function () {
|
|
|
|
return getTwitterName(this);
|
|
|
|
},
|
|
|
|
getGitHub: function () {
|
|
|
|
return getGitHubName(this);
|
2013-10-09 20:50:26 +09:00
|
|
|
}
|
2013-10-26 10:37:32 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
Template.user_profile.events({
|
|
|
|
'click .invite-link': function(e, instance){
|
|
|
|
Meteor.call('inviteUser', instance.data.user._id);
|
|
|
|
}
|
2013-10-09 20:50:26 +09:00
|
|
|
});
|