liquid_feedback_frontend
view app/main/suggestion/_list.lua @ 10:72c5e0ee7c98
Version beta6
Bugfixes:
- Security fix: Every user was able to change the discussion URL of an initiative
- Creation of new issues in areas without default policies is now possible
- Members can now be sorted in different ways
- No error when trying to compare a draft with itself
- Added missing local statement to variable initialization in app/main/delegation/new.lua
- CSS flaw in initiative action bar fixed
New features:
- Possiblity to invite other users to become initiator
- Revokation of initiatives implemented
- Number of suggestions, supporters, etc. is shown on corresponding tabs of initiative view
- Members can now be sorted by account creation (default sorting is "newest first")
- Configuration option to create an automatic discussion link for all issues
- First draft of global timeline feature (not accessible via link yet)
- Custom stylesheet URL for users marked as developers
In area listing the number of closed issues is shown too
Renamed "author" field of initiative to "last author"
Removed wrongly included file app/main/member/_show_thumb.lua.orig in the distribution
Help texts updated
Bugfixes:
- Security fix: Every user was able to change the discussion URL of an initiative
- Creation of new issues in areas without default policies is now possible
- Members can now be sorted in different ways
- No error when trying to compare a draft with itself
- Added missing local statement to variable initialization in app/main/delegation/new.lua
- CSS flaw in initiative action bar fixed
New features:
- Possiblity to invite other users to become initiator
- Revokation of initiatives implemented
- Number of suggestions, supporters, etc. is shown on corresponding tabs of initiative view
- Members can now be sorted by account creation (default sorting is "newest first")
- Configuration option to create an automatic discussion link for all issues
- First draft of global timeline feature (not accessible via link yet)
- Custom stylesheet URL for users marked as developers
In area listing the number of closed issues is shown too
Renamed "author" field of initiative to "last author"
Removed wrongly included file app/main/member/_show_thumb.lua.orig in the distribution
Help texts updated
author | bsw |
---|---|
date | Sun Jan 10 12:00:00 2010 +0100 (2010-01-10) |
parents | afd9f769c7ae |
children | 00d1004545f1 |
line source
2 local initiative = param.get("initiative", "table")
3 local suggestions_selector = param.get("suggestions_selector", "table")
5 ui.order{
6 name = name,
7 selector = suggestions_selector,
8 options = {
9 {
10 name = "all",
11 label = _"all",
12 order_by = "minus2_unfulfilled_count + minus1_unfulfilled_count + minus2_fulfilled_count + minus1_fulfilled_count + plus2_unfulfilled_count + plus1_unfulfilled_count + plus2_fulfilled_count + plus1_fulfilled_count DESC, id"
13 },
14 {
15 name = "plus2",
16 label = _"must",
17 order_by = "plus2_unfulfilled_count + plus2_fulfilled_count DESC, id"
18 },
19 {
20 name = "plus",
21 label = _"must/should",
22 order_by = "plus2_unfulfilled_count + plus1_unfulfilled_count + plus2_fulfilled_count + plus1_fulfilled_count DESC, id"
23 },
24 {
25 name = "minus",
26 label = _"must/should not",
27 order_by = "minus2_unfulfilled_count + minus1_unfulfilled_count + minus2_fulfilled_count + minus1_fulfilled_count DESC, id"
28 },
29 {
30 name = "minus2",
31 label = _"must not",
32 order_by = "minus2_unfulfilled_count + minus2_fulfilled_count DESC, id"
33 },
34 {
35 name = "unfulfilled",
36 label = _"not implemented",
37 order_by = "minus2_unfulfilled_count + minus1_unfulfilled_count + plus2_unfulfilled_count + plus1_unfulfilled_count DESC, id"
38 },
39 {
40 name = "plus2_unfulfilled",
41 label = _"must",
42 order_by = "plus2_unfulfilled_count DESC, id"
43 },
44 {
45 name = "plus_unfulfilled",
46 label = _"must/should",
47 order_by = "plus2_unfulfilled_count + plus1_unfulfilled_count DESC, id"
48 },
49 {
50 name = "minus_unfulfilled",
51 label = _"must/should not",
52 order_by = "minus2_unfulfilled_count + minus1_unfulfilled_count DESC, id"
53 },
54 {
55 name = "minus2_unfulfilled",
56 label = _"must not",
57 order_by = "minus2_unfulfilled_count DESC, id"
58 },
59 },
60 content = function()
61 ui.paginate{
62 selector = suggestions_selector,
63 content = function()
64 ui.list{
65 attr = { style = "table-layout: fixed;" },
66 records = suggestions_selector:exec(),
67 columns = {
68 {
69 label = _"Suggestion",
70 content = function(record)
71 ui.link{
72 text = record.name,
73 module = "suggestion",
74 view = "show",
75 id = record.id
76 }
77 end
78 },
79 {
80 label = _"Collective opinion",
81 label_attr = { style = "width: 101px;" },
82 content = function(record)
83 if record.minus2_unfulfilled_count then
84 local max_value = record.initiative.issue.population
85 ui.bargraph{
86 max_value = max_value,
87 width = 50,
88 bars = {
89 { color = "#ddd", value = max_value - record.minus2_unfulfilled_count - record.minus1_unfulfilled_count - record.minus2_fulfilled_count - record.minus1_fulfilled_count },
90 { color = "#f88", value = record.minus1_unfulfilled_count + record.minus1_fulfilled_count },
91 { color = "#a00", value = record.minus2_unfulfilled_count + record.minus2_fulfilled_count },
92 { color = "#0a0", value = record.plus2_unfulfilled_count + record.plus2_fulfilled_count },
93 { color = "#8f8", value = record.plus1_unfulfilled_count + record.plus1_fulfilled_count },
94 { color = "#ddd", value = max_value - record.plus1_unfulfilled_count - record.plus2_unfulfilled_count - record.plus1_fulfilled_count - record.plus2_fulfilled_count },
95 }
96 }
97 end
98 end
99 },
100 {
101 label = _"My opinion",
102 content = function(record)
103 local degree
104 local opinion = Opinion:by_pk(app.session.member.id, record.id)
105 if opinion then
106 degree = opinion.degree
107 end
108 ui.container{
109 attr = { class = "suggestion_my_opinion" },
110 content = function()
111 ui.link{
112 attr = { class = "action" .. (degree == -2 and " active_red2" or "") },
113 text = _"must not",
114 module = "opinion",
115 action = "update",
116 routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
117 params = {
118 suggestion_id = record.id,
119 degree = -2
120 }
121 }
122 slot.put(" ")
123 ui.link{
124 attr = { class = "action" .. (degree == -1 and " active_red1" or "") },
125 text = _"should not",
126 module = "opinion",
127 action = "update",
128 routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
129 params = {
130 suggestion_id = record.id,
131 degree = -1
132 }
133 }
134 slot.put(" ")
135 ui.link{
136 attr = { class = "action" .. (degree == nil and " active" or "") },
137 text = _"neutral",
138 module = "opinion",
139 action = "update",
140 routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
141 params = {
142 suggestion_id = record.id,
143 delete = true
144 }
145 }
146 slot.put(" ")
147 ui.link{
148 attr = { class = "action" .. (degree == 1 and " active_green1" or "") },
149 text = _"should",
150 module = "opinion",
151 action = "update",
152 routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
153 params = {
154 suggestion_id = record.id,
155 degree = 1
156 }
157 }
158 slot.put(" ")
159 ui.link{
160 attr = { class = "action" .. (degree == 2 and " active_green2" or "") },
161 text = _"must",
162 module = "opinion",
163 action = "update",
164 routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
165 params = {
166 suggestion_id = record.id,
167 degree = 2
168 }
169 }
170 end
171 }
172 end
173 },
174 {
175 content = function(record)
176 local opinion = Opinion:by_pk(app.session.member.id, record.id)
177 if opinion and not opinion.fulfilled then
178 ui.image{ static = "icons/16/cross.png" }
179 end
180 end
181 },
182 {
183 label = _"Suggestion currently not implemented",
184 label_attr = { style = "width: 101px;" },
185 content = function(record)
186 if record.minus2_unfulfilled_count then
187 local max_value = record.initiative.issue.population
188 ui.bargraph{
189 max_value = max_value,
190 width = 50,
191 bars = {
192 { color = "#ddd", value = max_value - record.minus2_unfulfilled_count - record.minus1_unfulfilled_count },
193 { color = "#f88", value = record.minus1_unfulfilled_count },
194 { color = "#a00", value = record.minus2_unfulfilled_count },
195 { color = "#0a0", value = record.plus2_unfulfilled_count },
196 { color = "#8f8", value = record.plus1_unfulfilled_count },
197 { color = "#ddd", value = max_value - record.plus1_unfulfilled_count - record.plus2_unfulfilled_count },
198 }
199 }
200 end
201 end
202 },
203 {
204 content = function(record)
205 local opinion = Opinion:by_pk(app.session.member.id, record.id)
206 if opinion and opinion.fulfilled then
207 ui.image{ static = "icons/16/tick.png" }
208 end
209 end
210 },
211 {
212 label = _"Suggestion currently implemented",
213 label_attr = { style = "width: 101px;" },
214 content = function(record)
215 if record.minus2_fulfilled_count then
216 local max_value = record.initiative.issue.population
217 ui.bargraph{
218 max_value = max_value,
219 width = 50,
220 bars = {
221 { color = "#ddd", value = max_value - record.minus2_fulfilled_count - record.minus1_fulfilled_count },
222 { color = "#f88", value = record.minus1_fulfilled_count },
223 { color = "#a00", value = record.minus2_fulfilled_count },
224 { color = "#0a0", value = record.plus2_fulfilled_count },
225 { color = "#8f8", value = record.plus1_fulfilled_count },
226 { color = "#ddd", value = max_value - record.plus1_fulfilled_count - record.plus2_fulfilled_count },
227 }
228 }
229 end
230 end
231 },
232 {
233 label_attr = { style = "width: 200px;" },
234 content = function(record)
235 local degree
236 local opinion = Opinion:by_pk(app.session.member.id, record.id)
237 if opinion then
238 degree = opinion.degree
239 end
240 if opinion then
241 if not opinion.fulfilled then
242 local text = ""
243 if opinion.degree > 0 then
244 text = _"Mark suggestion as implemented and express satisfaction"
245 else
246 text = _"Mark suggestion as implemented and express dissatisfaction"
247 end
248 ui.link{
249 attr = { class = "action" },
250 text = text,
251 module = "opinion",
252 action = "update",
253 routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
254 params = {
255 suggestion_id = record.id,
256 fulfilled = true
257 }
258 }
259 else
260 if opinion.degree > 0 then
261 text = _"Mark suggestion as not implemented and express dissatisfaction"
262 else
263 text = _"Mark suggestion as not implemented and express satisfaction"
264 end
265 ui.link{
266 attr = { class = "action" },
267 text = text,
268 module = "opinion",
269 action = "update",
270 routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } },
271 params = {
272 suggestion_id = record.id,
273 fulfilled = false
274 }
275 }
276 end
277 end
278 end
279 },
280 {
281 content = function(record)
282 local opinion = Opinion:by_pk(app.session.member.id, record.id)
283 if opinion then
284 if (opinion.fulfilled and opinion.degree > 0) or (not opinion.fulfilled and opinion.degree < 0) then
285 ui.image{ static = "icons/16/thumb_up_green.png" }
286 else
287 ui.image{ static = "icons/16/thumb_down_red.png" }
288 end
289 end
290 end
291 },
292 }
293 }
294 end
295 }
296 end
297 }
299 if initiative then
300 ui.field.timestamp{ label = _"Last snapshot:", value = initiative.issue.snapshot }
301 end