bsw@1045: local initiative = param.get("initiative", "table")
bsw@1045:
bsw@1045:
bsw@1045: -- voting results
bsw@1045: if initiative.issue.fully_frozen and initiative.issue.closed and initiative.admitted
bsw@1045: and initiative.issue.voter_count then
bsw@1612: local class = initiative.winner and "mdl-card__content mdl-card--border admitted_info" or "mdl-card__content mdl-card--border not_admitted_info"
bsw@1045: ui.container{
bsw@1045: attr = { class = class },
bsw@1045: content = function()
bsw@1045: local max_value = initiative.issue.voter_count
bsw@1045: local positive_votes = initiative.positive_votes
bsw@1045: local negative_votes = initiative.negative_votes
bsw@1045: local abstention_votes = max_value -
bsw@1045: negative_votes -
bsw@1045: positive_votes
bsw@1045: local head_text
bsw/jbe@1309:
bsw/jbe@1309: util.initiative_pie( initiative )
bsw/jbe@1309:
bsw@1045: if initiative.winner then
bsw@1045: head_text = _"Approved"
bsw@1045: elseif initiative.rank then
bsw@1045: head_text = _("Rejected (rank #{rank})", { rank = initiative.rank })
bsw@1045: else
bsw@1045: head_text = _"Rejected"
bsw@1045: end
bsw@1045:
bsw@1045: ui.heading { level = 1, content = head_text }
bsw@1045:
bsw@1045: ui.tag { tag = "table", content = function ()
bsw@1045: ui.tag { tag = "tr", attr = { class = "yes" }, content = function ()
bsw@1045: ui.tag { tag = "td", content =
bsw@1045: tostring(positive_votes)
bsw@1045: }
bsw@1045: ui.tag { tag = "th", content = _"Yes" }
bsw@1045: ui.tag { tag = "td", content =
bsw@1210: format.percent_floor(positive_votes, max_value)
bsw@1045: }
bsw@1045: ui.tag { tag = "th", content = _"Yes" }
bsw@1045: end }
bsw/jbe@1309: ui.tag { tag = "tr", attr = { class = "no" }, content = function ()
bsw/jbe@1309: ui.tag { tag = "td", content =
bsw/jbe@1309: tostring(negative_votes)
bsw/jbe@1309: }
bsw/jbe@1309: ui.tag { tag = "th", content = _"No" }
bsw/jbe@1309: ui.tag { tag = "td", content =
bsw/jbe@1309: format.percent_floor(negative_votes, max_value)
bsw/jbe@1309: }
bsw/jbe@1309: ui.tag { tag = "th", content = _"No" }
bsw/jbe@1309: end }
bsw@1045: ui.tag { tag = "tr", attr = { class = "abstention" }, content = function ()
bsw@1045: ui.tag { tag = "td", content =
bsw@1045: tostring(abstention_votes)
bsw@1045: }
bsw@1045: ui.tag { tag = "th", content = _"Abstention" }
bsw@1045: ui.tag { tag = "td", content =
bsw@1210: format.percent_floor(abstention_votes, max_value)
bsw@1045: }
bsw@1045: ui.tag { tag = "th", content = _"Abstention" }
bsw@1045: end }
bsw@1045: end }
bsw@1045: end
bsw@1045: }
bsw@1045: end
bsw@1045:
bsw@1045: -- initiative not admitted info
bsw@1045: if initiative.admitted == false then
bsw@1045: local policy = initiative.issue.policy
bsw@1045: ui.container{
bsw@1566: attr = { class = "draft mdl-card__content mdl-card--border" },
bsw@1045: content = function ()
bsw@1045: ui.heading { level = 1, content = _"Initiative not admitted" }
bsw@1482: local num = policy.initiative_quorum_num
bsw@1482: local den = policy.initiative_quorum_den
bsw@1482: local quorums = {}
bsw@1482: if num and num > 0 and den == 100 or den == 10 then
bsw@1482: table.insert(quorums, _("#{percentage}%", { percentage = num * 100 / den }))
bsw@1482: elseif num and num > 0 and den and den > 0 then
bsw@1482: table.insert(quorums, num .. "/" .. den)
bsw@1482: end
bsw@1482: if policy.initiative_quorum then
bsw@1482: table.insert(quorums, policy.initiative_quorum)
bsw@1482: end
bsw@1482: local quorum = table.concat(quorums, " / ")
bsw@1482:
bsw@1482: ui.container { content = _("This initiative has not been admitted! It failed the 2nd quorum of #{quorum}.", { quorum = quorum } ) }
bsw@1045: end
bsw@1045: }
bsw@1045: end
bsw@1045:
bsw@1045: -- initiative revoked info
bsw@1045: if initiative.revoked then
bsw@1045: ui.container{
bsw@1566: attr = { class = "draft mdl-card__content mdl-card--border" },
bsw@1045: content = function()
bsw@1045: ui.heading { level = 1, content = _"Initiative revoked" }
bsw@1045: slot.put(_("This initiative has been revoked at #{revoked} by:", {
bsw@1045: revoked = format.timestamp(initiative.revoked)
bsw@1045: }))
bsw@1045: slot.put(" ")
bsw@1053: if app.session:has_access("authors_pseudonymous") then
bsw@1053: ui.link{
bsw@1053: module = "member", view = "show", id = initiative.revoked_by_member_id,
bsw@1053: content = initiative.revoked_by_member.name
bsw@1053: }
bsw@1053: else
bsw@1055: ui.tag{ content = _"[Not public]" }
bsw@1053: end
bsw@1045: local suggested_initiative = initiative.suggested_initiative
bsw@1045: if suggested_initiative then
bsw@1045: slot.put("
")
bsw@1045: slot.put(_("The initiators suggest to support the following initiative:"))
bsw@1045: slot.put("
")
bsw@1045: ui.link{
bsw@1045: content = suggested_initiative.display_name,
bsw@1045: module = "initiative",
bsw@1045: view = "show",
bsw@1045: id = suggested_initiative.id
bsw@1045: }
bsw@1045: end
bsw@1045: end
bsw@1045: }
bsw@1045: end
bsw/jbe@1309: