liquid_feedback_frontend

view app/main/initiative/_sidebar_state.lua @ 1125:71eb36b43e76

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

Impressum / About Us