liquid_feedback_frontend

annotate app/main/initiative/_list.lua @ 1755:9043f24d872b

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

Impressum / About Us