liquid_feedback_frontend
view app/main/initiative/_list.lua @ 1532:3c15fea3f1c0
Added FirstLife group mirroring
author | bsw |
---|---|
date | Sun Oct 04 16:31:47 2020 +0200 (2020-10-04) |
parents | 32cc544d5a5b |
children | f582e3d6434c |
line source
1 local for_member = param.get("for_member", "table")
3 local initiatives = param.get("initiatives", "table")
4 local ommit_initiative_id = param.get ( "ommit_initiative_id", "number" )
7 local for_initiative = param.get("initiative", "table")
9 local for_event = param.get("for_event", atom.boolean)
11 if for_initiative then
12 initiatives = { for_initiative }
13 end
15 ui.tag {
16 tag = "ul",
17 attr = { class = "initiatives mdl-list" },
18 content = function ()
19 local last_group
20 for i, initiative in ipairs(initiatives) do
21 local group
22 if initiative.issue.closed then
23 if initiative.rank == 1 then
24 group = "1st_rank"
25 elseif initiative.admitted then
26 group = "admitted"
27 elseif initiative.revoked_by_member_id then
28 group = "revoked"
29 else
30 group = "not_admitted"
31 end
32 end
33 if not for_initiative and group ~= last_group and not for_event and not for_member then
35 local text
36 if group == "admitted" then
37 if initiative.issue.state == "finished_with_winner" then
38 text = _"Competing initiatives in pairwise comparison to winner:"
39 elseif initiative.issue.voter_count and initiative.issue.voter_count > 0 then
40 text = _"Competing initiatives in pairwise comparison to best initiative:"
41 end
42 end
43 if group == "not_admitted" and initiative.issue.state ~= "canceled_no_initiative_admitted" then
44 text = _("Competing initiatives failed the 2nd quorum (#{num}/#{den}):", {
45 num = initiative.issue.policy.initiative_quorum_num,
46 den = initiative.issue.policy.initiative_quorum_den
47 } )
48 end
49 if text then
50 ui.tag{ tag = "li", attr = { class = "mdl-list__item" }, content = function()
51 ui.container{ attr = { class = "mdl-list__item-primary-content" }, content = text }
52 end }
53 end
54 last_group = group
55 end
57 if ommit_initiative_id ~= initiative.id then
58 local class = "mdl-list__item mdl-list__item--three-line"
59 if app.session.member then
60 if initiative.member_info.supported then
61 class = class .. " supported"
62 end
63 if initiative.member_info.satisfied then
64 class = class .. " satisfied"
65 end
66 end
67 ui.tag {
68 tag = "li", attr = { class = class },
69 content = function ()
70 if i == 1 and not ommit_initiative_id and not for_member and (
71 initiative.issue.state == "finished_with_winner"
72 or initiative.issue.state == "finished_without_winner"
73 ) then
74 util.initiative_pie(initiative)
75 end
76 execute.view {
77 module = "initiative", view = "_list_element", params = {
78 initiative = initiative, for_event = for_event, for_member = for_member
79 }
80 }
81 end
82 }
83 end
84 end
85 end
86 }