bsw@273: local units = app.session.member.units_with_voting_right
bsw@273: local member = param.get("member", "table")
bsw@273: for i, unit in ipairs(units) do
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@280: local class = "heading"
bsw@280: if area_count > 0 then
bsw@280: class = class .. " member_area_list"
bsw@280: end
bsw@280: ui.link{
bsw@280: attr = { class = class },
bsw@280: text = unit.name,
bsw@301: module = "unit", view = "show", id = unit.id
bsw@280: }
bsw@280:
bsw@280: if area_count > 0 then
bsw@274: execute.view{
bsw@274: module = "area", view = "_list",
bsw@280: params = { areas_selector = areas_selector }
bsw@274: }
bsw@274: else
bsw@274: ui.tag{ content = _"You have voting privileges for this unit, but you are not member of any of its areas." }
bsw@274: slot.put(" ")
bsw@274: ui.link{
bsw@274: text = _"Show all areas of this unit",
bsw@308: module = "unit", view = "show", id = unit.id
bsw@274: }
bsw@274: end
bsw@274: slot.put("
")
bsw@278: slot.put("
")
bsw@274:
bsw@273: end
bsw@273: