liquid_feedback_frontend

view app/main/initiative/_list_element.lua @ 540:ec7b6beb5be6

Merged translation file updates from v2.beta5
author bsw
date Thu May 24 00:16:19 2012 +0200 (2012-05-24)
parents 3e4f6534bb15
children c1dc3b14a4f3
line source
1 local initiative = param.get("initiative", "table")
2 local selected = param.get("selected", atom.boolean)
5 ui.container{ attr = { class = "initiative" }, content = function()
7 ui.container{ attr = { class = "rank" }, content = function()
8 if initiative.issue.accepted and initiative.issue.closed
9 and initiative.issue.ranks_available or initiative.admitted == false
10 then
11 ui.field.rank{ attr = { class = "rank" }, value = initiative.rank, eligible = initiative.eligible }
12 elseif not initiative.issue.closed then
13 ui.image{ static = "icons/16/script.png" }
14 else
15 ui.image{ static = "icons/16/cross.png" }
16 end
17 end }
19 ui.container{ attr = { class = "bar" }, content = function()
20 if initiative.issue.fully_frozen and initiative.issue.closed then
21 if initiative.issue.ranks_available then
22 if initiative.negative_votes and initiative.positive_votes then
23 local max_value = initiative.issue.voter_count
24 ui.bargraph{
25 max_value = max_value,
26 width = 100,
27 bars = {
28 { color = "#0a0", value = initiative.positive_votes },
29 { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
30 { color = "#a00", value = initiative.negative_votes },
31 }
32 }
33 else
34 slot.put(" ")
35 end
36 else
37 slot.put(_"Counting of votes")
38 end
39 else
40 local max_value = initiative.issue.population or 0
41 local quorum
42 if initiative.issue.accepted then
43 quorum = initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den
44 else
45 quorum = initiative.issue.policy.issue_quorum_num / initiative.issue.policy.issue_quorum_den
46 end
47 ui.bargraph{
48 max_value = max_value,
49 width = 100,
50 quorum = max_value * quorum,
51 quorum_color = "#00F",
52 bars = {
53 { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) },
54 { color = "#999", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
55 { color = "#ddd", value = max_value - (initiative.supporter_count or 0) },
56 }
57 }
58 end
59 end }
61 ui.container{ attr = { class = "interest" }, content = function()
62 if initiative.is_initiator then
63 local label = _"You are initiator of this initiative"
64 ui.image{
65 attr = { alt = label, title = label },
66 static = "icons/16/user_edit.png"
67 }
68 elseif initiative.is_supporter then
69 local label = _"You are supporter of this initiative"
70 ui.image{
71 attr = { alt = label, title = label },
72 static = "icons/16/thumb_up_green.png"
73 }
74 elseif initiative.is_potential_supporter then
75 local label = _"You are potentially supporter of this initiative"
76 ui.image{
77 attr = { alt = label, title = label },
78 static = "icons/16/thumb_up.png"
79 }
80 elseif initiative.is_supporter_via_delegation then
81 local label = _"You are supporter of this initiative via delegation"
82 ui.image{
83 attr = { alt = label, title = label },
84 static = "icons/16/thumb_up_green.png"
85 }
86 end
87 end }
89 ui.container{ attr = { class = "name" }, content = function()
90 local link_class = "initiative_link"
91 if initiative.revoked then
92 link_class = "revoked"
93 end
94 if selected then
95 link_class = link_class .. " selected"
96 end
97 if initiative.is_supporter then
98 link_class = link_class .. " supported"
99 end
100 if initiative.is_potential_supporter then
101 link_class = link_class .. " potentially_supported"
102 end
103 if initiative.is_supporter_via_delegation then
104 link_class = link_class .. " supported"
105 end
106 ui.link{
107 attr = { class = link_class },
108 content = function()
109 local name
110 if initiative.name_highlighted then
111 name = encode.highlight(initiative.name_highlighted)
112 else
113 name = encode.html(initiative.shortened_name)
114 end
115 ui.tag{ content = "i" .. initiative.id .. ": " }
116 slot.put(name)
117 end,
118 module = "initiative",
119 view = "show",
120 id = initiative.id
121 }
123 end }
125 end }

Impressum / About Us