# HG changeset patch
# User bsw
# Date 1331893926 -3600
# Node ID 01cf3c50cbee42612e816c529ae24e1685a1a6e6
# Parent 00f6935c2c32b58a24950af057f4330fb7b0d358
Show (not)admitted notices in initiative head
diff -r 00f6935c2c32 -r 01cf3c50cbee app/main/initiative/_show.lua
--- a/app/main/initiative/_show.lua Thu Mar 15 21:03:57 2012 +0100
+++ b/app/main/initiative/_show.lua Fri Mar 16 11:32:06 2012 +0100
@@ -128,76 +128,78 @@
util.help("initiative.show")
+slot.select("initiative_head", function()
-if initiative.issue.ranks_available and initiative.admitted then
- local class = initiative.winner and "admitted_info" or "not_admitted_info"
- ui.container{
- attr = { class = class },
- content = function()
- local max_value = initiative.issue.voter_count
- slot.put(" ")
- local positive_votes = initiative.positive_votes
- local negative_votes = initiative.negative_votes
- local sum_votes = initiative.positive_votes + initiative.negative_votes
- local function perc(votes, sum)
- if sum > 0 and votes > 0 then return " (" .. string.format( "%.f", votes * 100 / sum ) .. "%)" end
- return ""
+ if initiative.issue.ranks_available and initiative.admitted then
+ local class = initiative.winner and "admitted_info" or "not_admitted_info"
+ ui.container{
+ attr = { class = class },
+ content = function()
+ local max_value = initiative.issue.voter_count
+ slot.put(" ")
+ local positive_votes = initiative.positive_votes
+ local negative_votes = initiative.negative_votes
+ local sum_votes = initiative.positive_votes + initiative.negative_votes
+ local function perc(votes, sum)
+ if sum > 0 and votes > 0 then return " (" .. string.format( "%.f", votes * 100 / sum ) .. "%)" end
+ return ""
+ end
+ slot.put(_"Yes" .. ": " .. tostring(positive_votes) .. perc(positive_votes, sum_votes) .. "")
+ slot.put(" · ")
+ slot.put(_"Abstention" .. ": " .. tostring(max_value - initiative.negative_votes - initiative.positive_votes) .. "")
+ slot.put(" · ")
+ slot.put(_"No" .. ": " .. tostring(initiative.negative_votes) .. perc(negative_votes, sum_votes) .. "")
+ slot.put(" · ")
+ slot.put("")
+ if initiative.winner then
+ slot.put(_"Approved")
+ elseif initiative.rank then
+ slot.put(_("Not approved (rank #{rank})", { rank = initiative.rank }))
+ else
+ slot.put(_"Not approved")
+ end
+ slot.put("")
end
- slot.put(_"Yes" .. ": " .. tostring(positive_votes) .. perc(positive_votes, sum_votes) .. "")
- slot.put(" · ")
- slot.put(_"Abstention" .. ": " .. tostring(max_value - initiative.negative_votes - initiative.positive_votes) .. "")
- slot.put(" · ")
- slot.put(_"No" .. ": " .. tostring(initiative.negative_votes) .. perc(negative_votes, sum_votes) .. "")
- slot.put(" · ")
- slot.put("")
- if initiative.winner then
- slot.put(_"Approved")
- elseif initiative.rank then
- slot.put(_("Not approved (rank #{rank})", { rank = initiative.rank }))
- else
- slot.put(_"Not approved")
- end
- slot.put("")
- end
- }
-end
+ }
+ end
-if initiative.admitted == false then
- local policy = initiative.issue.policy
- ui.container{
- attr = { class = "not_admitted_info" },
- content = _("This initiative has not been admitted! It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den) })
- }
-end
-
-if initiative.issue.state == "cancelled" then
- local policy = initiative.issue.policy
- ui.container{
- attr = { class = "not_admitted_info" },
- content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) })
- }
-end
+ if initiative.admitted == false then
+ local policy = initiative.issue.policy
+ ui.container{
+ attr = { class = "not_admitted_info" },
+ content = _("This initiative has not been admitted! It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den) })
+ }
+ end
-if initiative.revoked then
- ui.container{
- attr = { class = "revoked_info" },
- content = function()
- slot.put(_("This initiative has been revoked at #{revoked}", { revoked = format.timestamp(initiative.revoked) }))
- local suggested_initiative = initiative.suggested_initiative
- if suggested_initiative then
- slot.put("
")
- slot.put(_("The initiators suggest to support the following initiative:"))
- slot.put(" ")
- ui.link{
- content = _("Issue ##{id}", { id = suggested_initiative.issue.id } ) .. ": " .. encode.html(suggested_initiative.name),
- module = "initiative",
- view = "show",
- id = suggested_initiative.id
- }
+ if initiative.revoked then
+ ui.container{
+ attr = { class = "revoked_info" },
+ content = function()
+ slot.put(_("This initiative has been revoked at #{revoked}", { revoked = format.timestamp(initiative.revoked) }))
+ local suggested_initiative = initiative.suggested_initiative
+ if suggested_initiative then
+ slot.put("
")
+ slot.put(_("The initiators suggest to support the following initiative:"))
+ slot.put(" ")
+ ui.link{
+ content = _("Issue ##{id}", { id = suggested_initiative.issue.id } ) .. ": " .. encode.html(suggested_initiative.name),
+ module = "initiative",
+ view = "show",
+ id = suggested_initiative.id
+ }
+ end
end
- end
- }
-end
+ }
+ end
+
+ if initiative.issue.state == "cancelled" then
+ local policy = initiative.issue.policy
+ ui.container{
+ attr = { class = "not_admitted_info" },
+ content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) })
+ }
+ end
+end)
if initiator and initiator.accepted == nil and not initiative.issue.half_frozen and not initiative.issue.closed then
ui.container{
diff -r 00f6935c2c32 -r 01cf3c50cbee static/style.css
--- a/static/style.css Thu Mar 15 21:03:57 2012 +0100
+++ b/static/style.css Fri Mar 16 11:32:06 2012 +0100
@@ -1285,7 +1285,6 @@
.admitted_info {
background-color: #dfd;
padding: 1ex;
- margin-bottom: 2ex;
border-radius: 8px;
}
@@ -1293,7 +1292,6 @@
.revoked_info {
background-color: #fdd;
padding: 1ex;
- margin-bottom: 2ex;
border-radius: 8px;
}