liquid_feedback_frontend
view app/main/member/_area_list.lua @ 389:d75ace4af616
Removed debug code
| author | bsw | 
|---|---|
| date | Mon Mar 05 17:44:59 2012 +0100 (2012-03-05) | 
| parents | 380730df98ed | 
| children | 50d543a7fc05 | 
 line source
     1 local units = app.session.member.units_with_voting_right
     2 local member = param.get("member", "table")
     3 for i, unit in ipairs(units) do
     4   local trustee_member = Member:new_selector()
     5     :join("delegation", nil, { "delegation.unit_id = ? AND delegation.truster_id = ?", unit.id, member.id })
     6     :optional_object_mode()
     7     :exec()
     9   local areas_selector = Area:new_selector()
    10     :join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id })
    11     :add_where{ "area.unit_id = ?", unit.id }
    12     :add_order_by("area.member_weight DESC")
    14   local area_count = areas_selector:count()
    16   ui.container{ attr = { class = "member_area_list" }, content = function()
    17     ui.container{ attr = { class = "unit_head" }, content = function()
    18       ui.link{
    19         text = unit.name,
    20         module = "unit", view = "show", id = unit.id
    21       }
    23       if trustee_member then
    24         local text = _("Unit delegated to '#{name}'", { name = trustee_member.name })
    25         ui.image{
    26           attr = { class = "delegation_arrow", alt = text, title = text },
    27           static = "delegation_arrow_24_horizontal.png"
    28         }
    29         execute.view{
    30           module = "member_image",
    31           view = "_show",
    32           params = {
    33             member = trustee_member,
    34             image_type = "avatar",
    35             show_dummy = true,
    36             class = "micro_avatar",
    37             popup_text = text
    38           }
    39         }
    40       end
    41     end }
    43     if area_count > 0 then
    44       execute.view{
    45         module = "area", view = "_list",
    46         params = { areas_selector = areas_selector, hide_membership = true }
    47       }
    48     else
    49       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." }
    50     end
    51   end }
    53 end
