rev |
line source |
bsw@1045
|
1 local issue = param.get("issue", "table")
|
bsw@1045
|
2 local initiative = param.get("initiative", "table")
|
bsw@1045
|
3 local member = param.get("member", "table") or app.session.member
|
bsw@1045
|
4
|
bsw@1045
|
5 if initiative then
|
bsw@1045
|
6 issue = initiative.issue
|
bsw@1045
|
7 end
|
bsw@1045
|
8
|
bsw@1045
|
9 local privileged_to_vote = app.session.member and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id)
|
bsw@1045
|
10
|
bsw@1045
|
11 local active_trustee_id
|
bsw@1045
|
12 if member then
|
bsw@1045
|
13 if not issue.member_info.own_participation then
|
bsw@1045
|
14 if issue.member_info.first_trustee_participation then
|
bsw@1045
|
15 active_trustee_id = issue.member_info.first_trustee_id
|
bsw@1045
|
16 elseif issue.member_info.other_trustee_participation then
|
bsw@1045
|
17 active_trustee_id = issue.member_info.other_trustee_id
|
bsw@1045
|
18 end
|
bsw@1045
|
19 end
|
bsw@1045
|
20 end
|
bsw@1045
|
21
|
bsw@1045
|
22 ui.sidebar ( "tab-whatcanido", function ()
|
bsw@1045
|
23
|
bsw@1045
|
24 ui.sidebarHeadWhatCanIDo()
|
bsw@1045
|
25
|
bsw@1045
|
26 local supporter
|
bsw@1045
|
27
|
bsw@1045
|
28 if initiative and app.session.member_id then
|
bsw@1045
|
29 supporter = app.session.member:get_reference_selector("supporters")
|
bsw@1045
|
30 :add_where{ "initiative_id = ?", initiative.id }
|
bsw@1045
|
31 :optional_object_mode()
|
bsw@1045
|
32 :exec()
|
bsw@1045
|
33 end
|
bsw@1045
|
34
|
bsw@1045
|
35 local view_module
|
bsw@1045
|
36 local view_id
|
bsw@1045
|
37
|
bsw@1045
|
38 if initiative then
|
bsw@1045
|
39 issue = issue
|
bsw@1045
|
40 view_module = "initiative"
|
bsw@1045
|
41 view_id = initiative.id
|
bsw@1045
|
42 else
|
bsw@1045
|
43 view_module = "issue"
|
bsw@1045
|
44 view_id = issue.id
|
bsw@1045
|
45 end
|
bsw@1045
|
46
|
bsw@1045
|
47 local initiator
|
bsw@1045
|
48 if initiative and app.session.member_id then
|
bsw@1045
|
49 initiator = Initiator:by_pk(initiative.id, app.session.member.id)
|
bsw@1045
|
50 end
|
bsw@1045
|
51
|
bsw@1045
|
52 local initiators
|
bsw@1045
|
53
|
bsw@1045
|
54 if initiative then
|
bsw@1045
|
55 local initiators_members_selector = initiative:get_reference_selector("initiating_members")
|
bsw@1045
|
56 :add_field("initiator.accepted", "accepted")
|
bsw@1045
|
57 :add_order_by("member.name")
|
bsw@1045
|
58 if initiator and initiator.accepted then
|
bsw@1045
|
59 initiators_members_selector:add_where("initiator.accepted ISNULL OR initiator.accepted")
|
bsw@1045
|
60 else
|
bsw@1045
|
61 initiators_members_selector:add_where("initiator.accepted")
|
bsw@1045
|
62 end
|
bsw@1045
|
63
|
bsw@1045
|
64 initiators = initiators_members_selector:exec()
|
bsw@1045
|
65 end
|
bsw@1045
|
66
|
bsw@1045
|
67 if initiator and
|
bsw@1045
|
68 initiator.accepted and
|
bsw@1045
|
69 not issue.fully_frozen and
|
bsw@1045
|
70 not issue.closed and
|
bsw@1045
|
71 not initiative.revoked
|
bsw@1045
|
72 then
|
bsw@1045
|
73
|
bsw@1045
|
74 ui.container { attr = { class = "sidebarRow" }, content = function ()
|
bsw@1045
|
75 ui.heading { level = 3, content = function()
|
bsw@1045
|
76 ui.tag { content = _"You are initiator of this initiative" }
|
bsw@1045
|
77 end }
|
bsw@1045
|
78 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1135
|
79 if issue.half_frozen then
|
bsw@1135
|
80 ui.tag { tag = "li", content = _"this issue is in verification phase, therefore the initiative text cannot be updated anymore" }
|
bsw@1135
|
81 else
|
bsw@1135
|
82 ui.tag { tag = "li", content = function ()
|
bsw@1135
|
83 ui.link{
|
bsw@1135
|
84 module = "draft", view = "new",
|
bsw@1135
|
85 params = { initiative_id = initiative.id },
|
bsw@1135
|
86 content = _"edit proposal and/or reasons"
|
bsw@1135
|
87 }
|
bsw@1135
|
88 end }
|
bsw@1045
|
89 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
90 ui.link{
|
bsw@1135
|
91 attr = { class = "action" },
|
bsw@1135
|
92 module = "initiative", view = "add_initiator",
|
bsw@1045
|
93 params = { initiative_id = initiative.id },
|
bsw@1135
|
94 content = _"invite another initiator"
|
bsw@1135
|
95 }
|
bsw@1135
|
96 end }
|
bsw@1135
|
97 if #initiative.initiators > 1 then
|
bsw@1135
|
98 ui.tag { tag = "li", content = function ()
|
bsw@1135
|
99 ui.link{
|
bsw@1135
|
100 module = "initiative", view = "remove_initiator",
|
bsw@1135
|
101 params = { initiative_id = initiative.id },
|
bsw@1135
|
102 content = _"remove an initiator"
|
bsw@1135
|
103 }
|
bsw@1135
|
104 end }
|
bsw@1135
|
105 end
|
bsw@1135
|
106 ui.tag { tag = "li", content = function ()
|
bsw@1135
|
107 ui.link{
|
bsw@1135
|
108 module = "initiative", view = "revoke", id = initiative.id,
|
bsw@1135
|
109 content = _"revoke initiative"
|
bsw@1045
|
110 }
|
bsw@1045
|
111 end }
|
bsw@1045
|
112 end
|
bsw@1045
|
113 end }
|
bsw@1045
|
114 end }
|
bsw@1045
|
115 end
|
bsw@1045
|
116
|
bsw@1045
|
117 -- invited as initiator
|
bsw@1045
|
118 if initiator and initiator.accepted == nil and not initiative.issue.half_frozen and not initiative.issue.closed then
|
bsw@1045
|
119 ui.container { attr = { class = "sidebarRow highlighted" }, content = function ()
|
bsw@1045
|
120 ui.heading { level = 3, content = function()
|
bsw@1045
|
121 ui.tag { content = _"You are invited to become initiator of this initiative" }
|
bsw@1045
|
122 end }
|
bsw@1045
|
123 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
124 ui.tag{ tag = "li", content = function ()
|
bsw@1045
|
125 ui.link{
|
bsw@1045
|
126 content = _"accept invitation",
|
bsw@1045
|
127 module = "initiative",
|
bsw@1045
|
128 action = "accept_invitation",
|
bsw@1045
|
129 id = initiative.id,
|
bsw@1045
|
130 routing = {
|
bsw@1045
|
131 default = {
|
bsw@1045
|
132 mode = "redirect",
|
bsw@1045
|
133 module = request.get_module(),
|
bsw@1045
|
134 view = request.get_view(),
|
bsw@1145
|
135 id = request.get_id_string(),
|
bsw@1145
|
136 params = request.get_param_strings()
|
bsw@1045
|
137 }
|
bsw@1045
|
138 }
|
bsw@1045
|
139 }
|
bsw@1045
|
140 end }
|
bsw@1045
|
141
|
bsw@1045
|
142 ui.tag{ tag = "li", content = function ()
|
bsw@1045
|
143 ui.link{
|
bsw@1045
|
144 content = _"refuse invitation",
|
bsw@1045
|
145 module = "initiative",
|
bsw@1045
|
146 action = "reject_initiator_invitation",
|
bsw@1045
|
147 params = {
|
bsw@1045
|
148 initiative_id = initiative.id,
|
bsw@1045
|
149 member_id = app.session.member.id
|
bsw@1045
|
150 },
|
bsw@1045
|
151 routing = {
|
bsw@1045
|
152 default = {
|
bsw@1045
|
153 mode = "redirect",
|
bsw@1045
|
154 module = request.get_module(),
|
bsw@1045
|
155 view = request.get_view(),
|
bsw@1145
|
156 id = request.get_id_string(),
|
bsw@1145
|
157 params = request.get_param_strings()
|
bsw@1045
|
158 }
|
bsw@1045
|
159 }
|
bsw@1045
|
160 }
|
bsw@1045
|
161 end }
|
bsw@1045
|
162 end }
|
bsw@1045
|
163 end }
|
bsw@1045
|
164 end
|
bsw@1045
|
165
|
bsw@1045
|
166
|
bsw@1045
|
167 if privileged_to_vote and issue.member_info.first_trustee_id then
|
bsw@1045
|
168 local member = Member:by_id(issue.member_info.first_trustee_id)
|
bsw@1045
|
169 ui.sidebarSection( function ()
|
bsw@1045
|
170 ui.container { attr = { class = "right" }, content = function()
|
bsw@1045
|
171 execute.view{
|
bsw@1045
|
172 module = "member_image",
|
bsw@1045
|
173 view = "_show",
|
bsw@1045
|
174 params = {
|
bsw@1045
|
175 member = member,
|
bsw@1045
|
176 image_type = "avatar",
|
bsw@1045
|
177 show_dummy = true
|
bsw@1045
|
178 }
|
bsw@1045
|
179 }
|
bsw@1045
|
180 end }
|
bsw@1045
|
181 if issue.member_info.own_delegation_scope == "unit" then
|
bsw@1045
|
182 ui.heading{ level = 3, content = _"You delegated this organizational unit" }
|
bsw@1045
|
183 elseif issue.member_info.own_delegation_scope == "area" then
|
bsw@1045
|
184 ui.heading{ level = 3, content = _"You delegated this subject area" }
|
bsw@1045
|
185 elseif issue.member_info.own_delegation_scope == "issue" then
|
bsw@1045
|
186 ui.heading{ level = 3, content = _"You delegated this issue" }
|
bsw@1045
|
187 end
|
bsw@1045
|
188
|
bsw@1045
|
189 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
190 if issue.member_info.own_delegation_scope == "area" or
|
bsw@1045
|
191 issue.member_info.own_delegation_scope == "unit" then
|
bsw@1045
|
192 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
193 ui.link {
|
bsw@1045
|
194 module = "delegation", view = "show", params = {
|
bsw@1045
|
195 issue_id = issue.id,
|
bsw@1045
|
196 initiative_id = initiative and initiative.id or nil
|
bsw@1045
|
197 },
|
bsw@1045
|
198 content = _"change/revoke delegation only for this issue"
|
bsw@1045
|
199 }
|
bsw@1045
|
200 end }
|
bsw@1045
|
201 end
|
bsw@1045
|
202 if issue.member_info.own_delegation_scope == "unit" then
|
bsw@1045
|
203 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
204 ui.link {
|
bsw@1045
|
205 module = "delegation", view = "show", params = {
|
bsw@1045
|
206 unit_id = issue.area.unit_id,
|
bsw@1045
|
207 },
|
bsw@1045
|
208 content = _("change/revoke delegation of organizational unit", {
|
bsw@1045
|
209 unit_name = issue.area.unit.name
|
bsw@1045
|
210 })
|
bsw@1045
|
211 }
|
bsw@1045
|
212 end }
|
bsw@1045
|
213 elseif issue.member_info.own_delegation_scope == "area" then
|
bsw@1045
|
214 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
215 ui.link {
|
bsw@1045
|
216 module = "delegation", view = "show", params = {
|
bsw@1045
|
217 area_id = issue.area_id,
|
bsw@1045
|
218 },
|
bsw@1045
|
219 content = _"change/revoke delegation of subject area"
|
bsw@1045
|
220 }
|
bsw@1045
|
221 end }
|
bsw@1045
|
222 end
|
bsw@1045
|
223 if issue.member_info.own_delegation_scope == nil then
|
bsw@1045
|
224 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
225 ui.link {
|
bsw@1045
|
226 module = "delegation", view = "show", params = {
|
bsw@1045
|
227 issue_id = issue.id,
|
bsw@1045
|
228 initiative_id = initiative and initiative.id or nil
|
bsw@1045
|
229 },
|
bsw@1045
|
230 content = _"choose issue delegatee"
|
bsw@1045
|
231 }
|
bsw@1045
|
232 end }
|
bsw@1045
|
233 elseif issue.member_info.own_delegation_scope == "issue" then
|
bsw@1045
|
234 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
235 ui.link {
|
bsw@1045
|
236 module = "delegation", view = "show", params = {
|
bsw@1045
|
237 issue_id = issue.id,
|
bsw@1045
|
238 initiative_id = initiative and initiative.id or nil
|
bsw@1045
|
239 },
|
bsw@1045
|
240 content = _"change/revoke issue delegation"
|
bsw@1045
|
241 }
|
bsw@1045
|
242 end }
|
bsw@1045
|
243 end
|
bsw@1045
|
244 end }
|
bsw@1045
|
245
|
bsw@1045
|
246 if issue.member_info.first_trustee_id and issue.member_info.own_participation then
|
bsw@1045
|
247 local text = _"As long as you are interested in this issue yourself, the delegation is suspended for this issue, but it will be applied again in the voting phase unless you vote yourself."
|
bsw@1045
|
248 if issue.state == "voting" then
|
bsw@1045
|
249 text = _"This delegation is suspended, because you voted yourself."
|
bsw@1045
|
250 end
|
bsw@1045
|
251 ui.container { content = text }
|
bsw@1045
|
252 end
|
bsw@1045
|
253 end )
|
bsw@1045
|
254 end
|
bsw@1045
|
255
|
bsw@1045
|
256 if privileged_to_vote and not issue.closed and not issue.fully_frozen then
|
bsw@1045
|
257 if issue.member_info.own_participation then
|
bsw@1045
|
258 ui.sidebarSection( function ()
|
bsw@1045
|
259 ui.container{ attr = { class = "right" }, content = function()
|
bsw@1045
|
260 ui.image{ attr = { class = "right" }, static = "icons/48/eye.png" }
|
bsw@1045
|
261 if issue.member_info.weight and issue.member_info.weight > 1 then
|
bsw@1045
|
262 slot.put("<br />")
|
bsw@1045
|
263 ui.tag{
|
bsw@1045
|
264 attr = { class = "right" },
|
bsw@1045
|
265 content = "+" .. issue.member_info.weight - 1
|
bsw@1045
|
266 }
|
bsw@1045
|
267 end
|
bsw@1045
|
268 end }
|
bsw@1045
|
269 ui.heading{ level = 3, content = _("You are interested in this issue", { id = issue.id }) }
|
bsw@1045
|
270 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
271 if issue.member_info.weight and issue.member_info.weight > 1 then
|
bsw@1045
|
272 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
273 ui.link {
|
bsw@1045
|
274 module = "delegation", view = "show_incoming",
|
bsw@1045
|
275 params = { issue_id = issue.id, member_id = app.session.member_id },
|
bsw@1045
|
276 content = _("you have #{count} incoming delegations", {
|
bsw@1045
|
277 count = issue.member_info.weight - 1
|
bsw@1045
|
278 })
|
bsw@1045
|
279 }
|
bsw@1045
|
280 end }
|
bsw@1045
|
281 end
|
bsw@1045
|
282 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
283 ui.link {
|
bsw@1045
|
284 module = "interest", action = "update",
|
bsw@1045
|
285 routing = { default = {
|
bsw@1045
|
286 mode = "redirect", module = view_module, view = "show", id = view_id
|
bsw@1045
|
287 } },
|
bsw@1045
|
288 params = { issue_id = issue.id, delete = true },
|
bsw@1045
|
289 text = _"remove my interest"
|
bsw@1045
|
290 }
|
bsw@1045
|
291 end }
|
bsw@1045
|
292 end }
|
bsw@1045
|
293 end )
|
bsw@1045
|
294 else
|
bsw@1045
|
295 ui.sidebarSection( function ()
|
bsw@1045
|
296 ui.heading{ level = 3, content = _("I want to participate in this issue", { id = issue.id }) }
|
bsw@1045
|
297 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
298 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
299 ui.link {
|
bsw@1045
|
300 module = "interest", action = "update",
|
bsw@1045
|
301 params = { issue_id = issue.id },
|
bsw@1045
|
302 routing = { default = {
|
bsw@1045
|
303 mode = "redirect", module = view_module, view = "show", id = view_id
|
bsw@1045
|
304 } },
|
bsw@1045
|
305 text = _"add my interest"
|
bsw@1045
|
306 }
|
bsw@1045
|
307 end }
|
bsw@1045
|
308 ui.tag { tag = "li", content = _"browse through the competing initiatives" }
|
bsw@1045
|
309 end }
|
bsw@1045
|
310 end )
|
bsw@1045
|
311 end
|
bsw@1045
|
312
|
bsw@1045
|
313 if initiative then
|
bsw@1045
|
314
|
bsw@1045
|
315 if not initiative.member_info.supported or active_trustee_id then
|
bsw@1045
|
316 ui.container { attr = { class = "sidebarRow" }, content = function ()
|
bsw@1045
|
317 ui.heading { level = 3, content = function()
|
bsw@1045
|
318 ui.tag { content = _"I like this initiative and I want to support it" }
|
bsw@1045
|
319 end }
|
bsw@1045
|
320 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
321 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
322 ui.link {
|
bsw@1045
|
323 module = "initiative", action = "add_support",
|
bsw@1045
|
324 routing = { default = {
|
bsw@1045
|
325 mode = "redirect", module = "initiative", view = "show", id = initiative.id
|
bsw@1045
|
326 } },
|
bsw@1045
|
327 id = initiative.id,
|
bsw@1045
|
328 text = _"add my support"
|
bsw@1045
|
329 }
|
bsw@1045
|
330 end }
|
bsw@1045
|
331 end }
|
bsw@1045
|
332 end }
|
bsw@1045
|
333
|
bsw@1045
|
334 else -- if not supported
|
bsw@1045
|
335 ui.container { attr = { class = "sidebarRow" }, content = function ()
|
bsw@1045
|
336 if initiative.member_info.satisfied then
|
bsw@1045
|
337 ui.image{ attr = { class = "right icon48" }, static = "icons/32/support_satisfied.png" }
|
bsw@1045
|
338 else
|
bsw@1045
|
339 ui.image{ attr = { class = "right icon48" }, static = "icons/32/support_unsatisfied.png" }
|
bsw@1045
|
340 end
|
bsw@1045
|
341 ui.heading { level = 3, content = _"You are supporting this initiative" }
|
bsw@1045
|
342 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
343 if not initiative.member_info.satisfied then
|
bsw@1045
|
344 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
345 ui.tag { content = function ()
|
bsw@1045
|
346 ui.link {
|
bsw@1045
|
347 external = "#suggestions",
|
bsw@1045
|
348 content = _"you restricted your support by rating suggestions as must or must not"
|
bsw@1045
|
349 }
|
bsw@1045
|
350 end }
|
bsw@1045
|
351 end }
|
bsw@1045
|
352 end
|
bsw@1045
|
353 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
354 ui.tag { content = function ()
|
bsw@1045
|
355 ui.link {
|
bsw@1045
|
356 xattr = { class = "btn btn-remove" },
|
bsw@1045
|
357 module = "initiative", action = "remove_support",
|
bsw@1045
|
358 routing = { default = {
|
bsw@1045
|
359 mode = "redirect", module = "initiative", view = "show", id = initiative.id
|
bsw@1045
|
360 } },
|
bsw@1045
|
361 id = initiative.id,
|
bsw@1045
|
362 text = _"remove my support"
|
bsw@1045
|
363 }
|
bsw@1045
|
364 end }
|
bsw@1045
|
365 end }
|
bsw@1045
|
366 end }
|
bsw@1045
|
367 end }
|
bsw@1045
|
368
|
bsw@1045
|
369 end -- not supported
|
bsw@1045
|
370
|
bsw@1045
|
371 ui.container { attr = { class = "sidebarRow" }, content = function ()
|
bsw@1045
|
372 ui.heading { level = 3, content = _"I want to improve this initiative" }
|
bsw@1045
|
373 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
374 if issue.state == "verification" then
|
bsw@1045
|
375 ui.tag { tag = "li", content = _"this issue is in verification phase, therefore the initiative text cannot be updated anymore" }
|
bsw@1045
|
376 elseif issue.state == "voting" then
|
bsw@1045
|
377 ui.tag { tag = "li", content = _"this issue is in voting phase, therefore the initiative text cannot be updated anymore" }
|
bsw@1045
|
378 else
|
bsw@1045
|
379
|
bsw@1045
|
380 if initiative.member_info.initiated then
|
bsw@1045
|
381 ui.tag { tag = "li", content =_"take a look at the suggestions of your supporters" }
|
bsw@1045
|
382 ui.tag { tag = "li", content =_"if you like to implement a suggestion in your proposal and/or reasons, update your initiative draft" }
|
bsw@1045
|
383 ui.tag { tag = "li", content =_"to argue about suggestions, just add your arguments to your reasons in the initiative draft, so your supporters can learn about your opinion" }
|
bsw@1045
|
384 end
|
bsw@1045
|
385
|
bsw@1045
|
386 if not initiative.member_info.supported or active_trustee_id then
|
bsw@1045
|
387 ui.tag { tag = "li", content =_"add your support (see above) and rate or write new suggestions (and thereby restrict your support to certain conditions if necessary)" }
|
bsw@1045
|
388 else
|
bsw@1045
|
389 ui.tag { tag = "li", content = _"take a look at the suggestions (see left) and rate them" }
|
bsw@1045
|
390 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
391 ui.link {
|
bsw@1045
|
392 module = "suggestion", view = "new", params = {
|
bsw@1045
|
393 initiative_id = initiative.id
|
bsw@1045
|
394 },
|
bsw@1045
|
395 content = _"write a new suggestion"
|
bsw@1045
|
396 }
|
bsw@1045
|
397 end }
|
bsw@1045
|
398 end
|
bsw@1045
|
399 end
|
bsw@1045
|
400 end }
|
bsw@1045
|
401 end }
|
bsw@1045
|
402
|
bsw@1045
|
403 end
|
bsw@1045
|
404
|
bsw@1045
|
405 if
|
bsw@1045
|
406 (issue.state == "admission" or
|
bsw@1045
|
407 issue.state == "discussion" or
|
bsw@1045
|
408 issue.state == "verification")
|
bsw@1045
|
409 then
|
bsw@1045
|
410 ui.sidebarSection( function ()
|
bsw@1045
|
411 if initiative then
|
bsw@1045
|
412 ui.heading{ level = 3, content = _"I don't like this initiative and I want to add my opinion or counter proposal" }
|
bsw@1045
|
413 else
|
bsw@1045
|
414 ui.heading{ level = 3, content = _"I don't like any of the initiative in this issue and I want to add my opinion or counter proposal" }
|
bsw@1045
|
415 end
|
bsw@1045
|
416 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
417 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
418 ui.link {
|
bsw@1045
|
419 module = "issue", view = "show", id = issue.id,
|
bsw@1045
|
420 content = _"take a look at the competing initiatives"
|
bsw@1045
|
421 }
|
bsw@1045
|
422 end }
|
bsw@1045
|
423 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
424 ui.link {
|
bsw@1045
|
425 module = "initiative", view = "new",
|
bsw@1045
|
426 params = { issue_id = issue.id },
|
bsw@1045
|
427 content = _"start a new competing initiative"
|
bsw@1045
|
428 }
|
bsw@1045
|
429 end }
|
bsw@1045
|
430 end }
|
bsw@1045
|
431 end )
|
bsw@1045
|
432 end
|
bsw@1045
|
433
|
bsw@1138
|
434 end
|
bsw@1138
|
435
|
bsw@1138
|
436 if privileged_to_vote and not issue.closed then
|
bsw@1138
|
437
|
bsw@1045
|
438 if not issue.member_info.first_trustee_id then
|
bsw@1045
|
439 ui.sidebarSection( function ()
|
bsw@1045
|
440 ui.heading{ level = 3, content = _"I want to delegate this issue" }
|
bsw@1045
|
441
|
bsw@1045
|
442 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
443 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
444 ui.link {
|
bsw@1045
|
445 module = "delegation", view = "show", params = {
|
bsw@1045
|
446 issue_id = issue.id,
|
bsw@1045
|
447 initiative_id = initiative and initiative.id or nil
|
bsw@1045
|
448 },
|
bsw@1045
|
449 content = _"choose issue delegatee"
|
bsw@1045
|
450 }
|
bsw@1045
|
451 end }
|
bsw@1045
|
452 end }
|
bsw@1045
|
453 end )
|
bsw@1045
|
454 end
|
bsw@1045
|
455
|
bsw@1045
|
456 end
|
bsw@1045
|
457
|
bsw@1045
|
458 if initiator and initiator.accepted == false then
|
bsw@1045
|
459 ui.container { attr = { class = "sidebarRow" }, content = function ()
|
bsw@1045
|
460 ui.heading { level = 3, content = function()
|
bsw@1045
|
461 ui.tag { content = _"You refused to become initiator of this initiative" }
|
bsw@1045
|
462 end }
|
bsw@1045
|
463 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
464 ui.tag{ tag = "li", content = function ()
|
bsw@1045
|
465 ui.link{
|
bsw@1045
|
466 text = _"allow invitation again",
|
bsw@1045
|
467 module = "initiative",
|
bsw@1045
|
468 action = "remove_initiator",
|
bsw@1045
|
469 params = {
|
bsw@1045
|
470 initiative_id = initiative.id,
|
bsw@1045
|
471 member_id = app.session.member.id
|
bsw@1045
|
472 },
|
bsw@1045
|
473 routing = {
|
bsw@1045
|
474 ok = {
|
bsw@1045
|
475 mode = "redirect",
|
bsw@1045
|
476 module = "initiative",
|
bsw@1045
|
477 view = "show",
|
bsw@1045
|
478 id = initiative.id
|
bsw@1045
|
479 }
|
bsw@1045
|
480 }
|
bsw@1045
|
481 }
|
bsw@1045
|
482 end }
|
bsw@1045
|
483 end }
|
bsw@1045
|
484 end }
|
bsw@1045
|
485 end
|
bsw@1045
|
486
|
bsw@1045
|
487
|
bsw@1045
|
488
|
bsw@1045
|
489 if privileged_to_vote then
|
bsw@1045
|
490
|
bsw@1045
|
491 if initiative and
|
bsw@1045
|
492 (issue.state == "admission" or
|
bsw@1045
|
493 issue.state == "discussion" or
|
bsw@1045
|
494 issue.state == "verification")
|
bsw@1045
|
495 then
|
bsw@1045
|
496
|
bsw@1045
|
497 elseif issue.state == "verification" then
|
bsw@1045
|
498
|
bsw@1045
|
499 elseif issue.state == "voting" then
|
bsw@1045
|
500 if not issue.member_info.direct_voted then
|
bsw@1045
|
501 if not issue.member_info.non_voter then
|
bsw@1045
|
502 ui.container { attr = { class = "sidebarRow" }, content = function ()
|
bsw@1045
|
503 ui.heading { level = 3, content = _"I like to vote on this issue:" }
|
bsw@1045
|
504 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
505 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
506 ui.tag { content = function ()
|
bsw@1045
|
507 if not issue.closed then
|
bsw@1045
|
508 ui.link {
|
bsw@1045
|
509 xattr = { class = "btn btn-vote" },
|
bsw@1045
|
510 module = "vote", view = "list",
|
bsw@1045
|
511 params = { issue_id = issue.id },
|
bsw@1045
|
512 text = _"vote now"
|
bsw@1045
|
513 }
|
bsw@1045
|
514 end
|
bsw@1045
|
515 end }
|
bsw@1045
|
516 end }
|
bsw@1045
|
517 end }
|
bsw@1045
|
518 end }
|
bsw@1045
|
519 end
|
bsw@1045
|
520 ui.container { attr = { class = "sidebarRow" }, content = function ()
|
bsw@1045
|
521 if not issue.member_info.non_voter then
|
bsw@1045
|
522 ui.heading { level = 3, content = _"I don't like to vote this issue (myself):" }
|
bsw@1045
|
523 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
524 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
525 ui.link{
|
bsw@1045
|
526 content = _"do not notify me about this voting anymore",
|
bsw@1045
|
527 module = "vote",
|
bsw@1045
|
528 action = "non_voter",
|
bsw@1045
|
529 params = { issue_id = issue.id },
|
bsw@1045
|
530 routing = {
|
bsw@1045
|
531 default = {
|
bsw@1045
|
532 mode = "redirect",
|
bsw@1045
|
533 module = request.get_module(),
|
bsw@1045
|
534 view = request.get_view(),
|
bsw@1145
|
535 id = request.get_id_string(),
|
bsw@1145
|
536 params = request.get_param_strings()
|
bsw@1045
|
537 }
|
bsw@1045
|
538 }
|
bsw@1045
|
539 }
|
bsw@1045
|
540 end }
|
bsw@1045
|
541 end }
|
bsw@1045
|
542 else
|
bsw@1045
|
543 ui.heading { level = 3, content = _"You do not like to vote this issue (yourself)" }
|
bsw@1045
|
544 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
545 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
546 ui.link{
|
bsw@1045
|
547 in_brackets = true,
|
bsw@1045
|
548 content = _"discard",
|
bsw@1045
|
549 module = "vote",
|
bsw@1045
|
550 action = "non_voter",
|
bsw@1045
|
551 params = { issue_id = issue.id, delete = true },
|
bsw@1045
|
552 routing = {
|
bsw@1045
|
553 default = {
|
bsw@1045
|
554 mode = "redirect",
|
bsw@1045
|
555 module = request.get_module(),
|
bsw@1045
|
556 view = request.get_view(),
|
bsw@1145
|
557 id = request.get_id_string(),
|
bsw@1145
|
558 params = request.get_param_strings()
|
bsw@1045
|
559 }
|
bsw@1045
|
560 }
|
bsw@1045
|
561 }
|
bsw@1045
|
562 end }
|
bsw@1045
|
563 end }
|
bsw@1045
|
564 end
|
bsw@1045
|
565 end }
|
bsw@1045
|
566 else
|
bsw@1045
|
567 ui.container { attr = { class = "sidebarRow" }, content = function ()
|
bsw@1045
|
568 ui.heading { level = 3, content = _"I like to change/revoke my vote:" }
|
bsw@1045
|
569 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
570 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
571 ui.tag { content = function ()
|
bsw@1045
|
572 if not issue.closed then
|
bsw@1045
|
573 ui.link {
|
bsw@1045
|
574 xattr = { class = "btn btn-vote" },
|
bsw@1045
|
575 module = "vote", view = "list",
|
bsw@1045
|
576 params = { issue_id = issue.id },
|
bsw@1045
|
577 text = _"change my vote"
|
bsw@1045
|
578 }
|
bsw@1045
|
579 end
|
bsw@1045
|
580 end }
|
bsw@1045
|
581 end }
|
bsw@1045
|
582 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
583 ui.tag { content = function ()
|
bsw@1045
|
584 if not issue.closed then
|
bsw@1045
|
585 ui.link {
|
bsw@1045
|
586 module = "vote", action = "update",
|
bsw@1045
|
587 params = {
|
bsw@1045
|
588 issue_id = issue.id,
|
bsw@1045
|
589 discard = true
|
bsw@1045
|
590 },
|
bsw@1045
|
591 routing = {
|
bsw@1045
|
592 default = {
|
bsw@1045
|
593 mode = "redirect",
|
bsw@1045
|
594 module = "issue",
|
bsw@1045
|
595 view = "show",
|
bsw@1045
|
596 id = issue.id
|
bsw@1045
|
597 }
|
bsw@1045
|
598 },
|
bsw@1045
|
599 text = _"discard my vote"
|
bsw@1045
|
600 }
|
bsw@1045
|
601 end
|
bsw@1045
|
602 end }
|
bsw@1045
|
603 end }
|
bsw@1045
|
604 end }
|
bsw@1045
|
605
|
bsw@1045
|
606 end }
|
bsw@1045
|
607
|
bsw@1045
|
608 end
|
bsw@1045
|
609 end
|
bsw@1045
|
610 end
|
bsw@1045
|
611
|
bsw@1045
|
612 if app.session.member and not privileged_to_vote then
|
bsw@1045
|
613 ui.sidebarSection( _"You are not entitled to vote in this unit" )
|
bsw@1045
|
614 end
|
bsw@1045
|
615
|
bsw@1045
|
616 if issue.closed then
|
bsw@1045
|
617 ui.container { attr = { class = "sidebarRow" }, content = function ()
|
bsw@1045
|
618 ui.heading { level = 3, content = _"This issue is closed" }
|
bsw@1045
|
619 end }
|
bsw@1045
|
620 end
|
bsw@1045
|
621
|
bsw@1045
|
622 if initiative and config.tell_others and config.tell_others.initiative then
|
bsw@1045
|
623 ui.container { attr = { class = "sidebarRow" }, content = function ()
|
bsw@1045
|
624
|
bsw@1045
|
625 ui.heading { level = 3, content = _"Tell others about this initiative:" }
|
bsw@1045
|
626 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
|
bsw@1045
|
627
|
bsw@1045
|
628 for i, link in ipairs (config.tell_others.initiative(initiative)) do
|
bsw@1045
|
629 ui.tag { tag = "li", content = function ()
|
bsw@1045
|
630 ui.link ( link )
|
bsw@1045
|
631 end }
|
bsw@1045
|
632 end
|
bsw@1045
|
633
|
bsw@1045
|
634 end }
|
bsw@1045
|
635 end }
|
bsw@1045
|
636 end
|
bsw@1045
|
637
|
bsw@1045
|
638
|
bsw@1045
|
639 end )
|