liquid_feedback_frontend

view app/main/area/_list.lua @ 19:00d1004545f1

Dynamic interface using XMLHttpRequests, and many other changes

Bugfixes:
- Only allow voting on admitted initiatives
- Repaired issue search
- Don't display delegations for closed issues on member page
- Don't show revoke link in initiative, when issue is already half_frozen
- Localization for voting JavaScript
- Display author of suggestions

Disclosure of voting data after voting is finished:
- Possibility to inspect every ballot including preferences
- Show number of voters preferring one initiative to another initiative

Interface behaviour changes:
- Reversed default order of drafts
- Default order of suggestions changed
- Show new drafts of initiatives only once per day in timeline

Accessibility:
- Barrier-free voting implemented
- POST links are now accessible without JavaScript
- Changed gray for unsatisfied supporters in bar graph to a lighter gray

Other interface improvements:
- Optical enhancements
- Dynamic interface using XMLHttpRequests
- Show usage terms in about section
- Show own membership in area listing
- Show uninformed supporters greyed out and marked with yellow question mark
- Warning box in non-admitted initiatives
- When voted, don't display voting notice and change label of voting link
- Show object counts in more tabulator heads
- Enlarged member statement input field

Miscellaneous:
- Code cleanup
- Added README file containing installation instructions
- Use new WebMCP function ui.filters{...} instead of own ui.filter and ui.order functions
author bsw/jbe
date Sat Feb 20 22:10:31 2010 +0100 (2010-02-20)
parents 72c5e0ee7c98
children 0849be391140
line source
1 local areas_selector = param.get("areas_selector", "table")
3 areas_selector
4 :reset_fields()
5 :add_field("area.id", nil, { "grouped" })
6 :add_field("area.name", nil, { "grouped" })
7 :add_field("member_weight", nil, { "grouped" })
8 :add_field("direct_member_count", nil, { "grouped" })
9 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.accepted ISNULL AND issue.closed ISNULL)", "issues_new_count")
10 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.accepted NOTNULL AND issue.half_frozen ISNULL AND issue.closed ISNULL)", "issues_discussion_count")
11 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.half_frozen NOTNULL AND issue.fully_frozen ISNULL AND issue.closed ISNULL)", "issues_frozen_count")
12 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL)", "issues_voting_count")
13 :add_field({ "(SELECT COUNT(*) FROM issue LEFT JOIN direct_voter ON direct_voter.issue_id = issue.id AND direct_voter.member_id = ? WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL AND direct_voter.member_id ISNULL)", app.session.member.id }, "issues_to_vote_count")
14 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed NOTNULL)", "issues_finished_count")
15 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen ISNULL AND issue.closed NOTNULL)", "issues_cancelled_count")
16 :left_join("membership", "_membership", { "_membership.area_id = area.id AND _membership.member_id = ?", app.session.member.id })
17 :add_field("_membership.member_id NOTNULL", "is_member", { "grouped" })
19 local label_attr = { style = "text-align: right; width: 4em;" }
20 local field_attr = { style = "text-align: right; width: 4em;" }
22 ui.filters{
23 label = _"Change order",
24 selector = areas_selector,
25 {
26 label = _"Order by",
27 {
28 name = "member_weight",
29 label = _"Population",
30 selector_modifier = function(selector) selector:add_order_by("area.member_weight DESC") end
31 },
32 {
33 name = "direct_member_count",
34 label = _"Direct member count",
35 selector_modifier = function(selector) selector:add_order_by("area.direct_member_count DESC") end
36 },
37 {
38 name = "az",
39 label = _"A-Z",
40 selector_modifier = function(selector) selector:add_order_by("area.name") end
41 },
42 {
43 name = "za",
44 label = _"Z-A",
45 selector_modifier = function(selector) selector:add_order_by("area.name DESC") end
46 }
47 },
48 content = function()
49 ui.list{
50 attr = { class = "area_list" },
51 records = areas_selector:exec(),
52 columns = {
53 {
54 content = function(record)
55 if record.is_member then
56 local text = _"Member of area"
57 ui.image{
58 attr = { title = text, alt = text, style = "vertical-align: middle;" },
59 static = "icons/16/user_gray.png",
60 }
61 end
62 end
63 },
64 {
65 content = function(record)
66 if record.member_weight and record.direct_member_count then
67 local max_value = MemberCount:get()
68 ui.bargraph{
69 max_value = max_value,
70 width = 100,
71 bars = {
72 { color = "#444", value = record.direct_member_count },
73 { color = "#777", value = record.member_weight - record.direct_member_count },
74 { color = "#ddd", value = max_value - record.member_weight },
75 }
76 }
77 end
78 end
79 },
80 {
81 content = function(record)
82 ui.link{
83 text = record.name,
84 module = "area",
85 view = "show",
86 id = record.id
87 }
88 end
89 },
90 {
91 label = function()
92 local title = _"New"
93 ui.image{
94 attr = { title = title, alt = title },
95 static = "icons/16/new.png"
96 }
97 end,
98 field_attr = field_attr,
99 label_attr = label_attr,
100 content = function(record)
101 ui.link{
102 text = tostring(record.issues_new_count),
103 module = "area",
104 view = "show",
105 id = record.id,
106 params = { filter = "new", tab = "issues" }
107 }
108 end
109 },
110 {
111 label = function()
112 local title = _"Discussion"
113 ui.image{
114 attr = { title = title, alt = title },
115 static = "icons/16/comments.png"
116 }
117 end,
118 field_attr = field_attr,
119 label_attr = label_attr,
120 content = function(record)
121 ui.link{
122 text = tostring(record.issues_discussion_count),
123 module = "area",
124 view = "show",
125 id = record.id,
126 params = { filter = "accepted", tab = "issues" }
127 }
128 end
129 },
130 {
131 label = function()
132 local title = _"Frozen"
133 ui.image{
134 attr = { title = title, alt = title },
135 static = "icons/16/lock.png"
136 }
137 end,
138 field_attr = field_attr,
139 label_attr = label_attr,
140 content = function(record)
141 ui.link{
142 text = tostring(record.issues_frozen_count),
143 module = "area",
144 view = "show",
145 id = record.id,
146 params = { filter = "half_frozen", tab = "issues" }
147 }
148 end
149 },
150 {
151 label = function()
152 local title = _"Voting"
153 ui.image{
154 attr = { title = title, alt = title },
155 static = "icons/16/email_open.png"
156 }
157 end,
158 field_attr = field_attr,
159 label_attr = label_attr,
160 content = function(record)
161 ui.link{
162 text = tostring(record.issues_voting_count),
163 module = "area",
164 view = "show",
165 id = record.id,
166 params = { filter = "frozen", tab = "issues" }
167 }
168 end
169 },
170 {
171 label = function()
172 local title = _"Finished"
173 ui.image{
174 attr = { title = title, alt = title },
175 static = "icons/16/tick.png"
176 }
177 end,
178 field_attr = field_attr,
179 label_attr = label_attr,
180 content = function(record)
181 ui.link{
182 text = tostring(record.issues_finished_count),
183 module = "area",
184 view = "show",
185 id = record.id,
186 params = { filter = "finished", issue_list = "newest", tab = "issues" }
187 }
188 end
189 },
190 {
191 label = function()
192 local title = _"Cancelled"
193 ui.image{
194 attr = { title = title, alt = title },
195 static = "icons/16/cross.png"
196 }
197 end,
198 field_attr = field_attr,
199 label_attr = label_attr,
200 content = function(record)
201 ui.link{
202 text = tostring(record.issues_cancelled_count),
203 module = "area",
204 view = "show",
205 id = record.id,
206 params = { filter = "cancelled", issue_list = "newest", tab = "issues" }
207 }
208 end
209 },
210 {
211 content = function(record)
212 if record.issues_to_vote_count > 0 then
213 ui.link{
214 attr = { class = "not_voted" },
215 text = _"Not yet voted" .. ": " .. tostring(record.issues_to_vote_count),
216 module = "area",
217 view = "show",
218 id = record.id,
219 params = {
220 filter = "frozen",
221 filter_voting = "not_voted",
222 tab = "issues"
223 }
224 }
225 end
226 end
227 },
228 }
229 }
230 end
231 }
233 ui.bargraph_legend{
234 width = 25,
235 bars = {
236 { color = "#444", label = _"Direct membership" },
237 { color = "#777", label = _"Membership by delegation" },
238 { color = "#ddd", label = _"No membership at all" },
239 }
240 }
242 slot.put("<br /> &nbsp; ")
245 ui.image{
246 attr = { title = title, alt = title },
247 static = "icons/16/user_gray.png"
248 }
249 slot.put(" ")
250 slot.put(_"Member of area")
251 slot.put(" &nbsp; ")
253 ui.image{
254 attr = { title = title, alt = title },
255 static = "icons/16/new.png"
256 }
257 slot.put(" ")
258 slot.put(_"New")
259 slot.put(" &nbsp; ")
261 ui.image{
262 attr = { title = title, alt = title },
263 static = "icons/16/comments.png"
264 }
265 slot.put(" ")
266 slot.put(_"Discussion")
267 slot.put(" &nbsp; ")
269 ui.image{
270 attr = { title = title, alt = title },
271 static = "icons/16/lock.png"
272 }
273 slot.put(" ")
274 slot.put(_"Frozen")
275 slot.put(" &nbsp; ")
277 ui.image{
278 attr = { title = title, alt = title },
279 static = "icons/16/email_open.png"
280 }
281 slot.put(" ")
282 slot.put(_"Voting")
283 slot.put(" &nbsp; ")
285 ui.image{
286 attr = { title = title, alt = title },
287 static = "icons/16/tick.png"
288 }
289 slot.put(" ")
290 slot.put(_"Finished")
291 slot.put(" &nbsp; ")
293 ui.image{
294 attr = { title = title, alt = title },
295 static = "icons/16/cross.png"
296 }
297 slot.put(" ")
298 slot.put(_"Cancelled")

Impressum / About Us