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