2015-04-13 14:52:03 +09:00
|
|
|
Template.userInfo.helpers({
|
2014-12-08 14:53:26 +09:00
|
|
|
canEditProfile: function() {
|
|
|
|
var currentUser = Meteor.user();
|
2015-04-20 13:57:37 +09:00
|
|
|
return currentUser && (this._id == currentUser._id || Users.isAdmin(currentUser));
|
2014-12-08 14:53:26 +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
|
2015-04-20 13:57:37 +09:00
|
|
|
return Meteor.user() && Meteor.user()._id != this._id && !Users.isInvited(this) && Telescope.utils.invitesEnabled() && Users.can.invite(Meteor.user());
|
2014-12-08 14:53:26 +09:00
|
|
|
},
|
|
|
|
inviteCount: function() {
|
|
|
|
return Meteor.user().inviteCount;
|
|
|
|
},
|
|
|
|
getTwitterName: function () {
|
2015-04-20 13:57:37 +09:00
|
|
|
return Users.getTwitterName(this);
|
2014-12-08 14:53:26 +09:00
|
|
|
},
|
|
|
|
getGitHubName: function () {
|
2015-04-20 13:57:37 +09:00
|
|
|
return Users.getGitHubName(this);
|
2014-12-08 14:53:26 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-04-13 14:52:03 +09:00
|
|
|
Template.userInfo.events({
|
2014-12-08 14:53:26 +09:00
|
|
|
'click .invite-link': function(e, instance){
|
|
|
|
Meteor.call('inviteUser', instance.data.user._id);
|
2015-03-27 16:24:21 +08:00
|
|
|
Messages.flash('Thanks, user has been invited.', "success");
|
2014-12-08 14:53:26 +09:00
|
|
|
}
|
|
|
|
});
|