rev |
line source |
bsw@525
|
1 local area = param.get("area", "table")
|
bsw@774
|
2 local member = param.get("member", "table")
|
bsw@525
|
3
|
bsw@529
|
4 local show_content = param.get("show_content", atom.boolean)
|
bsw@529
|
5
|
bsw@815
|
6 if app.session.member_id then
|
bsw@815
|
7 area:load_delegation_info_once_for_member_id(app.session.member_id)
|
bsw@815
|
8 end
|
bsw@529
|
9
|
bsw@619
|
10 if not param.get("hide_unit", atom.boolean) then
|
bsw@795
|
11 execute.view{ module = "unit", view = "_head", params = { unit = area.unit, member = member } }
|
bsw@619
|
12 end
|
bsw@525
|
13
|
bsw@526
|
14 ui.container{ attr = { class = "area_head" }, content = function()
|
bsw@525
|
15
|
bsw@774
|
16 execute.view{ module = "delegation", view = "_info", params = { area = area, member = member } }
|
bsw@525
|
17
|
bsw@526
|
18 ui.container{ attr = { class = "title" }, content = function()
|
bsw@526
|
19 -- area name
|
bsw@526
|
20 ui.link{
|
bsw@526
|
21 module = "area", view = "show", id = area.id,
|
bsw@526
|
22 attr = { class = "area_name" }, content = area.name
|
bsw@526
|
23 }
|
bsw@526
|
24 end }
|
bsw@526
|
25
|
bsw@529
|
26 if show_content then
|
bsw@529
|
27
|
bsw@529
|
28 ui.container{ attr = { class = "content" }, content = function()
|
bsw@525
|
29
|
bsw@529
|
30 -- actions (members with appropriate voting right only)
|
bsw@781
|
31 if member then
|
bsw@525
|
32
|
bsw@529
|
33 -- membership
|
bsw@774
|
34 local membership = Membership:by_pk(area.id, member.id)
|
bsw@525
|
35
|
bsw@529
|
36 if membership then
|
bsw@529
|
37
|
bsw@774
|
38 if app.session.member_id == member.id then
|
bsw@774
|
39 ui.tag{ content = _"You are participating in this area" }
|
bsw@782
|
40 slot.put(" ")
|
bsw@774
|
41 ui.tag{ content = function()
|
bsw@774
|
42 slot.put("(")
|
bsw@774
|
43 ui.link{
|
bsw@774
|
44 text = _"Withdraw",
|
bsw@774
|
45 module = "membership",
|
bsw@774
|
46 action = "update",
|
bsw@774
|
47 params = { area_id = area.id, delete = true },
|
bsw@774
|
48 routing = {
|
bsw@774
|
49 default = {
|
bsw@774
|
50 mode = "redirect",
|
bsw@774
|
51 module = request.get_module(),
|
bsw@774
|
52 view = request.get_view(),
|
bsw@774
|
53 id = param.get_id_cgi(),
|
bsw@774
|
54 params = param.get_all_cgi()
|
bsw@774
|
55 }
|
bsw@529
|
56 }
|
bsw@529
|
57 }
|
bsw@774
|
58 slot.put(")")
|
bsw@774
|
59 end }
|
bsw@774
|
60 else
|
bsw@774
|
61 ui.tag{ content = _"Member is participating in this area" }
|
bsw@774
|
62 end
|
bsw@529
|
63
|
bsw@774
|
64 elseif app.session.member_id == member.id and member:has_voting_right_for_unit_id(area.unit_id) then
|
bsw@526
|
65 ui.link{
|
bsw@529
|
66 text = _"Participate in this area",
|
bsw@529
|
67 module = "membership",
|
bsw@529
|
68 action = "update",
|
bsw@529
|
69 params = { area_id = area.id },
|
bsw@528
|
70 routing = {
|
bsw@528
|
71 default = {
|
bsw@528
|
72 mode = "redirect",
|
bsw@528
|
73 module = request.get_module(),
|
bsw@528
|
74 view = request.get_view(),
|
bsw@528
|
75 id = param.get_id_cgi(),
|
bsw@528
|
76 params = param.get_all_cgi()
|
bsw@528
|
77 }
|
bsw@528
|
78 }
|
bsw@526
|
79 }
|
bsw@529
|
80 end
|
bsw@622
|
81
|
bsw@774
|
82 if app.session.member_id == member.id and app.session.member:has_voting_right_for_unit_id(area.unit_id) then
|
bsw@529
|
83
|
bsw@622
|
84 slot.put(" · ")
|
bsw@622
|
85 if area.delegation_info.own_delegation_scope ~= "area" then
|
bsw@622
|
86 ui.link{ text = _"Delegate area", module = "delegation", view = "show", params = { area_id = area.id } }
|
bsw@622
|
87 else
|
bsw@622
|
88 ui.link{ text = _"Change area delegation", module = "delegation", view = "show", params = { area_id = area.id } }
|
bsw@622
|
89 end
|
bsw@622
|
90 slot.put(" · ")
|
bsw@525
|
91
|
bsw@529
|
92 ui.link{
|
bsw@529
|
93 content = function()
|
bsw@529
|
94 slot.put(_"Create new issue")
|
bsw@529
|
95 end,
|
bsw@529
|
96 module = "initiative",
|
bsw@529
|
97 view = "new",
|
bsw@529
|
98 params = { area_id = area.id }
|
bsw@525
|
99 }
|
bsw@529
|
100 end
|
bsw@525
|
101
|
bsw@525
|
102 end
|
bsw@525
|
103
|
bsw@529
|
104 end }
|
bsw@526
|
105
|
bsw@529
|
106 else
|
bsw@529
|
107 slot.put("<br />")
|
bsw@529
|
108 end
|
bsw@526
|
109
|
bsw@526
|
110 end } |