liquid_feedback_frontend

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/lf2/_avatars.lua	Wed Mar 02 20:06:26 2011 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +local members = param.get("members", "table")
     1.5 +local hidefirst = param.get("hidefirst", atom.boolean)
     1.6 +local size = param.get("size") or "normal"
     1.7 +
     1.8 +local first_participation = true
     1.9 +
    1.10 +ui.container{ attr = { class = "avatars " .. size }, content = function()
    1.11 +  for i, member in ipairs(members) do
    1.12 +    local class = "arrow"
    1.13 +    if member.overridden then
    1.14 +      class = class .. " overridden"
    1.15 +    end
    1.16 +    local image
    1.17 +    local text
    1.18 +    if member.scope_in == "global" then
    1.19 +      image = "lf2/icon_delegation_global.png"
    1.20 +      text = _"Global delegation"
    1.21 +    elseif member.scope_in == "area" then
    1.22 +      image = "lf2/icon_delegation_area.png"
    1.23 +      text = _"Area delegation"
    1.24 +    elseif member.scope_in == "issue" then
    1.25 +      image = "lf2/icon_delegation.png"
    1.26 +      text = _"Issue delegation"
    1.27 +    end
    1.28 +    if param.get("arrows", atom.boolean) and (i > 1 or #members == 1) then
    1.29 +      ui.image{ attr = { title = text, alt = text, class = class }, static = image }
    1.30 +      slot.put(member.scope)
    1.31 +    end
    1.32 +    if not hidefirst or i > 1 then
    1.33 +      local class = "avatar"
    1.34 +      if first_participation and member.participation then
    1.35 +        class = class .. " participation"
    1.36 +        first_participation = false
    1.37 +      end
    1.38 +      if member.overridden then
    1.39 +        class = class .. " overridden"
    1.40 +      end
    1.41 +      ui.container{ attr = { class = class, title = member.name }, content = function()
    1.42 +        ui.avatar(member, size)
    1.43 +        --ui.image{ module = "member_image", view = "show", id = member.id, params = { image_type = "avatar" } }
    1.44 +        if size == "normal" then
    1.45 +          ui.container{ attr = { class = "name" }, content = member.name }
    1.46 +        end
    1.47 +        if size == "small" and member.weight ~= nil then
    1.48 +          ui.container{ attr = { class = "weight" }, content = member.weight }
    1.49 +        end
    1.50 +      end }
    1.51 +    end
    1.52 +  end
    1.53 +end }
    1.54 +

Impressum / About Us