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