liquid_feedback_frontend

annotate app/main/initiative/_sidebar_state.lua @ 1055:9817055e792b

Changed not displayed public to not public, translation
author bsw
date Tue Jul 15 22:03:39 2014 +0200 (2014-07-15)
parents ba47b1e9ab00
children 7e48d429389f
rev   line source
bsw@1045 1 local initiative = param.get("initiative", "table")
bsw@1045 2
bsw@1045 3
bsw@1045 4 -- voting results
bsw@1045 5 if initiative.issue.fully_frozen and initiative.issue.closed and initiative.admitted
bsw@1045 6 and initiative.issue.voter_count then
bsw@1045 7 local class = initiative.winner and "sectionRow admitted_info" or "sectionRow not_admitted_info"
bsw@1045 8 ui.container{
bsw@1045 9 attr = { class = class },
bsw@1045 10 content = function()
bsw@1045 11 local max_value = initiative.issue.voter_count
bsw@1045 12 local positive_votes = initiative.positive_votes
bsw@1045 13 local negative_votes = initiative.negative_votes
bsw@1045 14 local abstention_votes = max_value -
bsw@1045 15 negative_votes -
bsw@1045 16 positive_votes
bsw@1045 17 local function perc(votes, sum)
bsw@1045 18 if sum > 0 then return string.format( "%.f", votes * 100 / sum ) .. "%" end
bsw@1045 19 return ""
bsw@1045 20 end
bsw@1045 21 local head_text
bsw@1045 22 if initiative.winner then
bsw@1045 23 head_text = _"Approved"
bsw@1045 24 elseif initiative.rank then
bsw@1045 25 head_text = _("Rejected (rank #{rank})", { rank = initiative.rank })
bsw@1045 26 else
bsw@1045 27 head_text = _"Rejected"
bsw@1045 28 end
bsw@1045 29
bsw@1045 30 util.initiative_pie( initiative )
bsw@1045 31
bsw@1045 32 ui.heading { level = 1, content = head_text }
bsw@1045 33
bsw@1045 34 ui.tag { tag = "table", content = function ()
bsw@1045 35 ui.tag { tag = "tr", attr = { class = "yes" }, content = function ()
bsw@1045 36 ui.tag { tag = "td", content =
bsw@1045 37 tostring(positive_votes)
bsw@1045 38 }
bsw@1045 39 ui.tag { tag = "th", content = _"Yes" }
bsw@1045 40 ui.tag { tag = "td", content =
bsw@1045 41 perc(positive_votes, max_value)
bsw@1045 42 }
bsw@1045 43 ui.tag { tag = "th", content = _"Yes" }
bsw@1045 44 end }
bsw@1045 45 ui.tag { tag = "tr", attr = { class = "abstention" }, content = function ()
bsw@1045 46 ui.tag { tag = "td", content =
bsw@1045 47 tostring(abstention_votes)
bsw@1045 48 }
bsw@1045 49 ui.tag { tag = "th", content = _"Abstention" }
bsw@1045 50 ui.tag { tag = "td", content =
bsw@1045 51 perc(abstention_votes, max_value)
bsw@1045 52 }
bsw@1045 53 ui.tag { tag = "th", content = _"Abstention" }
bsw@1045 54 end }
bsw@1045 55 ui.tag { tag = "tr", attr = { class = "no" }, content = function ()
bsw@1045 56 ui.tag { tag = "td", content =
bsw@1045 57 tostring(negative_votes)
bsw@1045 58 }
bsw@1045 59 ui.tag { tag = "th", content = _"No" }
bsw@1045 60 ui.tag { tag = "td", content =
bsw@1045 61 perc(negative_votes, max_value)
bsw@1045 62 }
bsw@1045 63 ui.tag { tag = "th", content = _"No" }
bsw@1045 64 end }
bsw@1045 65 end }
bsw@1045 66 end
bsw@1045 67 }
bsw@1045 68 end
bsw@1045 69
bsw@1045 70 -- initiative not admitted info
bsw@1045 71 if initiative.admitted == false then
bsw@1045 72 local policy = initiative.issue.policy
bsw@1045 73 ui.container{
bsw@1045 74 attr = { class = "sectionRow not_admitted_info" },
bsw@1045 75 content = function ()
bsw@1045 76 ui.heading { level = 1, content = _"Initiative not admitted" }
bsw@1045 77 ui.container { content = _("This initiative has not been admitted! It failed the 2nd quorum of #{quorum}.", { quorum = format.percentage ( policy.initiative_quorum_num / policy.initiative_quorum_den ) } ) }
bsw@1045 78 end
bsw@1045 79 }
bsw@1045 80 end
bsw@1045 81
bsw@1045 82 -- initiative revoked info
bsw@1045 83 if initiative.revoked then
bsw@1045 84 ui.container{
bsw@1045 85 attr = { class = "sectionRow revoked_info" },
bsw@1045 86 content = function()
bsw@1045 87 ui.heading { level = 1, content = _"Initiative revoked" }
bsw@1045 88 slot.put(_("This initiative has been revoked at #{revoked} by:", {
bsw@1045 89 revoked = format.timestamp(initiative.revoked)
bsw@1045 90 }))
bsw@1045 91 slot.put(" ")
bsw@1053 92 if app.session:has_access("authors_pseudonymous") then
bsw@1053 93 ui.link{
bsw@1053 94 module = "member", view = "show", id = initiative.revoked_by_member_id,
bsw@1053 95 content = initiative.revoked_by_member.name
bsw@1053 96 }
bsw@1053 97 else
bsw@1055 98 ui.tag{ content = _"[Not public]" }
bsw@1053 99 end
bsw@1045 100 local suggested_initiative = initiative.suggested_initiative
bsw@1045 101 if suggested_initiative then
bsw@1045 102 slot.put("<br /><br />")
bsw@1045 103 slot.put(_("The initiators suggest to support the following initiative:"))
bsw@1045 104 slot.put("<br />")
bsw@1045 105 ui.link{
bsw@1045 106 content = suggested_initiative.display_name,
bsw@1045 107 module = "initiative",
bsw@1045 108 view = "show",
bsw@1045 109 id = suggested_initiative.id
bsw@1045 110 }
bsw@1045 111 end
bsw@1045 112 end
bsw@1045 113 }
bsw@1045 114 end
bsw@1045 115

Impressum / About Us