-
Notifications
You must be signed in to change notification settings - Fork 405
Plugin UserList
fusion94 edited this page Feb 21, 2013
·
1 revision
This plugin displays a list of users logged into Kandan.
There's no real usage guidelines. This is a CORE plugin and shouldn't be removed.
class Kandan.Plugins.UserList
@widget_title: "People"
@widget_icon_url: "/assets/people_icon.png"
@pluginNamespace: "Kandan.Plugins.UserList"
@template: _.template '''
<div class="user clearfix">
<img class="avatar" src="http://gravatar.com/avatar/<%= gravatarHash %>?s=25&d=https://cloudfuji.com/images/profile.png"/>
<span class="name"><%= name %></span>
</div>
'''
@render: ($el)->
$users = $("<div class='user_list'></div>")
$el.next().hide();
for user in Kandan.Data.ActiveUsers.all()
displayName = null
displayName = user.username # Defaults to username
displayName ||= user.email # Revert to user email address if that's all we have
$users.append @template({
name: displayName,
gravatarHash: user.gravatar_hash
})
$el.html($users)
@init: ()->
Kandan.Widgets.register @pluginNamespace
Kandan.Data.ActiveUsers.registerCallback "change", ()=>
Kandan.Widgets.render @pluginNamespace
Copyright © 2012-2013 - KandanApp