rev |
line source |
bsw@525
|
1 local area = param.get("area", "table")
|
bsw@525
|
2
|
bsw@525
|
3 execute.view{ module = "unit", view = "_head", params = { unit = area.unit } }
|
bsw@525
|
4
|
bsw@526
|
5 ui.container{ attr = { class = "area_head" }, content = function()
|
bsw@525
|
6
|
bsw@526
|
7 execute.view{ module = "delegation", view = "_info", params = { area = area } }
|
bsw@525
|
8
|
bsw@526
|
9 ui.container{ attr = { class = "title" }, content = function()
|
bsw@526
|
10 -- area name
|
bsw@526
|
11 ui.link{
|
bsw@526
|
12 module = "area", view = "show", id = area.id,
|
bsw@526
|
13 attr = { class = "area_name" }, content = area.name
|
bsw@526
|
14 }
|
bsw@526
|
15 end }
|
bsw@526
|
16
|
bsw@526
|
17 ui.container{ attr = { class = "content" }, content = function()
|
bsw@525
|
18
|
bsw@526
|
19 -- actions (members with appropriate voting right only)
|
bsw@526
|
20 if app.session.member_id then
|
bsw@525
|
21
|
bsw@526
|
22 -- membership
|
bsw@526
|
23 local membership = Membership:by_pk(area.id, app.session.member.id)
|
bsw@525
|
24
|
bsw@526
|
25 if membership then
|
bsw@526
|
26
|
bsw@526
|
27 ui.tag{ content = _"You are member" }
|
bsw@526
|
28
|
bsw@526
|
29 slot.put(" ")
|
bsw@526
|
30
|
bsw@526
|
31 ui.tag{ content = function()
|
bsw@526
|
32 slot.put("(")
|
bsw@526
|
33 ui.link{
|
bsw@526
|
34 text = _"Withdraw",
|
bsw@526
|
35 module = "membership",
|
bsw@526
|
36 action = "update",
|
bsw@526
|
37 params = { area_id = area.id, delete = true },
|
bsw@526
|
38 routing = { default = { mode = "redirect", module = "area", view = "show", id = area.id } }
|
bsw@526
|
39 }
|
bsw@526
|
40 slot.put(")")
|
bsw@526
|
41 end }
|
bsw@526
|
42
|
bsw@526
|
43 slot.put(" · ")
|
bsw@525
|
44
|
bsw@526
|
45 elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then
|
bsw@526
|
46 ui.link{
|
bsw@526
|
47 text = _"Become a member",
|
bsw@526
|
48 module = "membership",
|
bsw@526
|
49 action = "update",
|
bsw@526
|
50 params = { area_id = area.id },
|
bsw@526
|
51 routing = {
|
bsw@526
|
52 default = {
|
bsw@526
|
53 mode = "redirect",
|
bsw@526
|
54 module = "area",
|
bsw@526
|
55 view = "show",
|
bsw@526
|
56 id = area.id
|
bsw@525
|
57 }
|
bsw@525
|
58 }
|
bsw@526
|
59 }
|
bsw@525
|
60
|
bsw@526
|
61 slot.put(" · ")
|
bsw@525
|
62
|
bsw@525
|
63 end
|
bsw@525
|
64
|
bsw@526
|
65 -- create new issue
|
bsw@526
|
66 if app.session.member:has_voting_right_for_unit_id(area.unit_id) then
|
bsw@526
|
67 ui.link{
|
bsw@526
|
68 content = function()
|
bsw@526
|
69 slot.put(_"Create new issue")
|
bsw@526
|
70 end,
|
bsw@526
|
71 module = "initiative",
|
bsw@526
|
72 view = "new",
|
bsw@526
|
73 params = { area_id = area.id }
|
bsw@526
|
74 }
|
bsw@526
|
75 end
|
bsw@526
|
76
|
bsw@526
|
77 end
|
bsw@526
|
78
|
bsw@525
|
79 end }
|
bsw@526
|
80
|
bsw@526
|
81 end } |