annotate app/main/member/_area_list.lua @ 278:fecd4c13054a
Code/css clean up and minor enhancements
| author |
bsw |
| date |
Mon Feb 13 01:53:41 2012 +0100 (2012-02-13) |
| parents |
aec9df5b4cd3 |
| children |
808269b7f41c |
| 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
|
|
bsw@274
|
9 if areas_selector:count() > 0 then
|
|
bsw@274
|
10 execute.view{
|
|
bsw@274
|
11 module = "area", view = "_list",
|
|
bsw@278
|
12 params = { areas_selector = areas_selector, title = function()
|
|
bsw@278
|
13 ui.link{
|
|
bsw@278
|
14 attr = { class = "heading" },
|
|
bsw@278
|
15 text = unit.name,
|
|
bsw@278
|
16 module = "area", view = "list", params = { unit_id = unit.id }
|
|
bsw@278
|
17 }
|
|
bsw@278
|
18 end},
|
|
bsw@274
|
19 }
|
|
bsw@274
|
20 else
|
|
bsw@278
|
21 ui.link{
|
|
bsw@278
|
22 attr = { class = "heading" },
|
|
bsw@278
|
23 text = unit.name,
|
|
bsw@278
|
24 module = "area", view = "list", params = { unit_id = unit.id }
|
|
bsw@278
|
25 }
|
|
bsw@274
|
26 ui.tag{ content = _"You have voting privileges for this unit, but you are not member of any of its areas." }
|
|
bsw@274
|
27 slot.put(" ")
|
|
bsw@274
|
28 ui.link{
|
|
bsw@274
|
29 text = _"Show all areas of this unit",
|
|
bsw@274
|
30 module = "area", view = "list", params = { unit_id = unit.id }
|
|
bsw@274
|
31 }
|
|
bsw@274
|
32 end
|
|
bsw@274
|
33 slot.put("<br />")
|
|
bsw@278
|
34 slot.put("<br />")
|
|
bsw@274
|
35
|
|
bsw@273
|
36 end
|
|
bsw@273
|
37
|