liquid_feedback_frontend
view app/main/member/_area_list.lua @ 351:2a20b9b547ac
While registering with invite key allow to choose the name the member already has
| author | bsw | 
|---|---|
| date | Wed Feb 29 20:12:41 2012 +0100 (2012-02-29) | 
| parents | aebddf876f67 | 
| children | 89d32158bfd5 | 
 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 areas_selector = Area:new_selector()
     5     :join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id })
     6     :add_where{ "area.unit_id = ?", unit.id }
     7     :add_order_by("area.member_weight DESC")
     9   local area_count = areas_selector:count()
    10   local class = "heading"
    11   if area_count > 0 then
    12     class = class .. " member_area_list"
    13   end
    14   ui.link{
    15     attr = { class = class },
    16     text = unit.name,
    17     module = "unit", view = "show", id = unit.id
    18   }
    20   if area_count > 0 then
    21     execute.view{
    22       module = "area", view = "_list",
    23       params = { areas_selector = areas_selector }
    24     }
    25   else
    26     ui.tag{ content = _"You have voting privileges for this unit, but you are not member of any of its areas." }
    27     slot.put(" ")
    28     ui.link{
    29       text = _"Show all areas of this unit",
    30       module = "unit", view = "show", id = unit.id
    31     }
    32    end
    33   slot.put("<br />")
    34   slot.put("<br />")
    36 end
