annotate app/main/member/_area_list.lua @ 274:aec9df5b4cd3
More optical enhancements and repositioning of elements
author |
bsw |
date |
Sun Feb 12 12:20:19 2012 +0100 (2012-02-12) |
parents |
7196685f9dd7 |
children |
fecd4c13054a |
rev |
line source |
bsw@273
|
1 local units = app.session.member.units_with_voting_right
|
bsw@273
|
2 local member = param.get("member", "table")
|
bsw@273
|
3 for i, unit in ipairs(units) do
|
bsw@273
|
4 local areas_selector = Area:new_selector()
|
bsw@273
|
5 :join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id })
|
bsw@273
|
6 :add_where{ "area.unit_id = ?", unit.id }
|
bsw@273
|
7 :add_order_by("area.member_weight DESC")
|
bsw@273
|
8 ui.link{
|
bsw@274
|
9 attr = { class = "heading" },
|
bsw@273
|
10 text = unit.name,
|
bsw@273
|
11 module = "area", view = "list", params = { unit_id = unit.id }
|
bsw@273
|
12 }
|
bsw@273
|
13
|
bsw@274
|
14 if areas_selector:count() > 0 then
|
bsw@274
|
15 execute.view{
|
bsw@274
|
16 module = "area", view = "_list",
|
bsw@274
|
17 params = { areas_selector = areas_selector },
|
bsw@274
|
18 }
|
bsw@274
|
19 else
|
bsw@274
|
20 ui.tag{ content = _"You have voting privileges for this unit, but you are not member of any of its areas." }
|
bsw@274
|
21 slot.put(" ")
|
bsw@274
|
22 ui.link{
|
bsw@274
|
23 text = _"Show all areas of this unit",
|
bsw@274
|
24 module = "area", view = "list", params = { unit_id = unit.id }
|
bsw@274
|
25 }
|
bsw@274
|
26 end
|
bsw@274
|
27 slot.put("<br />")
|
bsw@274
|
28
|
bsw@273
|
29 end
|
bsw@273
|
30
|