Vulcan/client/views/users/profile/user_info.js

30 lines
992 B
JavaScript
Raw Normal View History

2014-12-08 14:53:26 +09:00
Template[getTemplate('userInfo')].helpers({
canEditProfile: function() {
var currentUser = Meteor.user();
return currentUser && (this._id == currentUser._id || 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 && !isInvited(this) && invitesEnabled() && can.invite(Meteor.user());
2014-12-08 14:53:26 +09:00
},
inviteCount: function() {
return Meteor.user().inviteCount;
},
getTwitterName: function () {
return getTwitterName(this);
},
getGitHubName: function () {
return getGitHubName(this);
}
});
Template[getTemplate('userInfo')].events({
'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
}
});