2015-05-07 18:54:46 +09:00
|
|
|
Template.user_info.helpers({
|
2014-12-08 14:53:26 +09:00
|
|
|
canEditProfile: function() {
|
|
|
|
var currentUser = Meteor.user();
|
2015-05-01 18:22:00 +02:00
|
|
|
return currentUser && (this._id === currentUser._id || Users.is.admin(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-05-01 18:22:00 +02:00
|
|
|
return Meteor.user() && Meteor.user()._id !== this._id && !Users.is.invited(this) && Telescope.utils.invitesEnabled() && Users.can.invite(Meteor.user());
|
2014-12-08 14:53:26 +09:00
|
|
|
},
|
|
|
|
inviteCount: function() {
|
2015-04-28 15:54:19 +09:00
|
|
|
return Meteor.user().telescope.inviteCount;
|
2014-12-08 14:53:26 +09:00
|
|
|
},
|
|
|
|
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-05-07 18:54:46 +09:00
|
|
|
Template.user_info.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
|
|
|
}
|
|
|
|
});
|