liquid_feedback_frontend
diff app/main/suggestion/_list.lua @ 95:6a12fb7e4963
Suggestion API, draft preview, word based diff, multiple fixes
- Added suggestion API
- Initiative API: Drafts optionally delivered as rendered html fragment
- Initiative API: Fixed wrong output of revoked timestamp when using JSON
- Preview added for initiative drafts
- Improved (word based) diff added
- Improved suggestion list
- Added missing sorting of initiative in vote list
- Filter state for member page initiative lists
- Fixed wrong status output in member history
- Fixed wrongly closed div in layout
- Added suggestion API
- Initiative API: Drafts optionally delivered as rendered html fragment
- Initiative API: Fixed wrong output of revoked timestamp when using JSON
- Preview added for initiative drafts
- Improved (word based) diff added
- Improved suggestion list
- Added missing sorting of initiative in vote list
- Filter state for member page initiative lists
- Fixed wrong status output in member history
- Fixed wrongly closed div in layout
| author | bsw |
|---|---|
| date | Mon Aug 30 21:52:19 2010 +0200 (2010-08-30) |
| parents | 0849be391140 |
| children | 44ba79952610 |
line diff
1.1 --- a/app/main/suggestion/_list.lua Thu Aug 19 15:37:51 2010 +0200 1.2 +++ b/app/main/suggestion/_list.lua Mon Aug 30 21:52:19 2010 +0200 1.3 @@ -84,21 +84,20 @@ 1.4 end 1.5 }, 1.6 { 1.7 - label = _"Collective opinion", 1.8 + label = _"Collective opinion of supporters", 1.9 label_attr = { style = "width: 101px;" }, 1.10 content = function(record) 1.11 if record.minus2_unfulfilled_count then 1.12 - local max_value = record.initiative.issue.population 1.13 + local max_value = record.initiative.supporter_count 1.14 ui.bargraph{ 1.15 max_value = max_value, 1.16 - width = 50, 1.17 + width = 100, 1.18 bars = { 1.19 - { color = "#ddd", value = max_value - record.minus2_unfulfilled_count - record.minus1_unfulfilled_count - record.minus2_fulfilled_count - record.minus1_fulfilled_count }, 1.20 + { color = "#0a0", value = record.plus2_unfulfilled_count + record.plus2_fulfilled_count }, 1.21 + { color = "#8f8", value = record.plus1_unfulfilled_count + record.plus1_fulfilled_count }, 1.22 + { color = "#eee", value = max_value - record.minus2_unfulfilled_count - record.minus1_unfulfilled_count - record.minus2_fulfilled_count - record.minus1_fulfilled_count - record.plus1_unfulfilled_count - record.plus2_unfulfilled_count - record.plus1_fulfilled_count - record.plus2_fulfilled_count}, 1.23 { color = "#f88", value = record.minus1_unfulfilled_count + record.minus1_fulfilled_count }, 1.24 { color = "#a00", value = record.minus2_unfulfilled_count + record.minus2_fulfilled_count }, 1.25 - { color = "#0a0", value = record.plus2_unfulfilled_count + record.plus2_fulfilled_count }, 1.26 - { color = "#8f8", value = record.plus1_unfulfilled_count + record.plus1_fulfilled_count }, 1.27 - { color = "#ddd", value = max_value - record.plus1_unfulfilled_count - record.plus2_unfulfilled_count - record.plus1_fulfilled_count - record.plus2_fulfilled_count }, 1.28 } 1.29 } 1.30 end 1.31 @@ -106,6 +105,7 @@ 1.32 }, 1.33 { 1.34 label = _"My opinion", 1.35 + label_attr = { style = "width: 130px; font-style: italic;" }, 1.36 content = function(record) 1.37 local degree 1.38 local opinion 1.39 @@ -120,67 +120,53 @@ 1.40 content = function() 1.41 if app.session.member_id then 1.42 if initiative.issue.state == "voting" or initiative.issue.state == "closed" then 1.43 - ui.tag{ 1.44 - tag = "span", 1.45 - attr = { class = "action" .. (degree == -2 and " active_red2" or "") }, 1.46 - content = _"must not" 1.47 - } 1.48 - ui.tag{ 1.49 - tag = "span", 1.50 - attr = { class = "action" .. (degree == -1 and " active_red1" or "") }, 1.51 - content = _"should not" 1.52 - } 1.53 - ui.tag{ 1.54 - tag = "span", 1.55 - attr = { class = "action" .. (degree == nil and " active" or "") }, 1.56 - content = _"neutral" 1.57 - } 1.58 - ui.tag{ 1.59 - tag = "span", 1.60 - attr = { class = "action" .. (degree == 1 and " active_green1" or "") }, 1.61 - content = _"should" 1.62 - } 1.63 - ui.tag{ 1.64 - tag = "span", 1.65 - attr = { class = "action" .. (degree == 2 and " active_green2" or "") }, 1.66 - content = _"must" 1.67 - } 1.68 + if degree == -2 then 1.69 + ui.tag{ 1.70 + tag = "span", 1.71 + attr = { 1.72 + class = "action" .. (degree == -2 and " active_red2" or "") 1.73 + }, 1.74 + content = _"must not" 1.75 + } 1.76 + end 1.77 + if degree == -1 then 1.78 + ui.tag{ 1.79 + tag = "span", 1.80 + attr = { class = "action" .. (degree == -1 and " active_red1" or "") }, 1.81 + content = _"should not" 1.82 + } 1.83 + end 1.84 + if degree == nil then 1.85 + ui.tag{ 1.86 + tag = "span", 1.87 + attr = { class = "action" .. (degree == nil and " active" or "") }, 1.88 + content = _"neutral" 1.89 + } 1.90 + end 1.91 + if degree == 1 then 1.92 + ui.tag{ 1.93 + tag = "span", 1.94 + attr = { class = "action" .. (degree == 1 and " active_green1" or "") }, 1.95 + content = _"should" 1.96 + } 1.97 + end 1.98 + if degree == 2 then 1.99 + ui.tag{ 1.100 + tag = "span", 1.101 + attr = { class = "action" .. (degree == 2 and " active_green2" or "") }, 1.102 + content = _"must" 1.103 + } 1.104 + end 1.105 else 1.106 ui.link{ 1.107 - attr = { class = "action" .. (degree == -2 and " active_red2" or "") }, 1.108 - text = _"must not", 1.109 + attr = { class = "action" .. (degree == 2 and " active_green2" or "") }, 1.110 + text = _"must", 1.111 module = "opinion", 1.112 action = "update", 1.113 routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, 1.114 params = { 1.115 suggestion_id = record.id, 1.116 - degree = -2 1.117 - }, 1.118 - partial = partial 1.119 - } 1.120 - slot.put(" ") 1.121 - ui.link{ 1.122 - attr = { class = "action" .. (degree == -1 and " active_red1" or "") }, 1.123 - text = _"should not", 1.124 - module = "opinion", 1.125 - action = "update", 1.126 - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, 1.127 - params = { 1.128 - suggestion_id = record.id, 1.129 - degree = -1 1.130 - }, 1.131 - partial = partial 1.132 - } 1.133 - slot.put(" ") 1.134 - ui.link{ 1.135 - attr = { class = "action" .. (degree == nil and " active" or "") }, 1.136 - text = _"neutral", 1.137 - module = "opinion", 1.138 - action = "update", 1.139 - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, 1.140 - params = { 1.141 - suggestion_id = record.id, 1.142 - delete = true 1.143 + degree = 2 1.144 }, 1.145 partial = partial 1.146 } 1.147 @@ -199,14 +185,40 @@ 1.148 } 1.149 slot.put(" ") 1.150 ui.link{ 1.151 - attr = { class = "action" .. (degree == 2 and " active_green2" or "") }, 1.152 - text = _"must", 1.153 + attr = { class = "action" .. (degree == nil and " active" or "") }, 1.154 + text = _"neutral", 1.155 module = "opinion", 1.156 action = "update", 1.157 routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, 1.158 params = { 1.159 suggestion_id = record.id, 1.160 - degree = 2 1.161 + delete = true 1.162 + }, 1.163 + partial = partial 1.164 + } 1.165 + slot.put(" ") 1.166 + ui.link{ 1.167 + attr = { class = "action" .. (degree == -1 and " active_red1" or "") }, 1.168 + text = _"should not", 1.169 + module = "opinion", 1.170 + action = "update", 1.171 + routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, 1.172 + params = { 1.173 + suggestion_id = record.id, 1.174 + degree = -1 1.175 + }, 1.176 + partial = partial 1.177 + } 1.178 + slot.put(" ") 1.179 + ui.link{ 1.180 + attr = { class = "action" .. (degree == -2 and " active_red2" or "") }, 1.181 + text = _"must not", 1.182 + module = "opinion", 1.183 + action = "update", 1.184 + routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, 1.185 + params = { 1.186 + suggestion_id = record.id, 1.187 + degree = -2 1.188 }, 1.189 partial = partial 1.190 } 1.191 @@ -219,71 +231,48 @@ 1.192 end 1.193 }, 1.194 { 1.195 - content = function(record) 1.196 - local opinion 1.197 - if app.session.member_id then 1.198 - opinion = Opinion:by_pk(app.session.member.id, record.id) 1.199 - end 1.200 - if opinion and not opinion.fulfilled then 1.201 - ui.image{ static = "icons/16/cross.png" } 1.202 - end 1.203 - end 1.204 - }, 1.205 - { 1.206 label = _"Suggestion currently not implemented", 1.207 label_attr = { style = "width: 101px;" }, 1.208 content = function(record) 1.209 if record.minus2_unfulfilled_count then 1.210 - local max_value = record.initiative.issue.population 1.211 + local max_value = record.initiative.supporter_count 1.212 ui.bargraph{ 1.213 max_value = max_value, 1.214 - width = 50, 1.215 + width = 100, 1.216 bars = { 1.217 - { color = "#ddd", value = max_value - record.minus2_unfulfilled_count - record.minus1_unfulfilled_count }, 1.218 - { color = "#f88", value = record.minus1_unfulfilled_count }, 1.219 - { color = "#a00", value = record.minus2_unfulfilled_count }, 1.220 { color = "#0a0", value = record.plus2_unfulfilled_count }, 1.221 { color = "#8f8", value = record.plus1_unfulfilled_count }, 1.222 - { color = "#ddd", value = max_value - record.plus1_unfulfilled_count - record.plus2_unfulfilled_count }, 1.223 + { color = "#eee", value = max_value - record.minus2_unfulfilled_count - record.minus1_unfulfilled_count - record.plus1_unfulfilled_count - record.plus2_unfulfilled_count }, 1.224 + { color = "#f88", value = record.minus1_unfulfilled_count }, 1.225 + { color = "#a00", value = record.minus2_unfulfilled_count }, 1.226 } 1.227 } 1.228 end 1.229 end 1.230 }, 1.231 { 1.232 - content = function(record) 1.233 - local opinion 1.234 - if app.session.member_id then 1.235 - opinion = Opinion:by_pk(app.session.member.id, record.id) 1.236 - end 1.237 - if opinion and opinion.fulfilled then 1.238 - ui.image{ static = "icons/16/tick.png" } 1.239 - end 1.240 - end 1.241 - }, 1.242 - { 1.243 label = _"Suggestion currently implemented", 1.244 label_attr = { style = "width: 101px;" }, 1.245 content = function(record) 1.246 if record.minus2_fulfilled_count then 1.247 - local max_value = record.initiative.issue.population 1.248 + local max_value = record.initiative.supporter_count 1.249 ui.bargraph{ 1.250 max_value = max_value, 1.251 - width = 50, 1.252 + width = 100, 1.253 bars = { 1.254 - { color = "#ddd", value = max_value - record.minus2_fulfilled_count - record.minus1_fulfilled_count }, 1.255 + { color = "#0a0", value = record.plus2_fulfilled_count }, 1.256 + { color = "#8f8", value = record.plus1_fulfilled_count }, 1.257 + { color = "#eee", value = max_value - record.minus2_fulfilled_count - record.minus1_fulfilled_count - record.plus1_fulfilled_count - record.plus2_fulfilled_count}, 1.258 { color = "#f88", value = record.minus1_fulfilled_count }, 1.259 { color = "#a00", value = record.minus2_fulfilled_count }, 1.260 - { color = "#0a0", value = record.plus2_fulfilled_count }, 1.261 - { color = "#8f8", value = record.plus1_fulfilled_count }, 1.262 - { color = "#ddd", value = max_value - record.plus1_fulfilled_count - record.plus2_fulfilled_count }, 1.263 } 1.264 } 1.265 end 1.266 end 1.267 }, 1.268 { 1.269 - label_attr = { style = "width: 200px;" }, 1.270 + label = app.session.member_id and _"I consider suggestion as" or nil, 1.271 + label_attr = { style = "width: 100px; font-style: italic;" }, 1.272 content = function(record) 1.273 local degree 1.274 local opinion 1.275 @@ -294,48 +283,38 @@ 1.276 degree = opinion.degree 1.277 end 1.278 if opinion then 1.279 - if not opinion.fulfilled then 1.280 - local text = "" 1.281 - if opinion.degree > 0 then 1.282 - text = _"Mark suggestion as implemented and express satisfaction" 1.283 - else 1.284 - text = _"Mark suggestion as implemented and express dissatisfaction" 1.285 - end 1.286 - ui.link{ 1.287 - attr = { class = "action" }, 1.288 - text = text, 1.289 - module = "opinion", 1.290 - action = "update", 1.291 - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, 1.292 - params = { 1.293 - suggestion_id = record.id, 1.294 - fulfilled = true 1.295 - }, 1.296 - partial = partial 1.297 - } 1.298 - else 1.299 - if opinion.degree > 0 then 1.300 - text = _"Mark suggestion as not implemented and express dissatisfaction" 1.301 - else 1.302 - text = _"Mark suggestion as not implemented and express satisfaction" 1.303 - end 1.304 - ui.link{ 1.305 - attr = { class = "action" }, 1.306 - text = text, 1.307 - module = "opinion", 1.308 - action = "update", 1.309 - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, 1.310 - params = { 1.311 - suggestion_id = record.id, 1.312 - fulfilled = false 1.313 - }, 1.314 - partial = partial 1.315 - } 1.316 - end 1.317 + 1.318 + ui.link{ 1.319 + attr = { class = opinion.fulfilled and "action active" or "action" }, 1.320 + text = _"implemented", 1.321 + module = "opinion", 1.322 + action = "update", 1.323 + routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, 1.324 + params = { 1.325 + suggestion_id = record.id, 1.326 + fulfilled = true 1.327 + }, 1.328 + partial = partial 1.329 + } 1.330 + slot.put("<br />") 1.331 + ui.link{ 1.332 + attr = { class = not opinion.fulfilled and "action active" or "action" }, 1.333 + text = _"not implemented", 1.334 + module = "opinion", 1.335 + action = "update", 1.336 + routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, 1.337 + params = { 1.338 + suggestion_id = record.id, 1.339 + fulfilled = false 1.340 + }, 1.341 + partial = partial 1.342 + } 1.343 + 1.344 end 1.345 end 1.346 }, 1.347 { 1.348 + label = app.session.member_id and _"So I'm" or nil, 1.349 content = function(record) 1.350 local opinion 1.351 if app.session.member_id then 1.352 @@ -343,9 +322,14 @@ 1.353 end 1.354 if opinion then 1.355 if (opinion.fulfilled and opinion.degree > 0) or (not opinion.fulfilled and opinion.degree < 0) then 1.356 - ui.image{ static = "icons/16/thumb_up_green.png" } 1.357 + local title = _"satisfied" 1.358 + ui.image{ attr = { alt = title, title = title }, static = "icons/emoticon_happy.png" } 1.359 + elseif opinion.degree == 1 or opinion.degree == -1 then 1.360 + local title = _"a bit unsatisfied" 1.361 + ui.image{ attr = { alt = title, title = title }, static = "icons/emoticon_unhappy.png" } 1.362 else 1.363 - ui.image{ static = "icons/16/thumb_down_red.png" } 1.364 + local title = _"more unsatisfied" 1.365 + ui.image{ attr = { alt = title, title = title }, static = "icons/emoticon_unhappy_red.png" } 1.366 end 1.367 end 1.368 end