diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-05-30 15:50:48 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-05-30 15:50:48 +0200 |
commit | f4c80d1315c181300bd37ef5de98c365325bc130 (patch) | |
tree | 811dd0a9bba9bbe49d7e4c360719e72899574783 /client/components/users/userAvatar.js | |
parent | 6db01bb3c7bbcf3e5451dd828d3d0932eb5efec3 (diff) | |
download | wekan-f4c80d1315c181300bd37ef5de98c365325bc130.tar.gz wekan-f4c80d1315c181300bd37ef5de98c365325bc130.tar.bz2 wekan-f4c80d1315c181300bd37ef5de98c365325bc130.zip |
Implement presence indicators
Diffstat (limited to 'client/components/users/userAvatar.js')
-rw-r--r-- | client/components/users/userAvatar.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/client/components/users/userAvatar.js b/client/components/users/userAvatar.js new file mode 100644 index 00000000..d7d221db --- /dev/null +++ b/client/components/users/userAvatar.js @@ -0,0 +1,22 @@ +Template.userAvatar.helpers({ + userData: function() { + if (! this.user) { + this.user = Users.findOne(this.userId); + } + return this.user; + }, + memberType: function() { + var userId = this.userId || this.user._id; + var user = Users.findOne(userId); + return user && user.isBoardAdmin() ? 'admin' : 'normal'; + }, + presenceStatusClassName: function() { + var userPresence = Presences.findOne({ userId: this.user._id }); + if (! userPresence) + return 'disconnected'; + else if (Session.equals('currentBoard', userPresence.state.currentBoardId)) + return 'active'; + else + return 'idle'; + } +}); |