liquid_feedback_frontend

annotate app/main/area/_list.lua @ 289:6f79a181a921

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

Impressum / About Us