liquid_feedback_frontend
view app/main/lf2/_areas.lua @ 212:3e4ad069847a
Some more work at 2nd generation frontend code
| author | bsw | 
|---|---|
| date | Thu Mar 03 18:39:00 2011 +0100 (2011-03-03) | 
| parents | 4993b71b383f | 
| children | 1dab81353eb1 | 
 line source
     1 local areas = param.get("areas_selector", "table"):exec()
     2 local current_area_id = param.get("current_area_id", atom.integer)
     3 local head_content = param.get("head_content", "function")
     5 if #areas == 0 then
     6   return
     7 end
     9 areas:load("membership_for_member", { member_id = app.session.member_id}, "membership")
    11 ui.box{ class = "areas", row_count = #areas + 1, content = function()
    12   if head_content then
    13     ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = function()
    14       ui.link{ content = head_content, module = "lf2", view = "index" }
    15     end } end }
    16   end
    18   for i, area in ipairs(areas) do
    19     local delegation = Delegation:by_pk(app.session.member_id, area.id)
    21     local class = "area"
    22     if (current_area_id and area.id == current_area_id) 
    23       or (not current_area_id and area.membership)
    24     then
    25       class = class .. " active"
    26     end
    27     ui.box_row{ 
    28       class = class, 
    29       content = function()
    30         ui.box_col{ class = "name", content = function()
    31           if delegation then
    32             execute.view{ module = "lf2", view = "_avatars", params = { members = { delegation.trustee }, size = "small" } }
    33           end
    34           ui.link{ module = "lf2", view = "area", id = area.id, text = area.name }
    35         end }
    36       end
    37     }
    39   end
    41 end }
