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@528
|
27 ui.tag{ content = _"You are participating in this area" }
|
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@528
|
38 routing = {
|
bsw@528
|
39 default = {
|
bsw@528
|
40 mode = "redirect",
|
bsw@528
|
41 module = request.get_module(),
|
bsw@528
|
42 view = request.get_view(),
|
bsw@528
|
43 id = param.get_id_cgi(),
|
bsw@528
|
44 params = param.get_all_cgi()
|
bsw@528
|
45 }
|
bsw@528
|
46 }
|
bsw@526
|
47 }
|
bsw@526
|
48 slot.put(")")
|
bsw@526
|
49 end }
|
bsw@526
|
50
|
bsw@526
|
51 slot.put(" · ")
|
bsw@525
|
52
|
bsw@526
|
53 elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then
|
bsw@526
|
54 ui.link{
|
bsw@528
|
55 text = _"Participate in this area",
|
bsw@526
|
56 module = "membership",
|
bsw@526
|
57 action = "update",
|
bsw@526
|
58 params = { area_id = area.id },
|
bsw@526
|
59 routing = {
|
bsw@526
|
60 default = {
|
bsw@526
|
61 mode = "redirect",
|
bsw@528
|
62 module = request.get_module(),
|
bsw@528
|
63 view = request.get_view(),
|
bsw@528
|
64 id = param.get_id_cgi(),
|
bsw@528
|
65 params = param.get_all_cgi()
|
bsw@525
|
66 }
|
bsw@525
|
67 }
|
bsw@526
|
68 }
|
bsw@525
|
69
|
bsw@526
|
70 slot.put(" · ")
|
bsw@525
|
71
|
bsw@525
|
72 end
|
bsw@525
|
73
|
bsw@526
|
74 -- create new issue
|
bsw@526
|
75 if app.session.member:has_voting_right_for_unit_id(area.unit_id) then
|
bsw@526
|
76 ui.link{
|
bsw@526
|
77 content = function()
|
bsw@526
|
78 slot.put(_"Create new issue")
|
bsw@526
|
79 end,
|
bsw@526
|
80 module = "initiative",
|
bsw@526
|
81 view = "new",
|
bsw@526
|
82 params = { area_id = area.id }
|
bsw@526
|
83 }
|
bsw@526
|
84 end
|
bsw@526
|
85
|
bsw@526
|
86 end
|
bsw@526
|
87
|
bsw@525
|
88 end }
|
bsw@526
|
89
|
bsw@526
|
90 end } |