annotate app/main/member/_area_list.lua @ 308:aebddf876f67
Changed two links from area/list to unit/show
author |
bsw |
date |
Sun Feb 26 22:29:52 2012 +0100 (2012-02-26) |
parents |
22e4e26717ac |
children |
89d32158bfd5 |
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@280
|
9 local area_count = areas_selector:count()
|
bsw@280
|
10 local class = "heading"
|
bsw@280
|
11 if area_count > 0 then
|
bsw@280
|
12 class = class .. " member_area_list"
|
bsw@280
|
13 end
|
bsw@280
|
14 ui.link{
|
bsw@280
|
15 attr = { class = class },
|
bsw@280
|
16 text = unit.name,
|
bsw@301
|
17 module = "unit", view = "show", id = unit.id
|
bsw@280
|
18 }
|
bsw@280
|
19
|
bsw@280
|
20 if area_count > 0 then
|
bsw@274
|
21 execute.view{
|
bsw@274
|
22 module = "area", view = "_list",
|
bsw@280
|
23 params = { areas_selector = areas_selector }
|
bsw@274
|
24 }
|
bsw@274
|
25 else
|
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@308
|
30 module = "unit", view = "show", 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
|