     @createSettingsView()
 
 
+  getUserRole: ->
+
+    currentRole = defaultRoles.member
+    userRoles   = @getData().roles
+
+    # find the most prioritized role
+    for userRole in userRoles when role = defaultRoles[userRole]
+      if role.priority > currentRole.priority
+        currentRole = role
+
+    return currentRole.nicename
+
+
   createSettingsView: ->
+
+    userRoles = @getData().roles
 
     @settings  = new KDCustomHTMLView
       cssClass : 'settings hidden'

KDListItemView         = kd.ListItemView
KDCustomHTMLView       = kd.CustomHTMLView
getFullnameFromAccount = require 'app/util/getFullnameFromAccount'


module.exports = class MemberItemView extends KDListItemView


    @roleLabel = new KDCustomHTMLView
      cssClass : 'role'
      partial  : "#{@getUserRole()} <span class='settings-icon'></span>"
      click    : =>
        @settings.toggleClass  'hidden'
        @roleLabel.toggleClass 'active'
