bsw@395: local member = param.get("member", "table") bsw@394: local units = member.units_with_voting_right bsw@395: bsw@273: for i, unit in ipairs(units) do bsw@375: local trustee_member = Member:new_selector() bsw@375: :join("delegation", nil, { "delegation.unit_id = ? AND delegation.truster_id = ?", unit.id, member.id }) bsw@375: :optional_object_mode() bsw@375: :exec() bsw@375: bsw@273: local areas_selector = Area:new_selector() bsw@273: :join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id }) bsw@273: :add_where{ "area.unit_id = ?", unit.id } bsw@273: :add_order_by("area.member_weight DESC") bsw@273: bsw@280: local area_count = areas_selector:count() bsw@375: bsw@375: ui.container{ attr = { class = "member_area_list" }, content = function() bsw@375: ui.container{ attr = { class = "unit_head" }, content = function() bsw@375: ui.link{ bsw@375: text = unit.name, bsw@375: module = "unit", view = "show", id = unit.id bsw@375: } bsw@280: bsw@375: if trustee_member then bsw@375: local text = _("Unit delegated to '#{name}'", { name = trustee_member.name }) bsw@375: ui.image{ bsw@375: attr = { class = "delegation_arrow", alt = text, title = text }, bsw@375: static = "delegation_arrow_24_horizontal.png" bsw@375: } bsw@375: execute.view{ bsw@375: module = "member_image", bsw@375: view = "_show", bsw@375: params = { bsw@375: member = trustee_member, bsw@375: image_type = "avatar", bsw@375: show_dummy = true, bsw@375: class = "micro_avatar", bsw@375: popup_text = text bsw@375: } bsw@375: } bsw@375: end bsw@375: end } bsw@375: bsw@375: if area_count > 0 then bsw@375: execute.view{ bsw@375: module = "area", view = "_list", bsw@375: params = { areas_selector = areas_selector, hide_membership = true } bsw@375: } bsw@375: else bsw@383: ui.container{ attr = { class = "voting_priv_info" }, content = _"You have voting privileges for this unit, but you are not member of any of its areas." } bsw@375: end bsw@375: end } bsw@274: bsw@273: end bsw@273: