liquid_feedback_frontend

annotate 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
rev   line source
bsw@211 1 local members = param.get("members", "table")
bsw@211 2 local hidefirst = param.get("hidefirst", atom.boolean)
bsw@211 3 local size = param.get("size") or "normal"
bsw@211 4
bsw@211 5 local first_participation = true
bsw@211 6
bsw@211 7 ui.container{ attr = { class = "avatars " .. size }, content = function()
bsw@211 8 for i, member in ipairs(members) do
bsw@211 9 local class = "arrow"
bsw@211 10 if member.overridden then
bsw@211 11 class = class .. " overridden"
bsw@211 12 end
bsw@211 13 local image
bsw@211 14 local text
bsw@211 15 if member.scope_in == "global" then
bsw@211 16 image = "lf2/icon_delegation_global.png"
bsw@211 17 text = _"Global delegation"
bsw@211 18 elseif member.scope_in == "area" then
bsw@211 19 image = "lf2/icon_delegation_area.png"
bsw@211 20 text = _"Area delegation"
bsw@211 21 elseif member.scope_in == "issue" then
bsw@211 22 image = "lf2/icon_delegation.png"
bsw@211 23 text = _"Issue delegation"
bsw@211 24 end
bsw@211 25 if param.get("arrows", atom.boolean) and (i > 1 or #members == 1) then
bsw@211 26 ui.image{ attr = { title = text, alt = text, class = class }, static = image }
bsw@211 27 slot.put(member.scope)
bsw@211 28 end
bsw@211 29 if not hidefirst or i > 1 then
bsw@211 30 local class = "avatar"
bsw@211 31 if first_participation and member.participation then
bsw@211 32 class = class .. " participation"
bsw@211 33 first_participation = false
bsw@211 34 end
bsw@211 35 if member.overridden then
bsw@211 36 class = class .. " overridden"
bsw@211 37 end
bsw@211 38 ui.container{ attr = { class = class, title = member.name }, content = function()
bsw@211 39 ui.avatar(member, size)
bsw@211 40 --ui.image{ module = "member_image", view = "show", id = member.id, params = { image_type = "avatar" } }
bsw@211 41 if size == "normal" then
bsw@211 42 ui.container{ attr = { class = "name" }, content = member.name }
bsw@211 43 end
bsw@211 44 if size == "small" and member.weight ~= nil then
bsw@211 45 ui.container{ attr = { class = "weight" }, content = member.weight }
bsw@211 46 end
bsw@211 47 end }
bsw@211 48 end
bsw@211 49 end
bsw@211 50 end }
bsw@211 51

Impressum / About Us