liquid_feedback_frontend
view app/main/lf2/_avatars.lua @ 211:4993b71b383f
First checkin of lf2 (frontend second generation) prototype
| author | bsw | 
|---|---|
| date | Wed Mar 02 20:06:26 2011 +0100 (2011-03-02) | 
| parents | |
| children | 3e4ad069847a | 
 line source
     1 local members = param.get("members", "table")
     2 local hidefirst = param.get("hidefirst", atom.boolean)
     3 local size = param.get("size") or "normal"
     5 local first_participation = true
     7 ui.container{ attr = { class = "avatars " .. size }, content = function()
     8   for i, member in ipairs(members) do
     9     local class = "arrow"
    10     if member.overridden then
    11       class = class .. " overridden"
    12     end
    13     local image
    14     local text
    15     if member.scope_in == "global" then
    16       image = "lf2/icon_delegation_global.png"
    17       text = _"Global delegation"
    18     elseif member.scope_in == "area" then
    19       image = "lf2/icon_delegation_area.png"
    20       text = _"Area delegation"
    21     elseif member.scope_in == "issue" then
    22       image = "lf2/icon_delegation.png"
    23       text = _"Issue delegation"
    24     end
    25     if param.get("arrows", atom.boolean) and (i > 1 or #members == 1) then
    26       ui.image{ attr = { title = text, alt = text, class = class }, static = image }
    27       slot.put(member.scope)
    28     end
    29     if not hidefirst or i > 1 then
    30       local class = "avatar"
    31       if first_participation and member.participation then
    32         class = class .. " participation"
    33         first_participation = false
    34       end
    35       if member.overridden then
    36         class = class .. " overridden"
    37       end
    38       ui.container{ attr = { class = class, title = member.name }, content = function()
    39         ui.avatar(member, size)
    40         --ui.image{ module = "member_image", view = "show", id = member.id, params = { image_type = "avatar" } }
    41         if size == "normal" then
    42           ui.container{ attr = { class = "name" }, content = member.name }
    43         end
    44         if size == "small" and member.weight ~= nil then
    45           ui.container{ attr = { class = "weight" }, content = member.weight }
    46         end
    47       end }
    48     end
    49   end
    50 end }
