bsw@211: local areas = param.get("areas_selector", "table"):exec() bsw@212: local current_area_id = param.get("current_area_id", atom.integer) bsw@211: local head_content = param.get("head_content", "function") bsw@215: local current_phase = param.get("current_phase") bsw@211: bsw@212: if #areas == 0 then bsw@212: return bsw@212: end bsw@212: bsw@212: areas:load("membership_for_member", { member_id = app.session.member_id}, "membership") bsw@212: bsw@215: for i, area in ipairs(areas) do bsw@215: local delegation = Delegation:by_pk(app.session.member_id, area.id) bsw@215: bsw@215: local class = "area" bsw@215: if (current_area_id and area.id == current_area_id) bsw@215: or (not current_area_id and area.membership) bsw@215: then bsw@215: class = class .. " active" bsw@211: end bsw@215: ui.box_row{ bsw@215: class = class, bsw@215: content = function() bsw@215: ui.box_col{ class = "name", content = function() bsw@215: if delegation then bsw@215: execute.view{ module = "lf2", view = "_avatars", params = { bsw@215: members = { delegation.trustee }, size = "small" bsw@215: } } bsw@215: end bsw@215: ui.link{ bsw@215: module = "lf2", view = "area", id = area.id, params = { bsw@215: phase = current_phase, order = current_order bsw@215: }, bsw@215: text = area.name bsw@215: } bsw@215: end } bsw@212: end bsw@215: } bsw@215: bsw@215: end