rev |
line source |
bsw@1045
|
1 local initiative = Initiative:by_id ( param.get_id() )
|
bsw@1045
|
2 local member = app.session.member
|
bsw@1045
|
3
|
bsw@1045
|
4 if not initiative then
|
bsw@1045
|
5 execute.view { module = "index", view = "404" }
|
bsw@1045
|
6 request.set_status("404 Not Found")
|
bsw@1045
|
7 return
|
bsw@1045
|
8 end
|
bsw@1045
|
9
|
bsw@1045
|
10 local issue_info
|
bsw@1045
|
11
|
bsw@1045
|
12 if member then
|
bsw@1045
|
13 initiative:load_everything_for_member_id(member.id)
|
bsw@1045
|
14 initiative.issue:load_everything_for_member_id(member.id)
|
bsw@1045
|
15 issue_info = initiative.issue.member_info
|
bsw@1045
|
16 end
|
bsw@1045
|
17
|
bsw@1045
|
18 execute.view {
|
bsw@1045
|
19 module = "issue", view = "_head",
|
bsw@1045
|
20 params = {
|
bsw@1045
|
21 issue = initiative.issue,
|
bsw@1045
|
22 initiative = initiative,
|
bsw@1045
|
23 member = app.session.member
|
bsw@1045
|
24 }
|
bsw@1045
|
25 }
|
bsw@1045
|
26
|
bsw@1145
|
27 local direct_supporter
|
bsw@1145
|
28
|
bsw@1045
|
29 if app.session.member_id then
|
bsw@1045
|
30 direct_supporter = initiative.issue.member_info.own_participation and initiative.member_info.supported
|
bsw@1045
|
31 end
|
bsw@718
|
32
|
bsw@1045
|
33 ui.script { script = [[
|
bsw@1045
|
34 function showTab(tabId) {
|
bsw@1045
|
35 $('.tab').hide();
|
bsw@1045
|
36 $('.main').hide();
|
bsw@1045
|
37 $('.main, .slot_extra .section').hide();
|
bsw@1045
|
38 $('.' + tabId).show();
|
bsw@1045
|
39 if (tabId == "main") $('.slot_extra .section').show();
|
bsw@1045
|
40 };
|
bsw@1045
|
41 showTab('main');
|
bsw@1045
|
42 ]]}
|
bsw@1045
|
43
|
bsw@1045
|
44 execute.view{ module = "issue", view = "_sidebar_state", params = {
|
bsw@1045
|
45 initiative = initiative
|
bsw@1045
|
46 } }
|
bsw@1045
|
47
|
bsw@1045
|
48 execute.view {
|
bsw@1045
|
49 module = "issue", view = "_sidebar_issue",
|
bsw@1045
|
50 params = {
|
bsw@1045
|
51 issue = initiative.issue,
|
bsw@1045
|
52 highlight_initiative_id = initiative.id
|
bsw@1045
|
53 }
|
bsw@1045
|
54 }
|
bsw@1045
|
55
|
bsw@1045
|
56 execute.view {
|
bsw@1045
|
57 module = "issue", view = "_sidebar_whatcanido",
|
bsw@1045
|
58 params = { initiative = initiative }
|
bsw@1045
|
59 }
|
bsw@1045
|
60
|
bsw@1045
|
61 execute.view {
|
bsw@1045
|
62 module = "issue", view = "_sidebar_members", params = {
|
bsw@1045
|
63 issue = initiative.issue, initiative = initiative
|
bsw@718
|
64 }
|
bsw@718
|
65 }
|
bsw@1045
|
66
|
bsw@1045
|
67 ui.section( function ()
|
bsw@1045
|
68 execute.view{
|
bsw@1045
|
69 module = "initiative", view = "_head", params = {
|
bsw@1045
|
70 initiative = initiative
|
bsw@1045
|
71 }
|
bsw@1045
|
72 }
|
bsw@1045
|
73
|
bsw@1045
|
74 if direct_supporter and not initiative.issue.closed then
|
bsw@1045
|
75 local supporter = app.session.member:get_reference_selector("supporters")
|
bsw@1045
|
76 :add_where{ "initiative_id = ?", initiative.id }
|
bsw@1045
|
77 :optional_object_mode()
|
bsw@1045
|
78 :exec()
|
bsw@1045
|
79
|
bsw@1045
|
80 if supporter then
|
bsw@1045
|
81
|
bsw@1045
|
82 local old_draft_id = supporter.draft_id
|
bsw@1045
|
83 local new_draft_id = initiative.current_draft.id
|
bsw@1045
|
84
|
bsw@1045
|
85 if old_draft_id ~= new_draft_id then
|
bsw@1045
|
86 ui.sectionRow( "draft_updated_info", function ()
|
bsw@1045
|
87 ui.container{
|
bsw@1045
|
88 attr = { class = "info" },
|
bsw@1045
|
89 content = _"The draft of this initiative has been updated!"
|
bsw@1045
|
90 }
|
bsw@1045
|
91 slot.put(" ")
|
bsw@1045
|
92 ui.link{
|
bsw@1045
|
93 content = _"show differences",
|
bsw@1045
|
94 module = "draft",
|
bsw@1045
|
95 view = "diff",
|
bsw@1045
|
96 params = {
|
bsw@1045
|
97 old_draft_id = old_draft_id,
|
bsw@1045
|
98 new_draft_id = new_draft_id
|
bsw@1045
|
99 }
|
bsw@1045
|
100 }
|
bsw@1045
|
101 if not initiative.revoked then
|
bsw@1045
|
102 slot.put(" | ")
|
bsw@1045
|
103 ui.link{
|
bsw@1045
|
104 text = _"refresh my support",
|
bsw@1045
|
105 module = "initiative",
|
bsw@1045
|
106 action = "add_support",
|
bsw@1045
|
107 id = initiative.id,
|
bsw@1045
|
108 params = { draft_id = initiative.current_draft.id },
|
bsw@1045
|
109 routing = {
|
bsw@1045
|
110 default = {
|
bsw@1045
|
111 mode = "redirect",
|
bsw@1045
|
112 module = "initiative",
|
bsw@1045
|
113 view = "show",
|
bsw@1045
|
114 id = initiative.id
|
bsw@1045
|
115 }
|
bsw@1045
|
116 }
|
bsw@1045
|
117 }
|
bsw@1045
|
118 slot.put(" | ")
|
bsw@1045
|
119 end
|
bsw@1045
|
120
|
bsw@1045
|
121 ui.link{
|
bsw@1045
|
122 text = _"remove my support",
|
bsw@1045
|
123 module = "initiative",
|
bsw@1045
|
124 action = "remove_support",
|
bsw@1045
|
125 id = initiative.id,
|
bsw@1045
|
126 routing = {
|
bsw@1045
|
127 default = {
|
bsw@1045
|
128 mode = "redirect",
|
bsw@1045
|
129 module = "initiative",
|
bsw@1045
|
130 view = "show",
|
bsw@1045
|
131 id = initiative.id
|
bsw@1045
|
132 }
|
bsw@1045
|
133 }
|
bsw@1045
|
134 }
|
bsw@1045
|
135
|
bsw@1045
|
136 end )
|
bsw@1045
|
137 end
|
bsw@1045
|
138 end
|
bsw@1045
|
139 end
|
bsw@1045
|
140
|
bsw@1045
|
141
|
bsw@1045
|
142 ui.sectionRow( function ()
|
bsw@1045
|
143 ui.container {
|
bsw@1045
|
144 attr = { class = "draft" },
|
bsw@1045
|
145 content = function ()
|
bsw@1045
|
146 slot.put ( initiative.current_draft:get_content ( "html" ) )
|
bsw@1045
|
147 end
|
bsw@1045
|
148 }
|
bsw@1045
|
149 end )
|
bsw@1045
|
150
|
bsw@1045
|
151 end)
|
bsw@1045
|
152
|
bsw@1045
|
153 ui.link { attr = { name = "suggestions" }, text = "" }
|
bsw@1045
|
154
|
bsw@1045
|
155
|
bsw@1045
|
156 ui.container {
|
bsw@1045
|
157 attr = { class = "section suggestions" },
|
bsw@1045
|
158 content = function ()
|
bsw@1045
|
159
|
bsw@1045
|
160 if # ( initiative.suggestions ) > 0 then
|
bsw@1045
|
161
|
bsw@1045
|
162 ui.sectionHead( function ()
|
bsw@1045
|
163 ui.heading {
|
bsw@1045
|
164 level = 1,
|
bsw@1045
|
165 content = _("Suggestions for improvement (#{count})", { count = # ( initiative.suggestions ) } )
|
bsw@1045
|
166 }
|
bsw@1045
|
167 ui.container { content = _"written and rated by the supportes of this initiative to improve the proposal and its reasons" }
|
bsw@1045
|
168 end )
|
bsw@1045
|
169
|
bsw@1045
|
170 for i, suggestion in ipairs(initiative.suggestions) do
|
bsw@1045
|
171
|
bsw@1045
|
172 local opinion = Opinion:by_pk(app.session.member_id, suggestion.id)
|
bsw@1045
|
173
|
bsw@1045
|
174 local class = "sectionRow suggestion"
|
bsw@1045
|
175 if suggestion.id == param.get("suggestion_id", atom.number) then
|
bsw@1045
|
176 class = class .. " highlighted"
|
bsw@1045
|
177 end
|
bsw@1045
|
178 if member and not initiative.issue.fully_frozen and not initiative.issue.closed and initiative.member_info.supported then
|
bsw@1045
|
179 class = class .. " rateable"
|
bsw@1045
|
180 end
|
bsw@1045
|
181
|
bsw@1045
|
182
|
bsw@1045
|
183 ui.tag { tag = "div", attr = { class = class, id = "s" .. suggestion.id }, content = function ()
|
bsw@1045
|
184
|
bsw@1045
|
185 if opinion then
|
bsw@1045
|
186
|
bsw@1045
|
187 ui.container { attr = { class = "opinion"}, content = function()
|
bsw@1045
|
188 local class = ""
|
bsw@1045
|
189 local text = ""
|
bsw@1045
|
190
|
bsw@1045
|
191 if opinion.degree == 2 then
|
bsw@1045
|
192 class = "must"
|
bsw@1045
|
193 text = _"must"
|
bsw@1045
|
194 elseif opinion.degree == 1 then
|
bsw@1045
|
195 class = "should"
|
bsw@1045
|
196 text = _"should"
|
bsw@1045
|
197 elseif opinion.degree == 0 then
|
bsw@1045
|
198 class = "neutral"
|
bsw@1045
|
199 text = _"neutral"
|
bsw@1045
|
200 elseif opinion.degree == -1 then
|
bsw@1045
|
201 class = "shouldnot"
|
bsw@1045
|
202 text = _"should not"
|
bsw@1045
|
203 elseif opinion.degree == -2 then
|
bsw@1045
|
204 class = "mustnot"
|
bsw@1045
|
205 text = _"must not"
|
bsw@1045
|
206 end
|
bsw@1045
|
207
|
bsw@1045
|
208 ui.tag {
|
bsw@1045
|
209 attr = { class = class },
|
bsw@1045
|
210 content = text
|
bsw@1045
|
211 }
|
bsw@1045
|
212
|
bsw@1045
|
213 slot.put ( " " )
|
bsw@1045
|
214
|
bsw@1045
|
215 if
|
bsw@1045
|
216 (opinion.degree > 0 and not opinion.fulfilled)
|
bsw@1045
|
217 or (opinion.degree < 0 and opinion.fulfilled)
|
bsw@1045
|
218 then
|
bsw@1045
|
219 ui.tag{ content = _"but" }
|
bsw@1045
|
220 else
|
bsw@1045
|
221 ui.tag{ content = _"and" }
|
bsw@1045
|
222 end
|
bsw@1045
|
223
|
bsw@1045
|
224 slot.put ( " " )
|
bsw@1045
|
225
|
bsw@1045
|
226 local class = ""
|
bsw@1045
|
227 local text = ""
|
bsw@1045
|
228
|
bsw@1045
|
229 if opinion.fulfilled then
|
bsw@1045
|
230 class = "implemented"
|
bsw@1045
|
231 text = _"is implemented"
|
bsw@1045
|
232 else
|
bsw@1045
|
233 class = "notimplemented"
|
bsw@1045
|
234 text = _"is not implemented"
|
bsw@1045
|
235 end
|
bsw@1045
|
236
|
bsw@1045
|
237 ui.tag {
|
bsw@1045
|
238 attr = { class = class },
|
bsw@1045
|
239 content = text
|
bsw@1045
|
240 }
|
bsw@1045
|
241
|
bsw@1045
|
242 if
|
bsw@1045
|
243 (opinion.degree > 0 and not opinion.fulfilled)
|
bsw@1045
|
244 or (opinion.degree < 0 and opinion.fulfilled)
|
bsw@1045
|
245 then
|
bsw@1045
|
246 if math.abs(opinion.degree) > 1 then
|
bsw@1045
|
247 slot.put(" !!")
|
bsw@1045
|
248 else
|
bsw@1045
|
249 slot.put(" !")
|
bsw@1045
|
250 end
|
bsw@1045
|
251 else
|
bsw@1045
|
252 slot.put(" ✓")
|
bsw@1045
|
253 end
|
bsw@1045
|
254
|
bsw@1045
|
255 end }
|
bsw@1045
|
256
|
bsw@1045
|
257 end
|
bsw@1045
|
258
|
bsw@1045
|
259
|
bsw@1045
|
260 ui.link { attr = { name = "s" .. suggestion.id }, text = "" }
|
bsw@1045
|
261 ui.heading { level = 2,
|
bsw@1045
|
262 attr = { class = "suggestionHead" },
|
bsw@1045
|
263 content = format.string(suggestion.name, {
|
bsw@1045
|
264 truncate_at = 160, truncate_suffix = true
|
bsw@1045
|
265 }) }
|
bsw@1045
|
266
|
bsw@1045
|
267
|
bsw@1045
|
268 local plus2 = (suggestion.plus2_unfulfilled_count or 0)
|
bsw@1045
|
269 + (suggestion.plus2_fulfilled_count or 0)
|
bsw@1045
|
270 local plus1 = (suggestion.plus1_unfulfilled_count or 0)
|
bsw@1045
|
271 + (suggestion.plus1_fulfilled_count or 0)
|
bsw@1045
|
272 local minus1 = (suggestion.minus1_unfulfilled_count or 0)
|
bsw@1045
|
273 + (suggestion.minus1_fulfilled_count or 0)
|
bsw@1045
|
274 local minus2 = (suggestion.minus2_unfulfilled_count or 0)
|
bsw@1045
|
275 + (suggestion.minus2_fulfilled_count or 0)
|
bsw@1045
|
276
|
bsw@1045
|
277 local with_opinion = plus2 + plus1 + minus1 + minus2
|
bsw@1045
|
278
|
bsw@1045
|
279 local neutral = (suggestion.initiative.supporter_count or 0)
|
bsw@1045
|
280 - with_opinion
|
bsw@1045
|
281
|
bsw@1045
|
282 local neutral2 = with_opinion
|
bsw@1045
|
283 - (suggestion.plus2_fulfilled_count or 0)
|
bsw@1045
|
284 - (suggestion.plus1_fulfilled_count or 0)
|
bsw@1045
|
285 - (suggestion.minus1_fulfilled_count or 0)
|
bsw@1045
|
286 - (suggestion.minus2_fulfilled_count or 0)
|
bsw@1045
|
287
|
bsw@1045
|
288 ui.container {
|
bsw@1045
|
289 attr = { class = "suggestionInfo" },
|
bsw@1045
|
290 content = function ()
|
bsw@1045
|
291
|
bsw@1045
|
292 if with_opinion > 0 then
|
bsw@1045
|
293 ui.container { attr = { class = "suggestion-rating" }, content = function ()
|
bsw@1045
|
294 ui.tag { content = _"collective rating:" }
|
bsw@1045
|
295 slot.put(" ")
|
bsw@1045
|
296 ui.bargraph{
|
bsw@1045
|
297 max_value = suggestion.initiative.supporter_count,
|
bsw@1045
|
298 width = 100,
|
bsw@1045
|
299 bars = {
|
bsw@1045
|
300 { color = "#0a0", value = plus2 },
|
bsw@1045
|
301 { color = "#8a8", value = plus1 },
|
bsw@1045
|
302 { color = "#eee", value = neutral },
|
bsw@1045
|
303 { color = "#a88", value = minus1 },
|
bsw@1045
|
304 { color = "#a00", value = minus2 },
|
bsw@1045
|
305 }
|
bsw@1045
|
306 }
|
bsw@1045
|
307 slot.put(" | ")
|
bsw@1045
|
308 ui.tag { content = _"implemented:" }
|
bsw@1045
|
309 slot.put ( " " )
|
bsw@1045
|
310 ui.bargraph{
|
bsw@1045
|
311 max_value = with_opinion,
|
bsw@1045
|
312 width = 100,
|
bsw@1045
|
313 bars = {
|
bsw@1045
|
314 { color = "#0a0", value = suggestion.plus2_fulfilled_count },
|
bsw@1045
|
315 { color = "#8a8", value = suggestion.plus1_fulfilled_count },
|
bsw@1045
|
316 { color = "#eee", value = neutral2 },
|
bsw@1045
|
317 { color = "#a88", value = suggestion.minus1_fulfilled_count },
|
bsw@1045
|
318 { color = "#a00", value = suggestion.minus2_fulfilled_count },
|
bsw@1045
|
319 }
|
bsw@1045
|
320 }
|
bsw@1045
|
321 end }
|
bsw@1045
|
322 end
|
bsw@1045
|
323
|
bsw@1045
|
324 if app.session:has_access("authors_pseudonymous") then
|
bsw@1045
|
325 util.micro_avatar ( suggestion.author )
|
bsw@1045
|
326 else
|
bsw@1045
|
327 slot.put("<br />")
|
bsw@1045
|
328 end
|
bsw@1045
|
329
|
bsw@1045
|
330 ui.container {
|
bsw@1045
|
331 attr = { class = "suggestion-text" },
|
bsw@1045
|
332 content = function ()
|
bsw@1045
|
333 slot.put ( suggestion:get_content( "html" ) )
|
bsw@1061
|
334
|
bsw@1045
|
335
|
bsw@1045
|
336 if direct_supporter then
|
bsw@1045
|
337
|
bsw@1045
|
338 ui.container {
|
bsw@1045
|
339 attr = { class = "rating" },
|
bsw@1045
|
340 content = function ()
|
bsw@1045
|
341
|
bsw@1045
|
342 if not opinion then
|
bsw@1045
|
343 opinion = {}
|
bsw@1045
|
344 end
|
bsw@1045
|
345 ui.form {
|
bsw@1045
|
346 module = "opinion", action = "update", params = {
|
bsw@1045
|
347 suggestion_id = suggestion.id
|
bsw@1045
|
348 },
|
bsw@1045
|
349 routing = { default = {
|
bsw@1045
|
350 mode = "redirect",
|
bsw@1045
|
351 module = "initiative", view = "show", id = suggestion.initiative_id,
|
bsw@1045
|
352 params = { suggestion_id = suggestion.id },
|
bsw@1045
|
353 anchor = "s" .. suggestion.id -- TODO webmcp
|
bsw@1045
|
354 } },
|
bsw@1045
|
355 content = function ()
|
bsw@1045
|
356
|
bsw@1045
|
357
|
bsw@1045
|
358 ui.heading { level = 3, content = _"Should the initiator implement this suggestion?" }
|
bsw@1045
|
359 ui.container { content = function ()
|
bsw@1045
|
360
|
bsw@1045
|
361 local active = opinion.degree == 2
|
bsw@1045
|
362 ui.tag { tag = "input", attr = {
|
bsw@1045
|
363 type = "radio", name = "degree", value = 2,
|
bsw@1045
|
364 id = "s" .. suggestion.id .. "_degree2",
|
bsw@1045
|
365 checked = active and "checked" or nil
|
bsw@1045
|
366 } }
|
bsw@1045
|
367 ui.tag {
|
bsw@1045
|
368 tag = "label",
|
bsw@1045
|
369 attr = {
|
bsw@1045
|
370 ["for"] = "s" .. suggestion.id .. "_degree2",
|
bsw@1045
|
371 class = active and "active-plus2" or nil,
|
bsw@1045
|
372 },
|
bsw@1045
|
373 content = _"must"
|
bsw@1045
|
374 }
|
bsw@1045
|
375
|
bsw@1045
|
376 local active = opinion.degree == 1
|
bsw@1045
|
377 ui.tag { tag = "input", attr = {
|
bsw@1045
|
378 type = "radio", name = "degree", value = 1,
|
bsw@1045
|
379 id = "s" .. suggestion.id .. "_degree1",
|
bsw@1045
|
380 checked = active and "checked" or nil
|
bsw@1045
|
381 } }
|
bsw@1045
|
382 ui.tag {
|
bsw@1045
|
383 tag = "label",
|
bsw@1045
|
384 attr = {
|
bsw@1045
|
385 ["for"] = "s" .. suggestion.id .. "_degree1",
|
bsw@1045
|
386 class = active and "active-plus1" or nil,
|
bsw@1045
|
387 },
|
bsw@1045
|
388 content = _"should"
|
bsw@1045
|
389 }
|
bsw@1045
|
390
|
bsw@1045
|
391 local active = not opinion.member_id
|
bsw@1045
|
392 ui.tag { tag = "input", attr = {
|
bsw@1045
|
393 type = "radio", name = "degree", value = 0,
|
bsw@1045
|
394 id = "s" .. suggestion.id .. "_degree0",
|
bsw@1045
|
395 checked = active and "checked" or nil
|
bsw@1045
|
396 } }
|
bsw@1045
|
397 ui.tag {
|
bsw@1045
|
398 tag = "label",
|
bsw@1045
|
399 attr = {
|
bsw@1045
|
400 ["for"] = "s" .. suggestion.id .. "_degree0",
|
bsw@1045
|
401 class = active and "active-neutral" or nil,
|
bsw@1045
|
402 },
|
bsw@1045
|
403 content = _"neutral"
|
bsw@1045
|
404 }
|
bsw@1045
|
405
|
bsw@1045
|
406 local active = opinion.degree == -1
|
bsw@1045
|
407 ui.tag { tag = "input", attr = {
|
bsw@1045
|
408 type = "radio", name = "degree", value = -1,
|
bsw@1045
|
409 id = "s" .. suggestion.id .. "_degree-1",
|
bsw@1045
|
410 checked = active and "checked" or nil
|
bsw@1045
|
411 } }
|
bsw@1045
|
412 ui.tag {
|
bsw@1045
|
413 tag = "label",
|
bsw@1045
|
414 attr = {
|
bsw@1045
|
415 ["for"] = "s" .. suggestion.id .. "_degree-1",
|
bsw@1045
|
416 class = active and "active-minus1" or nil,
|
bsw@1045
|
417 },
|
bsw@1045
|
418 content = _"should not"
|
bsw@1045
|
419 }
|
bsw@1045
|
420
|
bsw@1045
|
421 local active = opinion.degree == -2
|
bsw@1045
|
422 ui.tag { tag = "input", attr = {
|
bsw@1045
|
423 type = "radio", name = "degree", value = -2,
|
bsw@1045
|
424 id = "s" .. suggestion.id .. "_degree-2",
|
bsw@1045
|
425 checked = active and "checked" or nil
|
bsw@1045
|
426 } }
|
bsw@1045
|
427 ui.tag {
|
bsw@1045
|
428 tag = "label",
|
bsw@1045
|
429 attr = {
|
bsw@1045
|
430 ["for"] = "s" .. suggestion.id .. "_degree-2",
|
bsw@1045
|
431 class = active and "active-minus2" or nil,
|
bsw@1045
|
432 },
|
bsw@1045
|
433 content = _"must not"
|
bsw@1045
|
434 }
|
bsw@1045
|
435 end }
|
bsw@1045
|
436
|
bsw@1045
|
437 slot.put("<br />")
|
bsw@1045
|
438
|
bsw@1045
|
439 ui.heading { level = 3, content = _"Did the initiator implement this suggestion?" }
|
bsw@1045
|
440 ui.container { content = function ()
|
bsw@1045
|
441 local active = opinion.fulfilled == false
|
bsw@1045
|
442 ui.tag { tag = "input", attr = {
|
bsw@1045
|
443 type = "radio", name = "fulfilled", value = "false",
|
bsw@1045
|
444 id = "s" .. suggestion.id .. "_notfulfilled",
|
bsw@1045
|
445 checked = active and "checked" or nil
|
bsw@1045
|
446 } }
|
bsw@1045
|
447 ui.tag {
|
bsw@1045
|
448 tag = "label",
|
bsw@1045
|
449 attr = {
|
bsw@1045
|
450 ["for"] = "s" .. suggestion.id .. "_notfulfilled",
|
bsw@1045
|
451 class = active and "active-notfulfilled" or nil,
|
bsw@1045
|
452 },
|
bsw@1045
|
453 content = _"No (not yet)"
|
bsw@1045
|
454 }
|
bsw@1045
|
455
|
bsw@1045
|
456 local active = opinion.fulfilled
|
bsw@1045
|
457 ui.tag { tag = "input", attr = {
|
bsw@1045
|
458 type = "radio", name = "fulfilled", value = "true",
|
bsw@1045
|
459 id = "s" .. suggestion.id .. "_fulfilled",
|
bsw@1045
|
460 checked = active and "checked" or nil
|
bsw@1045
|
461 } }
|
bsw@1045
|
462 ui.tag {
|
bsw@1045
|
463 tag = "label",
|
bsw@1045
|
464 attr = {
|
bsw@1045
|
465 ["for"] = "s" .. suggestion.id .. "_fulfilled",
|
bsw@1045
|
466 class = active and "active-fulfilled" or nil,
|
bsw@1045
|
467 },
|
bsw@1045
|
468 content = _"Yes, it's implemented"
|
bsw@1045
|
469 }
|
bsw@1045
|
470 end }
|
bsw@1045
|
471 slot.put("<br />")
|
bsw@1045
|
472
|
bsw@1045
|
473 ui.tag{
|
bsw@1045
|
474 tag = "input",
|
bsw@1045
|
475 attr = {
|
bsw@1045
|
476 type = "submit",
|
bsw@1045
|
477 class = "btn btn-default",
|
bsw@1045
|
478 value = _"publish my rating"
|
bsw@1045
|
479 },
|
bsw@1045
|
480 content = ""
|
bsw@1045
|
481 }
|
bsw@1045
|
482
|
bsw@1045
|
483 end
|
bsw@1045
|
484 }
|
bsw@1045
|
485
|
bsw@1045
|
486 end -- if not issue,fully_frozen or closed
|
bsw@1045
|
487 }
|
bsw@1045
|
488 end
|
bsw@1045
|
489
|
bsw@1045
|
490 local text = _"Read more"
|
bsw@1045
|
491
|
bsw@1045
|
492 if direct_supporter then
|
bsw@1045
|
493 text = _"Show more and rate this"
|
bsw@1045
|
494 end
|
bsw@1045
|
495
|
bsw@1061
|
496 ui.link{
|
bsw@1061
|
497 attr = { class = "suggestion-details" },
|
bsw@1061
|
498 content = _"Details",
|
bsw@1061
|
499 module = "suggestion", view = "show", id = suggestion.id
|
bsw@1061
|
500 }
|
bsw@1061
|
501
|
bsw@1045
|
502 ui.link {
|
bsw@1045
|
503 attr = {
|
bsw@1045
|
504 class = "suggestion-more",
|
bsw@1045
|
505 onclick = "$('#s" .. suggestion.id .. "').removeClass('folded').addClass('unfolded'); return false;"
|
bsw@1045
|
506 },
|
bsw@1045
|
507 text = text
|
bsw@1045
|
508 }
|
bsw@1045
|
509
|
bsw@1045
|
510 ui.link {
|
bsw@1045
|
511 attr = {
|
bsw@1045
|
512 class = "suggestion-less",
|
bsw@1045
|
513 onclick = "$('#s" .. suggestion.id .. "').addClass('folded').removeClass('unfolded'); return false;"
|
bsw@1045
|
514 },
|
bsw@1045
|
515 text = _"Show less"
|
bsw@1045
|
516 }
|
bsw@1045
|
517 end
|
bsw@1045
|
518 }
|
bsw@1045
|
519
|
bsw@1045
|
520 ui.script{ script = [[
|
bsw@1045
|
521 var textEl = $('#s]] .. suggestion.id .. [[ .suggestion-text');
|
bsw@1045
|
522 var height = textEl.height();
|
bsw@1045
|
523 if (height > 150) $('#s]] .. suggestion.id .. [[').addClass('folded');
|
bsw@1045
|
524 ]] }
|
bsw@1045
|
525
|
bsw@1045
|
526 end
|
bsw@1045
|
527 } -- ui.paragraph
|
bsw@1045
|
528
|
bsw@1045
|
529
|
bsw@1045
|
530
|
bsw@1045
|
531 end } -- ui.tag "li"
|
bsw@1045
|
532
|
bsw@1045
|
533 end -- for i, suggestion
|
bsw@1045
|
534
|
bsw@1045
|
535 else -- if #initiative.suggestions > 0
|
bsw@1045
|
536
|
bsw@1045
|
537 local text
|
bsw@1045
|
538 if initiative.issue.closed then
|
bsw@1125
|
539 text = _"No suggestions"
|
bsw@1045
|
540 else
|
bsw@1125
|
541 text = _"No suggestions yet"
|
bsw@1045
|
542 end
|
bsw@1045
|
543 ui.sectionHead( function()
|
bsw@1045
|
544 ui.heading { level = 1, content = text }
|
bsw@1045
|
545 end)
|
bsw@1045
|
546
|
bsw@1045
|
547 end -- if #initiative.suggestions > 0
|
bsw@1045
|
548
|
bsw@1045
|
549 end
|
bsw@1045
|
550 }
|