liquid_feedback_frontend

view app/main/initiative/_list_element.lua @ 337:4f8058e4d7db

Removed unneccessary spacing on top of not_admitted boxes
author bsw
date Tue Feb 28 18:48:20 2012 +0100 (2012-02-28)
parents 0ec49ed35954
children 7d6a3c411f99
line source
1 local initiative = param.get("initiative", "table")
2 local selected = param.get("selected", atom.boolean)
4 local head_name = "initiative_head_" .. tostring(initiative.id)
5 local link_name = "initiative_link_" .. tostring(initiative.id)
6 local name = "initiative_content_" .. tostring(initiative.id)
7 local icon_name = "initiative_icon_" .. tostring(initiative.id)
9 ui.container{
10 attr = { class = "ui_tabs" .. (initiative.id == for_initiative_id and " active" or "") },
11 content = function()
12 local module = "initiative"
13 local view = "show"
14 local id = initiative.id
15 local params = {}
16 ui.container{
17 attr = {
18 name = name,
19 class = "ui_tabs_accordeon_head",
20 id = head_name,
21 },
22 content = function()
24 ui.list{
25 attr = { class = "nohover" },
26 records = { { a = 1} },
27 columns = {
28 {
29 field_attr = { style = "width: 3em; text-align: center;"},
30 content = function()
31 if
32 initiative.issue.accepted and initiative.issue.closed
33 and initiative.issue.ranks_available or initiative.admitted == false
34 then
35 ui.field.rank{ image_attr = { id = icon_name }, attr = { class = "rank" }, value = initiative.rank, eligible = initiative.eligible }
36 else
37 slot.put(" ")
38 end
39 end
40 },
42 {
43 field_attr = { style = "width: 100px;"},
44 content = function()
45 if initiative.issue.fully_frozen and initiative.issue.closed then
46 if initiative.issue.ranks_available then
47 if initiative.negative_votes and initiative.positive_votes then
48 local max_value = initiative.issue.voter_count
49 ui.bargraph{
50 max_value = max_value,
51 width = 100,
52 bars = {
53 { color = "#0a0", value = initiative.positive_votes },
54 { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes },
55 { color = "#a00", value = initiative.negative_votes },
56 }
57 }
58 else
59 slot.put(" ")
60 end
61 else
62 slot.put(_"Counting of votes")
63 end
64 else
65 local max_value = initiative.issue.population or 0
66 ui.bargraph{
67 max_value = max_value,
68 width = 100,
69 quorum = max_value * (initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den),
70 quorum_color = "#00F",
71 bars = {
72 { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) },
73 { color = "#bbb", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) },
74 { color = "#f7f7f7", value = max_value - (initiative.supporter_count or 0) },
75 }
76 }
77 end
78 end
79 },
80 {
81 field_attr = { style = "width: 24px;" },
82 content = function()
83 if initiative.is_initiator then
84 slot.put(" ")
85 local label = _"You are initiator of this initiative"
86 ui.image{
87 attr = { alt = label, title = label },
88 static = "icons/16/user_edit.png"
89 }
90 elseif initiative.is_supporter then
91 slot.put(" ")
92 local label = _"You are supporter of this initiative"
93 ui.image{
94 attr = { alt = label, title = label },
95 static = "icons/16/thumb_up_green.png"
96 }
97 elseif initiative.is_potential_supporter then
98 slot.put(" ")
99 local label = _"You are potentially supporter of this initiative"
100 ui.image{
101 attr = { alt = label, title = label },
102 static = "icons/16/thumb_up.png"
103 }
104 elseif initiative.is_supporter_via_delegation then
105 slot.put(" ")
106 local label = _"You are supporter of this initiative via delegation"
107 ui.image{
108 attr = { alt = label, title = label },
109 static = "icons/16/thumb_up_green.png"
110 }
111 end
113 end
114 },
115 {
116 content = function()
117 local link_class = "initiative_link"
118 if initiative.revoked then
119 link_class = "revoked"
120 end
121 if selected then
122 link_class = link_class .. " selected"
123 end
124 if initiative.is_supporter then
125 link_class = link_class .. " supported"
126 end
127 if initiative.is_potential_supporter then
128 link_class = link_class .. " potentially_supported"
129 end
130 if initiative.is_supporter_via_delegation then
131 link_class = link_class .. " supported"
132 end
133 ui.link{
134 attr = { id = link_name, class = link_class },
135 content = function()
136 local name
137 if initiative.name_highlighted then
138 name = encode.highlight(initiative.name_highlighted)
139 else
140 name = encode.html(initiative.shortened_name)
141 end
142 ui.tag{ content = "i" .. initiative.id .. ": " }
143 slot.put(name)
144 end,
145 module = module,
146 view = view,
147 id = id,
148 params = params,
149 }
151 end
152 }
153 }
154 }
155 end
156 }
157 end
158 }
160 if ui.is_partial_loading_enabled() then
161 ui.container{
162 attr = {
163 id = name,
164 class = "ui_tabs_accordeon_content",
165 },
166 content = function()
167 ui.container{
168 attr = { id = name .. "_content", style = "clear: left;" },
169 content = function()
170 execute.view{
171 module = "initiative",
172 view = "show_partial",
173 params = {
174 initiative = initiative,
175 }
176 }
177 end
178 }
179 end
180 }
181 end

Impressum / About Us