liquid_feedback_frontend

annotate app/main/member/_area_list.lua @ 418:54a7daa4d35c

Added missing boxes
author bsw
date Sat Mar 10 17:51:00 2012 +0100 (2012-03-10)
parents 2570b9fff7e0
children a31fce559540
rev   line source
bsw@395 1 local member = param.get("member", "table")
bsw@394 2 local units = member.units_with_voting_right
bsw@395 3
bsw@273 4 for i, unit in ipairs(units) do
bsw@375 5 local trustee_member = Member:new_selector()
bsw@417 6 :join("delegation", nil, { "delegation.scope = 'unit' AND delegation.unit_id = ? AND delegation.trustee_id = member.id AND delegation.truster_id = ?", unit.id, member.id })
bsw@375 7 :optional_object_mode()
bsw@375 8 :exec()
bsw@375 9
bsw@273 10 local areas_selector = Area:new_selector()
bsw@273 11 :join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id })
bsw@273 12 :add_where{ "area.unit_id = ?", unit.id }
bsw@273 13 :add_order_by("area.member_weight DESC")
bsw@273 14
bsw@280 15 local area_count = areas_selector:count()
bsw@375 16
bsw@375 17 ui.container{ attr = { class = "member_area_list" }, content = function()
bsw@375 18 ui.container{ attr = { class = "unit_head" }, content = function()
bsw@375 19 ui.link{
bsw@375 20 text = unit.name,
bsw@375 21 module = "unit", view = "show", id = unit.id
bsw@375 22 }
bsw@280 23
bsw@375 24 if trustee_member then
bsw@375 25 local text = _("Unit delegated to '#{name}'", { name = trustee_member.name })
bsw@375 26 ui.image{
bsw@375 27 attr = { class = "delegation_arrow", alt = text, title = text },
bsw@375 28 static = "delegation_arrow_24_horizontal.png"
bsw@375 29 }
bsw@375 30 execute.view{
bsw@375 31 module = "member_image",
bsw@375 32 view = "_show",
bsw@375 33 params = {
bsw@375 34 member = trustee_member,
bsw@375 35 image_type = "avatar",
bsw@375 36 show_dummy = true,
bsw@375 37 class = "micro_avatar",
bsw@375 38 popup_text = text
bsw@375 39 }
bsw@375 40 }
bsw@375 41 end
bsw@375 42 end }
bsw@375 43
bsw@375 44 if area_count > 0 then
bsw@375 45 execute.view{
bsw@375 46 module = "area", view = "_list",
bsw@375 47 params = { areas_selector = areas_selector, hide_membership = true }
bsw@375 48 }
bsw@375 49 else
bsw@383 50 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 51 end
bsw@414 52 ui.container{ content = function()
bsw@414 53 ui.link{ content = _"Show all areas of unit", module = "unit", view = "show", id = unit.id }
bsw@414 54 end }
bsw@414 55
bsw@375 56 end }
bsw@414 57
bsw@273 58 end

Impressum / About Us