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