liquid_feedback_frontend

view app/main/initiative/_list.lua @ 1858:3d1f0464a3ea

Handle missing ldap.member.allowed function
author bsw
date Tue Sep 20 17:35:29 2022 +0200 (20 months ago)
parents 9043f24d872b
children
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_issue_not_accepted" then
44 text = _"Failed 1st quorum"
45 elseif group == "not_admitted" and initiative.issue.state ~= "canceled_no_initiative_admitted" then
46 text = _("Competing initiatives failed the 2nd quorum (#{num}/#{den}):", {
47 num = initiative.issue.policy.initiative_quorum_num,
48 den = initiative.issue.policy.initiative_quorum_den
49 } )
50 end
51 if text then
52 ui.tag{ tag = "li", attr = { class = "mdl-list__item" }, content = function()
53 ui.container{ attr = { class = "mdl-list__item-primary-content" }, content = text }
54 end }
55 end
56 last_group = group
57 end
59 if ommit_initiative_id ~= initiative.id then
60 local class = "mdl-list__item mdl-list__item--three-line"
61 if app.session.member then
62 if initiative.member_info.supported then
63 class = class .. " supported"
64 end
65 if initiative.member_info.satisfied then
66 class = class .. " satisfied"
67 end
68 end
69 local position
70 if not ommit_initiative_id then
71 position = i
72 end
73 ui.tag {
74 tag = "li", attr = { class = class },
75 content = function ()
76 execute.view {
77 module = "initiative", view = "_list_element", params = {
78 position = position,
79 initiative = initiative, for_event = for_event, for_member = for_member
80 }
81 }
82 end
83 }
84 end
85 end
86 end
87 }

Impressum / About Us