rev |
line source |
bsw@725
|
1 local initiative = param.get("initiative", "table")
|
bsw@725
|
2
|
bsw@725
|
3 local show_as_head = param.get("show_as_head", atom.boolean)
|
bsw@725
|
4
|
bsw@725
|
5 initiative:load_everything_for_member_id(app.session.member_id)
|
bsw@725
|
6
|
bsw@725
|
7 local issue = initiative.issue
|
bsw@725
|
8
|
bsw@725
|
9 -- TODO performance
|
bsw@725
|
10 local initiator
|
bsw@725
|
11 if app.session.member_id then
|
bsw@725
|
12 initiator = Initiator:by_pk(initiative.id, app.session.member.id)
|
bsw@725
|
13 end
|
bsw@725
|
14
|
bsw@725
|
15 if app.session.member_id then
|
bsw@725
|
16 issue:load_everything_for_member_id(app.session.member_id)
|
bsw@725
|
17 end
|
bsw@725
|
18
|
bsw@725
|
19 app.html_title.title = initiative.name
|
bsw@725
|
20 app.html_title.subtitle = _("Initiative ##{id}", { id = initiative.id })
|
bsw@725
|
21
|
bsw@725
|
22 slot.select("head", function()
|
bsw@725
|
23 execute.view{
|
bsw@725
|
24 module = "issue", view = "_head",
|
bsw@725
|
25 params = { issue = issue, initiative = initiative }
|
bsw@725
|
26 }
|
bsw@725
|
27 end)
|
bsw@725
|
28
|
bsw@725
|
29 local initiators_members_selector = initiative:get_reference_selector("initiating_members")
|
bsw@725
|
30 :add_field("initiator.accepted", "accepted")
|
bsw@725
|
31 :add_order_by("member.name")
|
bsw@725
|
32 if initiator and initiator.accepted then
|
bsw@725
|
33 initiators_members_selector:add_where("initiator.accepted ISNULL OR initiator.accepted")
|
bsw@725
|
34 else
|
bsw@725
|
35 initiators_members_selector:add_where("initiator.accepted")
|
bsw@725
|
36 end
|
bsw@725
|
37
|
bsw@725
|
38 local initiators = initiators_members_selector:exec()
|
bsw@725
|
39
|
bsw@725
|
40
|
bsw@725
|
41 local initiatives_selector = initiative.issue:get_reference_selector("initiatives")
|
bsw@725
|
42 slot.select("head", function()
|
bsw@725
|
43 execute.view{
|
bsw@725
|
44 module = "issue",
|
bsw@725
|
45 view = "_show",
|
bsw@725
|
46 params = {
|
bsw@725
|
47 issue = initiative.issue,
|
bsw@725
|
48 initiative_limit = 3,
|
bsw@725
|
49 for_initiative = initiative
|
bsw@725
|
50 }
|
bsw@725
|
51 }
|
bsw@725
|
52 end)
|
bsw@725
|
53
|
bsw@725
|
54 util.help("initiative.show")
|
bsw@725
|
55
|
bsw@898
|
56 local class = "initiative_head"
|
bsw@898
|
57
|
bsw@898
|
58 if initiative.polling then
|
bsw@898
|
59 class = class .. " polling"
|
bsw@898
|
60 end
|
bsw@898
|
61
|
bsw@898
|
62 ui.container{ attr = { class = class }, content = function()
|
bsw@725
|
63
|
bsw@725
|
64 local text = _("Initiative i#{id}: #{name}", { id = initiative.id, name = initiative.name })
|
bsw@725
|
65 if show_as_head then
|
bsw@725
|
66 ui.link{
|
bsw@725
|
67 attr = { class = "title" }, text = text,
|
bsw@725
|
68 module = "initiative", view = "show", id = initiative.id
|
bsw@725
|
69 }
|
bsw@725
|
70 else
|
bsw@725
|
71 ui.container{ attr = { class = "title" }, content = text }
|
bsw@725
|
72 end
|
bsw@813
|
73 if app.session:has_access("authors_pseudonymous") then
|
bsw@727
|
74 ui.container{ attr = { class = "content" }, content = function()
|
bsw@725
|
75 ui.tag{
|
bsw@725
|
76 attr = { class = "initiator_names" },
|
bsw@725
|
77 content = function()
|
bsw@725
|
78 for i, initiator in ipairs(initiators) do
|
bsw@725
|
79 slot.put(" ")
|
bsw@813
|
80 if app.session:has_access("all_pseudonymous") then
|
bsw@725
|
81 ui.link{
|
bsw@725
|
82 content = function ()
|
bsw@725
|
83 execute.view{
|
bsw@725
|
84 module = "member_image",
|
bsw@725
|
85 view = "_show",
|
bsw@725
|
86 params = {
|
bsw@725
|
87 member = initiator,
|
bsw@725
|
88 image_type = "avatar",
|
bsw@725
|
89 show_dummy = true,
|
bsw@725
|
90 class = "micro_avatar",
|
bsw@725
|
91 popup_text = text
|
bsw@725
|
92 }
|
bsw@725
|
93 }
|
bsw@725
|
94 end,
|
bsw@725
|
95 module = "member", view = "show", id = initiator.id
|
bsw@725
|
96 }
|
bsw@725
|
97 slot.put(" ")
|
bsw@725
|
98 end
|
bsw@725
|
99 ui.link{
|
bsw@725
|
100 text = initiator.name,
|
bsw@725
|
101 module = "member", view = "show", id = initiator.id
|
bsw@725
|
102 }
|
bsw@725
|
103 if not initiator.accepted then
|
bsw@725
|
104 ui.tag{ attr = { title = _"Not accepted yet" }, content = "?" }
|
bsw@725
|
105 end
|
bsw@725
|
106 end
|
bsw@725
|
107 if initiator and initiator.accepted and not initiative.issue.fully_frozen and not initiative.issue.closed and not initiative.revoked then
|
bsw@725
|
108 slot.put(" · ")
|
bsw@725
|
109 ui.link{
|
bsw@725
|
110 attr = { class = "action" },
|
bsw@725
|
111 content = function()
|
bsw@725
|
112 slot.put(_"Invite initiator")
|
bsw@725
|
113 end,
|
bsw@725
|
114 module = "initiative",
|
bsw@725
|
115 view = "add_initiator",
|
bsw@725
|
116 params = { initiative_id = initiative.id }
|
bsw@725
|
117 }
|
bsw@725
|
118 if #initiators > 1 then
|
bsw@725
|
119 slot.put(" · ")
|
bsw@725
|
120 ui.link{
|
bsw@725
|
121 content = function()
|
bsw@725
|
122 slot.put(_"Remove initiator")
|
bsw@725
|
123 end,
|
bsw@725
|
124 module = "initiative",
|
bsw@725
|
125 view = "remove_initiator",
|
bsw@725
|
126 params = { initiative_id = initiative.id }
|
bsw@725
|
127 }
|
bsw@725
|
128 end
|
bsw@725
|
129 end
|
bsw@725
|
130 if initiator and initiator.accepted == false then
|
bsw@725
|
131 slot.put(" · ")
|
bsw@725
|
132 ui.link{
|
bsw@725
|
133 text = _"Cancel refuse of invitation",
|
bsw@725
|
134 module = "initiative",
|
bsw@725
|
135 action = "remove_initiator",
|
bsw@725
|
136 params = {
|
bsw@725
|
137 initiative_id = initiative.id,
|
bsw@725
|
138 member_id = app.session.member.id
|
bsw@725
|
139 },
|
bsw@725
|
140 routing = {
|
bsw@725
|
141 ok = {
|
bsw@725
|
142 mode = "redirect",
|
bsw@725
|
143 module = "initiative",
|
bsw@725
|
144 view = "show",
|
bsw@725
|
145 id = initiative.id
|
bsw@725
|
146 }
|
bsw@725
|
147 }
|
bsw@725
|
148 }
|
bsw@725
|
149 end
|
bsw@725
|
150 if (initiative.discussion_url and #initiative.discussion_url > 0) then
|
bsw@725
|
151 slot.put(" · ")
|
bsw@725
|
152 if initiative.discussion_url:find("^https?://") then
|
bsw@725
|
153 if initiative.discussion_url and #initiative.discussion_url > 0 then
|
bsw@725
|
154 ui.link{
|
bsw@725
|
155 attr = {
|
bsw@725
|
156 target = "_blank",
|
bsw@725
|
157 title = _"Discussion with initiators"
|
bsw@725
|
158 },
|
bsw@725
|
159 text = _"Discuss with initiators",
|
bsw@725
|
160 external = initiative.discussion_url
|
bsw@725
|
161 }
|
bsw@725
|
162 end
|
bsw@725
|
163 else
|
bsw@725
|
164 slot.put(encode.html(initiative.discussion_url))
|
bsw@725
|
165 end
|
bsw@725
|
166 end
|
bsw@725
|
167 if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
|
bsw@725
|
168 slot.put(" · ")
|
bsw@725
|
169 ui.link{
|
bsw@725
|
170 text = _"change discussion URL",
|
bsw@725
|
171 module = "initiative",
|
bsw@725
|
172 view = "edit",
|
bsw@725
|
173 id = initiative.id
|
bsw@725
|
174 }
|
bsw@725
|
175 slot.put(" ")
|
bsw@725
|
176 end
|
bsw@725
|
177 end
|
bsw@725
|
178 }
|
bsw@727
|
179 end }
|
bsw@727
|
180 end
|
bsw@725
|
181
|
bsw@727
|
182 if app.session.member_id then
|
bsw@727
|
183 ui.container{ attr = { class = "content" }, content = function()
|
bsw@725
|
184 execute.view{
|
bsw@725
|
185 module = "supporter",
|
bsw@725
|
186 view = "_show_box",
|
bsw@725
|
187 params = {
|
bsw@725
|
188 initiative = initiative
|
bsw@725
|
189 }
|
bsw@725
|
190 }
|
bsw@727
|
191 end }
|
bsw@727
|
192 end
|
bsw@725
|
193
|
bsw@725
|
194
|
bsw@725
|
195 -- voting results
|
bsw@975
|
196 if initiative.issue.fully_frozen and initiative.issue.closed and initiative.admitted then
|
bsw@725
|
197 local class = initiative.winner and "admitted_info" or "not_admitted_info"
|
bsw@725
|
198 ui.container{
|
bsw@725
|
199 attr = { class = class },
|
bsw@725
|
200 content = function()
|
bsw@725
|
201 local max_value = initiative.issue.voter_count
|
bsw@725
|
202 slot.put(" ")
|
bsw@725
|
203 local positive_votes = initiative.positive_votes
|
bsw@725
|
204 local negative_votes = initiative.negative_votes
|
bsw@725
|
205 local sum_votes = initiative.positive_votes + initiative.negative_votes
|
bsw@725
|
206 local function perc(votes, sum)
|
bsw@725
|
207 if sum > 0 and votes > 0 then return " (" .. string.format( "%.f", votes * 100 / sum ) .. "%)" end
|
bsw@725
|
208 return ""
|
bsw@725
|
209 end
|
bsw@725
|
210 slot.put(_"Yes" .. ": <b>" .. tostring(positive_votes) .. perc(positive_votes, sum_votes) .. "</b>")
|
bsw@725
|
211 slot.put(" · ")
|
bsw@725
|
212 slot.put(_"Abstention" .. ": <b>" .. tostring(max_value - initiative.negative_votes - initiative.positive_votes) .. "</b>")
|
bsw@725
|
213 slot.put(" · ")
|
bsw@725
|
214 slot.put(_"No" .. ": <b>" .. tostring(initiative.negative_votes) .. perc(negative_votes, sum_votes) .. "</b>")
|
bsw@725
|
215 slot.put(" · ")
|
bsw@725
|
216 slot.put("<b>")
|
bsw@725
|
217 if initiative.winner then
|
bsw@725
|
218 slot.put(_"Approved")
|
bsw@725
|
219 elseif initiative.rank then
|
bsw@725
|
220 slot.put(_("Not approved (rank #{rank})", { rank = initiative.rank }))
|
bsw@725
|
221 else
|
bsw@725
|
222 slot.put(_"Not approved")
|
bsw@725
|
223 end
|
bsw@725
|
224 slot.put("</b>")
|
bsw@725
|
225 end
|
bsw@725
|
226 }
|
bsw@725
|
227 end
|
bsw@725
|
228
|
bsw@725
|
229 ui.container{ attr = { class = "content" }, content = function()
|
bsw@725
|
230 execute.view{
|
bsw@725
|
231 module = "initiative",
|
bsw@725
|
232 view = "_battles",
|
bsw@725
|
233 params = { initiative = initiative }
|
bsw@725
|
234 }
|
bsw@725
|
235 end }
|
bsw@725
|
236
|
bsw@725
|
237 -- initiative not admitted info
|
bsw@725
|
238 if initiative.admitted == false then
|
bsw@725
|
239 local policy = initiative.issue.policy
|
bsw@725
|
240 ui.container{
|
bsw@725
|
241 attr = { class = "not_admitted_info" },
|
bsw@725
|
242 content = _("This initiative has not been admitted! It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den) })
|
bsw@725
|
243 }
|
bsw@725
|
244 end
|
bsw@725
|
245
|
bsw@725
|
246 -- initiative revoked info
|
bsw@725
|
247 if initiative.revoked then
|
bsw@725
|
248 ui.container{
|
bsw@725
|
249 attr = { class = "revoked_info" },
|
bsw@725
|
250 content = function()
|
bsw@725
|
251 slot.put(_("This initiative has been revoked at #{revoked}", { revoked = format.timestamp(initiative.revoked) }))
|
bsw@725
|
252 local suggested_initiative = initiative.suggested_initiative
|
bsw@725
|
253 if suggested_initiative then
|
bsw@725
|
254 slot.put("<br /><br />")
|
bsw@725
|
255 slot.put(_("The initiators suggest to support the following initiative:"))
|
bsw@725
|
256 slot.put(" ")
|
bsw@725
|
257 ui.link{
|
bsw@725
|
258 content = _("Issue ##{id}", { id = suggested_initiative.issue.id } ) .. ": " .. encode.html(suggested_initiative.name),
|
bsw@725
|
259 module = "initiative",
|
bsw@725
|
260 view = "show",
|
bsw@725
|
261 id = suggested_initiative.id
|
bsw@725
|
262 }
|
bsw@725
|
263 end
|
bsw@725
|
264 end
|
bsw@725
|
265 }
|
bsw@725
|
266 end
|
bsw@725
|
267
|
bsw@725
|
268
|
bsw@725
|
269 -- invited as initiator
|
bsw@725
|
270 if initiator and initiator.accepted == nil and not initiative.issue.half_frozen and not initiative.issue.closed then
|
bsw@725
|
271 ui.container{
|
bsw@725
|
272 attr = { class = "initiator_invite_info" },
|
bsw@725
|
273 content = function()
|
bsw@725
|
274 slot.put(_"You are invited to become initiator of this initiative.")
|
bsw@725
|
275 slot.put(" ")
|
bsw@725
|
276 ui.link{
|
bsw@725
|
277 image = { static = "icons/16/tick.png" },
|
bsw@725
|
278 text = _"Accept invitation",
|
bsw@725
|
279 module = "initiative",
|
bsw@725
|
280 action = "accept_invitation",
|
bsw@725
|
281 id = initiative.id,
|
bsw@725
|
282 routing = {
|
bsw@725
|
283 default = {
|
bsw@725
|
284 mode = "redirect",
|
bsw@725
|
285 module = request.get_module(),
|
bsw@725
|
286 view = request.get_view(),
|
bsw@725
|
287 id = param.get_id_cgi(),
|
bsw@725
|
288 params = param.get_all_cgi()
|
bsw@725
|
289 }
|
bsw@725
|
290 }
|
bsw@725
|
291 }
|
bsw@725
|
292 slot.put(" ")
|
bsw@725
|
293 ui.link{
|
bsw@725
|
294 image = { static = "icons/16/cross.png" },
|
bsw@725
|
295 text = _"Refuse invitation",
|
bsw@725
|
296 module = "initiative",
|
bsw@725
|
297 action = "reject_initiator_invitation",
|
bsw@725
|
298 params = {
|
bsw@725
|
299 initiative_id = initiative.id,
|
bsw@725
|
300 member_id = app.session.member.id
|
bsw@725
|
301 },
|
bsw@725
|
302 routing = {
|
bsw@725
|
303 default = {
|
bsw@725
|
304 mode = "redirect",
|
bsw@725
|
305 module = request.get_module(),
|
bsw@725
|
306 view = request.get_view(),
|
bsw@725
|
307 id = param.get_id_cgi(),
|
bsw@725
|
308 params = param.get_all_cgi()
|
bsw@725
|
309 }
|
bsw@725
|
310 }
|
bsw@725
|
311 }
|
bsw@725
|
312 end
|
bsw@725
|
313 }
|
bsw@725
|
314 end
|
bsw@725
|
315
|
bsw@725
|
316 -- draft updated
|
bsw@725
|
317 local supporter
|
bsw@725
|
318
|
bsw@725
|
319 if app.session.member_id then
|
bsw@725
|
320 supporter = app.session.member:get_reference_selector("supporters")
|
bsw@725
|
321 :add_where{ "initiative_id = ?", initiative.id }
|
bsw@725
|
322 :optional_object_mode()
|
bsw@725
|
323 :exec()
|
bsw@725
|
324 end
|
bsw@725
|
325
|
bsw@725
|
326 if supporter and not initiative.issue.closed then
|
bsw@725
|
327 local old_draft_id = supporter.draft_id
|
bsw@725
|
328 local new_draft_id = initiative.current_draft.id
|
bsw@725
|
329 if old_draft_id ~= new_draft_id then
|
bsw@725
|
330 ui.container{
|
bsw@725
|
331 attr = { class = "draft_updated_info" },
|
bsw@725
|
332 content = function()
|
bsw@725
|
333 slot.put(_"The draft of this initiative has been updated!")
|
bsw@725
|
334 slot.put(" ")
|
bsw@725
|
335 ui.link{
|
bsw@725
|
336 content = _"Show diff",
|
bsw@725
|
337 module = "draft",
|
bsw@725
|
338 view = "diff",
|
bsw@725
|
339 params = {
|
bsw@725
|
340 old_draft_id = old_draft_id,
|
bsw@725
|
341 new_draft_id = new_draft_id
|
bsw@725
|
342 }
|
bsw@725
|
343 }
|
bsw@725
|
344 if not initiative.revoked then
|
bsw@725
|
345 slot.put(" ")
|
bsw@725
|
346 ui.link{
|
bsw@725
|
347 text = _"Refresh support to current draft",
|
bsw@725
|
348 module = "initiative",
|
bsw@725
|
349 action = "add_support",
|
bsw@725
|
350 id = initiative.id,
|
bsw@725
|
351 routing = {
|
bsw@725
|
352 default = {
|
bsw@725
|
353 mode = "redirect",
|
bsw@725
|
354 module = "initiative",
|
bsw@725
|
355 view = "show",
|
bsw@725
|
356 id = initiative.id
|
bsw@725
|
357 }
|
bsw@725
|
358 }
|
bsw@725
|
359 }
|
bsw@725
|
360 end
|
bsw@725
|
361 end
|
bsw@725
|
362 }
|
bsw@725
|
363 end
|
bsw@725
|
364 end
|
bsw@725
|
365
|
bsw@725
|
366 if not show_as_head then
|
bsw@725
|
367 local drafts_count = initiative:get_reference_selector("drafts"):count()
|
bsw@725
|
368
|
bsw@725
|
369 ui.container{ attr = { class = "content" }, content = function()
|
bsw@725
|
370
|
bsw@725
|
371 if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
|
bsw@725
|
372 ui.link{
|
bsw@725
|
373 content = function()
|
bsw@725
|
374 slot.put(_"Edit draft")
|
bsw@725
|
375 end,
|
bsw@725
|
376 module = "draft",
|
bsw@725
|
377 view = "new",
|
bsw@725
|
378 params = { initiative_id = initiative.id }
|
bsw@725
|
379 }
|
bsw@725
|
380 slot.put(" · ")
|
bsw@725
|
381 ui.link{
|
bsw@725
|
382 content = function()
|
bsw@725
|
383 slot.put(_"Revoke initiative")
|
bsw@725
|
384 end,
|
bsw@725
|
385 module = "initiative",
|
bsw@725
|
386 view = "revoke",
|
bsw@725
|
387 id = initiative.id
|
bsw@725
|
388 }
|
bsw@725
|
389 slot.put(" · ")
|
bsw@725
|
390 end
|
bsw@725
|
391
|
bsw@725
|
392 ui.tag{
|
bsw@725
|
393 attr = { class = "draft_version" },
|
bsw@725
|
394 content = _("Latest draft created at #{date} #{time}", {
|
bsw@725
|
395 date = format.date(initiative.current_draft.created),
|
bsw@725
|
396 time = format.time(initiative.current_draft.created)
|
bsw@725
|
397 })
|
bsw@725
|
398 }
|
bsw@725
|
399 if drafts_count > 1 then
|
bsw@725
|
400 slot.put(" · ")
|
bsw@725
|
401 ui.link{
|
bsw@725
|
402 module = "draft", view = "list", params = { initiative_id = initiative.id },
|
bsw@725
|
403 text = _("List all revisions (#{count})", { count = drafts_count })
|
bsw@725
|
404 }
|
bsw@725
|
405 end
|
bsw@725
|
406 end }
|
bsw@725
|
407
|
bsw@725
|
408 execute.view{
|
bsw@725
|
409 module = "draft",
|
bsw@725
|
410 view = "_show",
|
bsw@725
|
411 params = {
|
bsw@725
|
412 draft = initiative.current_draft
|
bsw@725
|
413 }
|
bsw@725
|
414 }
|
bsw@725
|
415 end
|
bsw@725
|
416 end }
|
bsw@725
|
417
|
bsw@725
|
418 if not show_as_head then
|
bsw@725
|
419 execute.view{
|
bsw@725
|
420 module = "suggestion",
|
bsw@725
|
421 view = "_list",
|
bsw@725
|
422 params = {
|
bsw@725
|
423 initiative = initiative,
|
bsw@725
|
424 suggestions_selector = initiative:get_reference_selector("suggestions"),
|
bsw@725
|
425 tab_id = param.get("tab_id")
|
bsw@725
|
426 }
|
bsw@725
|
427 }
|
bsw@725
|
428
|
bsw@725
|
429
|
bsw@813
|
430 if app.session:has_access("all_pseudonymous") then
|
bsw@975
|
431 if initiative.issue.fully_frozen and initiative.issue.closed then
|
bsw@725
|
432 local members_selector = initiative.issue:get_reference_selector("direct_voters")
|
bsw@725
|
433 :left_join("vote", nil, { "vote.initiative_id = ? AND vote.member_id = member.id", initiative.id })
|
bsw@725
|
434 :add_field("direct_voter.weight as voter_weight")
|
bsw@725
|
435 :add_field("coalesce(vote.grade, 0) as grade")
|
bsw@879
|
436 :add_field("direct_voter.comment as voter_comment")
|
bsw@725
|
437 :left_join("initiative", nil, "initiative.id = vote.initiative_id")
|
bsw@725
|
438 :left_join("issue", nil, "issue.id = initiative.issue_id")
|
bsw@725
|
439
|
bsw@907
|
440 ui.anchor{ name = "voter", attr = { class = "heading" }, content = _"Voters" }
|
bsw@725
|
441
|
bsw@725
|
442 execute.view{
|
bsw@725
|
443 module = "member",
|
bsw@725
|
444 view = "_list",
|
bsw@725
|
445 params = {
|
bsw@725
|
446 initiative = initiative,
|
bsw@725
|
447 for_votes = true,
|
bsw@725
|
448 members_selector = members_selector,
|
bsw@725
|
449 paginator_name = "voter"
|
bsw@725
|
450 }
|
bsw@725
|
451 }
|
bsw@725
|
452 end
|
bsw@725
|
453
|
bsw@725
|
454 local members_selector = initiative:get_reference_selector("supporting_members_snapshot")
|
bsw@725
|
455 :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id")
|
bsw@725
|
456 :join("direct_interest_snapshot", nil, "direct_interest_snapshot.event = issue.latest_snapshot_event AND direct_interest_snapshot.issue_id = issue.id AND direct_interest_snapshot.member_id = member.id")
|
bsw@725
|
457 :add_field("direct_interest_snapshot.weight")
|
bsw@725
|
458 :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event")
|
bsw@725
|
459 :add_where("direct_supporter_snapshot.satisfied")
|
bsw@725
|
460 :add_field("direct_supporter_snapshot.informed", "is_informed")
|
bsw@725
|
461
|
bsw@725
|
462 if members_selector:count() > 0 then
|
bsw@725
|
463 if issue.fully_frozen then
|
bsw@725
|
464 ui.anchor{ name = "supporters", attr = { class = "heading" }, content = _"Supporters (before begin of voting)" }
|
bsw@725
|
465 else
|
bsw@725
|
466 ui.anchor{ name = "supporters", attr = { class = "heading" }, content = _"Supporters" }
|
bsw@725
|
467 end
|
bsw@725
|
468
|
bsw@725
|
469 execute.view{
|
bsw@725
|
470 module = "member",
|
bsw@725
|
471 view = "_list",
|
bsw@725
|
472 params = {
|
bsw@725
|
473 initiative = initiative,
|
bsw@725
|
474 members_selector = members_selector,
|
bsw@725
|
475 paginator_name = "supporters"
|
bsw@725
|
476 }
|
bsw@725
|
477 }
|
bsw@725
|
478 else
|
bsw@725
|
479 if issue.fully_frozen then
|
bsw@725
|
480 ui.anchor{ name = "supporters", attr = { class = "heading" }, content = _"No supporters (before begin of voting)" }
|
bsw@725
|
481 else
|
bsw@725
|
482 ui.anchor{ name = "supporters", attr = { class = "heading" }, content = _"No supporters" }
|
bsw@725
|
483 end
|
bsw@725
|
484 slot.put("<br />")
|
bsw@725
|
485 end
|
bsw@725
|
486
|
bsw@725
|
487 local members_selector = initiative:get_reference_selector("supporting_members_snapshot")
|
bsw@725
|
488 :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id")
|
bsw@725
|
489 :join("direct_interest_snapshot", nil, "direct_interest_snapshot.event = issue.latest_snapshot_event AND direct_interest_snapshot.issue_id = issue.id AND direct_interest_snapshot.member_id = member.id")
|
bsw@725
|
490 :add_field("direct_interest_snapshot.weight")
|
bsw@725
|
491 :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event")
|
bsw@725
|
492 :add_where("NOT direct_supporter_snapshot.satisfied")
|
bsw@725
|
493 :add_field("direct_supporter_snapshot.informed", "is_informed")
|
bsw@725
|
494
|
bsw@725
|
495 if members_selector:count() > 0 then
|
bsw@725
|
496 if issue.fully_frozen then
|
bsw@725
|
497 ui.anchor{ name = "potential_supporters", attr = { class = "heading" }, content = _"Potential supporters (before begin of voting)" }
|
bsw@725
|
498 else
|
bsw@725
|
499 ui.anchor{ name = "potential_supporters", attr = { class = "heading" }, content = _"Potential supporters" }
|
bsw@725
|
500 end
|
bsw@725
|
501
|
bsw@725
|
502 execute.view{
|
bsw@725
|
503 module = "member",
|
bsw@725
|
504 view = "_list",
|
bsw@725
|
505 params = {
|
bsw@725
|
506 initiative = initiative,
|
bsw@725
|
507 members_selector = members_selector,
|
bsw@725
|
508 paginator_name = "potential_supporters"
|
bsw@725
|
509 }
|
bsw@725
|
510 }
|
bsw@725
|
511 else
|
bsw@725
|
512 if issue.fully_frozen then
|
bsw@725
|
513 ui.anchor{ name = "potential_supporters", attr = { class = "heading" }, content = _"No potential supporters (before begin of voting)" }
|
bsw@725
|
514 else
|
bsw@725
|
515 ui.anchor{ name = "potential_supporters", attr = { class = "heading" }, content = _"No potential supporters" }
|
bsw@725
|
516 end
|
bsw@725
|
517 slot.put("<br />")
|
bsw@725
|
518 end
|
bsw@725
|
519
|
bsw@725
|
520 ui.container{ attr = { class = "heading" }, content = _"Details" }
|
bsw@725
|
521 execute.view {
|
bsw@725
|
522 module = "initiative",
|
bsw@725
|
523 view = "_details",
|
bsw@725
|
524 params = {
|
bsw@725
|
525 initiative = initiative,
|
bsw@725
|
526 members_selector = members_selector
|
bsw@725
|
527 }
|
bsw@725
|
528 }
|
bsw@725
|
529
|
bsw@725
|
530 end
|
bsw@725
|
531 end |