Vulcan/client/views/users/profile/user_info.js
Sacha Greif 50fc3eb11a Merge branch 'namespace' of https://github.com/TelescopeJS/Telescope into namespace
# Conflicts:
#	lib/users.js
#	packages/telescope-base/lib/base.js
#	packages/telescope-base/package.js
#	packages/telescope-lib
2015-04-20 13:57:37 +09:00

29 lines
1,006 B
JavaScript

Template.userInfo.helpers({
canEditProfile: function() {
var currentUser = Meteor.user();
return currentUser && (this._id == currentUser._id || Users.isAdmin(currentUser));
},
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 && !Users.isInvited(this) && Telescope.utils.invitesEnabled() && Users.can.invite(Meteor.user());
},
inviteCount: function() {
return Meteor.user().inviteCount;
},
getTwitterName: function () {
return Users.getTwitterName(this);
},
getGitHubName: function () {
return Users.getGitHubName(this);
}
});
Template.userInfo.events({
'click .invite-link': function(e, instance){
Meteor.call('inviteUser', instance.data.user._id);
Messages.flash('Thanks, user has been invited.', "success");
}
});