liquid_feedback_frontend

view app/main/initiative/_sidebar_state.lua @ 1668:6d75df24e66e

Updated German translation
author bsw
date Sun Mar 07 09:52:36 2021 +0100 (2021-03-07)
parents 37d910d919a3
children 20c1c8cc28ba
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 "mdl-card__content mdl-card--border admitted_info" or "mdl-card__content mdl-card--border 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 head_text
19 util.initiative_pie( initiative )
21 if initiative.winner then
22 head_text = _"Approved"
23 elseif initiative.rank then
24 head_text = _("Rejected (rank #{rank})", { rank = initiative.rank })
25 else
26 head_text = _"Rejected"
27 end
29 ui.heading { level = 1, content = head_text }
31 ui.tag { tag = "table", content = function ()
32 ui.tag { tag = "tr", attr = { class = "yes" }, content = function ()
33 ui.tag { tag = "td", content =
34 tostring(positive_votes)
35 }
36 ui.tag { tag = "th", content = _"Yes" }
37 ui.tag { tag = "td", content =
38 format.percent_floor(positive_votes, max_value)
39 }
40 ui.tag { tag = "th", content = _"Yes" }
41 end }
42 ui.tag { tag = "tr", attr = { class = "no" }, content = function ()
43 ui.tag { tag = "td", content =
44 tostring(negative_votes)
45 }
46 ui.tag { tag = "th", content = _"No" }
47 ui.tag { tag = "td", content =
48 format.percent_floor(negative_votes, max_value)
49 }
50 ui.tag { tag = "th", content = _"No" }
51 end }
52 ui.tag { tag = "tr", attr = { class = "abstention" }, content = function ()
53 ui.tag { tag = "td", content =
54 tostring(abstention_votes)
55 }
56 ui.tag { tag = "th", content = _"Abstention" }
57 ui.tag { tag = "td", content =
58 format.percent_floor(abstention_votes, max_value)
59 }
60 ui.tag { tag = "th", content = _"Abstention" }
61 end }
62 end }
63 end
64 }
65 end
67 -- initiative not admitted info
68 if initiative.admitted == false then
69 local policy = initiative.issue.policy
70 ui.container{
71 attr = { class = "draft mdl-card__content mdl-card--border" },
72 content = function ()
73 ui.heading { level = 1, content = _"Initiative not admitted" }
74 local num = policy.initiative_quorum_num
75 local den = policy.initiative_quorum_den
76 local quorums = {}
77 if num and num > 0 and den == 100 or den == 10 then
78 table.insert(quorums, _("#{percentage}%", { percentage = num * 100 / den }))
79 elseif num and num > 0 and den and den > 0 then
80 table.insert(quorums, num .. "/" .. den)
81 end
82 if policy.initiative_quorum then
83 table.insert(quorums, policy.initiative_quorum)
84 end
85 local quorum = table.concat(quorums, " / ")
87 ui.container { content = _("This initiative has not been admitted! It failed the 2nd quorum of #{quorum}.", { quorum = quorum } ) }
88 end
89 }
90 end
92 -- initiative revoked info
93 if initiative.revoked then
94 ui.container{
95 attr = { class = "draft mdl-card__content mdl-card--border" },
96 content = function()
97 ui.heading { level = 1, content = _"Initiative revoked" }
98 slot.put(_("This initiative has been revoked at #{revoked} by:", {
99 revoked = format.timestamp(initiative.revoked)
100 }))
101 slot.put(" ")
102 if app.session:has_access("authors_pseudonymous") then
103 ui.link{
104 module = "member", view = "show", id = initiative.revoked_by_member_id,
105 content = initiative.revoked_by_member.name
106 }
107 else
108 ui.tag{ content = _"[Not public]" }
109 end
110 local suggested_initiative = initiative.suggested_initiative
111 if suggested_initiative then
112 slot.put("<br /><br />")
113 slot.put(_("The initiators suggest to support the following initiative:"))
114 slot.put("<br />")
115 ui.link{
116 content = suggested_initiative.display_name,
117 module = "initiative",
118 view = "show",
119 id = suggested_initiative.id
120 }
121 end
122 end
123 }
124 end

Impressum / About Us