bsw@1045: local member = param.get("member", "table") or app.session.member bsw/jbe@0: bsw@1045: local initiatives = param.get("initiatives", "table") bsw@1045: local highlight_initiative_id = param.get ( "highlight_initiative_id", "number" ) bsw@285: bsw@1045: local for_initiative = param.get("initiative", "table") bsw/jbe@19: bsw@1045: local for_event = param.get("for_event", atom.boolean) bsw/jbe@19: bsw@1045: if for_initiative then bsw@1045: initiatives = { for_initiative } bsw@345: end bsw@345: bsw@1045: ui.tag { bsw@1045: tag = "ul", bsw@1045: attr = { class = "initiatives" }, bsw@1045: content = function () bsw@1045: local last_group bsw@1045: for i, initiative in ipairs(initiatives) do bsw@1045: local group bsw@1045: if initiative.issue.closed then bsw@1045: if initiative.rank == 1 then bsw@1045: group = "1st_rank" bsw@1045: elseif initiative.admitted then bsw@1045: group = "admitted" bsw@1045: elseif initiative.revoked_by_member_id then bsw@1045: group = "revoked" bsw@1045: else bsw@1045: group = "not_admitted" bsw@1045: end bsw@1045: end bsw@1045: if not for_initiative and group ~= last_group and not for_event then bsw/jbe@19: bsw@1045: local text bsw@1045: if group == "admitted" then bsw@1045: if initiative.issue.state == "finished_with_winner" then bsw@1045: text = _"Competing initiatives in pairwise comparison to winner:" bsw@1045: else bsw@1045: text = _"Competing initiatives in pairwise comparison to best initiative:" bsw@1045: end bsw@1045: end bsw@1045: if group == "not_admitted" then bsw@1045: text = _("Competing initiatives failed the 2nd quorum (#{num}/#{den}):", { bsw@1045: num = initiative.issue.policy.initiative_quorum_num, bsw@1045: den = initiative.issue.policy.initiative_quorum_den bsw@1045: } ) bsw@1045: end bsw@1045: if text then bsw@1045: slot.put("
") bsw@1045: ui.container { attr = { class = "result" }, content = text } bsw@1045: end bsw@1045: last_group = group bsw@1045: end bsw@1045: bsw@1045: local class = "" bsw@1045: if highlight_initiative_id == initiative.id then bsw@1045: class = "highlighted" bsw@1045: end bsw@1045: if app.session.member then bsw@1045: if initiative.member_info.supported then bsw@1045: class = class .. " supported" bsw@1045: end bsw@1045: if initiative.member_info.satisfied then bsw@1045: class = class .. " satisfied" bsw@1045: end bsw@1045: end bsw@1045: ui.tag { bsw@1045: tag = "li", attr = { class = class }, bsw@1045: content = function () bsw@1045: execute.view { bsw@1045: module = "initiative", view = "_list_element", params = { bsw@1045: initiative = initiative, for_event = for_event bsw@1045: } bsw@1045: } bsw@1045: end bsw@1045: } bsw@551: end bsw@1045: end bsw@1045: }