rev |
line source |
bsw/jbe@19
|
1 local issue = Issue:by_id(param.get("issue_id"), atom.integer)
|
bsw/jbe@19
|
2
|
bsw/jbe@19
|
3 local member_id = param.get("member_id", atom.integer)
|
bsw/jbe@19
|
4 local member
|
bsw/jbe@19
|
5
|
bsw/jbe@19
|
6 local readonly = false
|
bsw/jbe@19
|
7 if member_id then
|
bsw/jbe@19
|
8 if not issue.closed then
|
bsw/jbe@19
|
9 error("access denied")
|
bsw/jbe@19
|
10 end
|
bsw/jbe@19
|
11 member = Member:by_id(member_id)
|
bsw/jbe@19
|
12 readonly = true
|
bsw/jbe@19
|
13 end
|
bsw/jbe@19
|
14
|
poelzi@138
|
15 if issue.closed then
|
poelzi@138
|
16 slot.put_into("error", _"This issue is already closed.")
|
poelzi@138
|
17
|
poelzi@138
|
18 slot.select("actions", function()
|
poelzi@138
|
19 ui.link{
|
poelzi@138
|
20 content = _("Issue ##{id}", { id = issue.id }),
|
poelzi@138
|
21 module = "issue",
|
poelzi@138
|
22 view = "show",
|
poelzi@138
|
23 id = issue.id
|
poelzi@138
|
24 }
|
poelzi@138
|
25 end
|
poelzi@138
|
26 )
|
poelzi@138
|
27 return
|
poelzi@138
|
28 end
|
poelzi@138
|
29
|
bsw/jbe@19
|
30 if member then
|
bsw/jbe@19
|
31 slot.put_into("title", _("Ballot of '#{member_name}' for issue ##{issue_id}", {
|
bsw/jbe@19
|
32 member_name = member.name,
|
bsw/jbe@19
|
33 issue_id = issue.id
|
bsw/jbe@19
|
34 }))
|
bsw/jbe@19
|
35 else
|
bsw/jbe@19
|
36 member = app.session.member
|
bsw/jbe@19
|
37 slot.put_into("title", _"Voting")
|
bsw/jbe@19
|
38
|
bsw/jbe@19
|
39 slot.select("actions", function()
|
bsw/jbe@19
|
40 ui.link{
|
bsw/jbe@19
|
41 content = function()
|
bsw/jbe@19
|
42 ui.image{ static = "icons/16/cancel.png" }
|
bsw/jbe@19
|
43 slot.put(_"Cancel")
|
bsw/jbe@19
|
44 end,
|
bsw/jbe@19
|
45 module = "issue",
|
bsw/jbe@19
|
46 view = "show",
|
bsw/jbe@19
|
47 id = issue.id
|
bsw/jbe@19
|
48 }
|
bsw@26
|
49 ui.link{
|
bsw@86
|
50 text = _"Discard voting",
|
bsw@26
|
51 content = function()
|
bsw@26
|
52 ui.image{ static = "icons/16/email_delete.png" }
|
bsw@26
|
53 slot.put(_"Discard voting")
|
bsw@26
|
54 end,
|
bsw@26
|
55 module = "vote",
|
bsw@26
|
56 action = "update",
|
bsw@26
|
57 params = {
|
bsw@26
|
58 issue_id = issue.id,
|
bsw@26
|
59 discard = true
|
bsw@26
|
60 },
|
bsw@26
|
61 routing = {
|
bsw@26
|
62 default = {
|
bsw@26
|
63 mode = "redirect",
|
bsw@26
|
64 module = "issue",
|
bsw@26
|
65 view = "show",
|
bsw@26
|
66 id = issue.id
|
bsw@26
|
67 }
|
bsw@26
|
68 }
|
bsw@26
|
69 }
|
bsw/jbe@19
|
70 end)
|
bsw/jbe@19
|
71 end
|
bsw/jbe@19
|
72
|
bsw/jbe@19
|
73
|
bsw/jbe@5
|
74 local warning_text = _"Some JavaScript based functions (voting in particular) will not work.\nFor this beta, please use a current version of Firefox, Safari, Opera(?), Konqueror or another (more) standard compliant browser.\nAlternative access without JavaScript will be available soon."
|
bsw/jbe@5
|
75
|
bsw/jbe@5
|
76 ui.script{ static = "js/browser_warning.js" }
|
bsw/jbe@5
|
77 ui.script{ script = "checkBrowser(" .. encode.json(_"Your web browser is not fully supported yet." .. " " .. warning_text:gsub("\n", "\n\n")) .. ");" }
|
bsw/jbe@5
|
78
|
bsw/jbe@19
|
79
|
bsw/jbe@19
|
80 local tempvoting_string = param.get("scoring")
|
bsw/jbe@19
|
81
|
bsw/jbe@19
|
82 local tempvotings = {}
|
bsw/jbe@19
|
83 if tempvoting_string then
|
bsw/jbe@19
|
84 for match in tempvoting_string:gmatch("([^;]+)") do
|
bsw/jbe@19
|
85 for initiative_id, grade in match:gmatch("([^:;]+):([^:;]+)") do
|
bsw/jbe@19
|
86 tempvotings[tonumber(initiative_id)] = tonumber(grade)
|
bsw/jbe@19
|
87 end
|
bsw/jbe@5
|
88 end
|
bsw/jbe@19
|
89 end
|
bsw/jbe@5
|
90
|
bsw@95
|
91 local initiatives = issue:get_reference_selector("initiatives"):add_where("initiative.admitted"):add_order_by("initiative.satisfied_supporter_count DESC"):exec()
|
bsw/jbe@5
|
92
|
bsw/jbe@5
|
93 local min_grade = -1;
|
bsw/jbe@5
|
94 local max_grade = 1;
|
bsw/jbe@5
|
95
|
bsw/jbe@5
|
96 for i, initiative in ipairs(initiatives) do
|
bsw/jbe@5
|
97 -- TODO performance
|
bsw/jbe@19
|
98 initiative.vote = Vote:by_pk(initiative.id, member.id)
|
bsw/jbe@19
|
99 if tempvotings[initiative.id] then
|
bsw/jbe@19
|
100 initiative.vote = {}
|
bsw/jbe@19
|
101 initiative.vote.grade = tempvotings[initiative.id]
|
bsw/jbe@19
|
102 end
|
bsw/jbe@5
|
103 if initiative.vote then
|
bsw/jbe@5
|
104 if initiative.vote.grade > max_grade then
|
bsw/jbe@5
|
105 max_grade = initiative.vote.grade
|
bsw/jbe@5
|
106 end
|
bsw/jbe@5
|
107 if initiative.vote.grade < min_grade then
|
bsw/jbe@5
|
108 min_grade = initiative.vote.grade
|
bsw/jbe@5
|
109 end
|
bsw/jbe@5
|
110 end
|
bsw/jbe@5
|
111 end
|
bsw/jbe@5
|
112
|
bsw/jbe@5
|
113 local sections = {}
|
bsw/jbe@5
|
114 for i = min_grade, max_grade do
|
bsw/jbe@5
|
115 sections[i] = {}
|
bsw/jbe@5
|
116 for j, initiative in ipairs(initiatives) do
|
bsw/jbe@5
|
117 if (initiative.vote and initiative.vote.grade == i) or (not initiative.vote and i == 0) then
|
bsw/jbe@5
|
118 sections[i][#(sections[i])+1] = initiative
|
bsw/jbe@5
|
119 end
|
bsw/jbe@5
|
120 end
|
bsw/jbe@5
|
121 end
|
bsw/jbe@5
|
122
|
bsw/jbe@19
|
123 local approval_count, disapproval_count = 0, 0
|
bsw/jbe@19
|
124 for i = min_grade, -1 do
|
bsw/jbe@19
|
125 if #sections[i] > 0 then
|
bsw/jbe@19
|
126 disapproval_count = disapproval_count + 1
|
bsw/jbe@19
|
127 end
|
bsw/jbe@19
|
128 end
|
bsw/jbe@19
|
129 local approval_count = 0
|
bsw/jbe@19
|
130 for i = 1, max_grade do
|
bsw/jbe@19
|
131 if #sections[i] > 0 then
|
bsw/jbe@19
|
132 approval_count = approval_count + 1
|
bsw/jbe@19
|
133 end
|
bsw/jbe@19
|
134 end
|
bsw/jbe@5
|
135
|
bsw/jbe@5
|
136
|
bsw/jbe@5
|
137
|
bsw/jbe@19
|
138 if not readonly then
|
bsw/jbe@19
|
139 util.help("vote.list", _"Voting")
|
bsw/jbe@19
|
140 slot.put('<script src="' .. request.get_relative_baseurl() .. 'static/js/dragdrop.js"></script>')
|
bsw/jbe@19
|
141 slot.put('<script src="' .. request.get_relative_baseurl() .. 'static/js/voting.js"></script>')
|
bsw/jbe@19
|
142 end
|
bsw/jbe@19
|
143
|
bsw/jbe@19
|
144 ui.script{
|
bsw/jbe@19
|
145 script = function()
|
bsw/jbe@19
|
146 slot.put(
|
bsw/jbe@19
|
147 "voting_text_approval_single = ", encode.json(_"Approval [single entry]"), ";\n",
|
bsw/jbe@19
|
148 "voting_text_approval_multi = ", encode.json(_"Approval [many entries]"), ";\n",
|
bsw/jbe@19
|
149 "voting_text_first_preference_single = ", encode.json(_"Approval (first preference) [single entry]"), ";\n",
|
bsw/jbe@19
|
150 "voting_text_first_preference_multi = ", encode.json(_"Approval (first preference) [many entries]"), ";\n",
|
bsw/jbe@19
|
151 "voting_text_second_preference_single = ", encode.json(_"Approval (second preference) [single entry]"), ";\n",
|
bsw/jbe@19
|
152 "voting_text_second_preference_multi = ", encode.json(_"Approval (second preference) [many entries]"), ";\n",
|
bsw/jbe@19
|
153 "voting_text_third_preference_single = ", encode.json(_"Approval (third preference) [single entry]"), ";\n",
|
bsw/jbe@19
|
154 "voting_text_third_preference_multi = ", encode.json(_"Approval (third preference) [many entries]"), ";\n",
|
bsw/jbe@19
|
155 "voting_text_numeric_preference_single = ", encode.json(_"Approval (#th preference) [single entry]"), ";\n",
|
bsw/jbe@19
|
156 "voting_text_numeric_preference_multi = ", encode.json(_"Approval (#th preference) [many entries]"), ";\n",
|
bsw/jbe@19
|
157 "voting_text_abstention_single = ", encode.json(_"Abstention [single entry]"), ";\n",
|
bsw/jbe@19
|
158 "voting_text_abstention_multi = ", encode.json(_"Abstention [many entries]"), ";\n",
|
bsw/jbe@19
|
159 "voting_text_disapproval_above_one_single = ", encode.json(_"Disapproval (prefer to lower block) [single entry]"), ";\n",
|
bsw/jbe@19
|
160 "voting_text_disapproval_above_one_multi = ", encode.json(_"Disapproval (prefer to lower block) [many entries]"), ";\n",
|
bsw/jbe@19
|
161 "voting_text_disapproval_above_many_single = ", encode.json(_"Disapproval (prefer to lower blocks) [single entry]"), ";\n",
|
bsw/jbe@19
|
162 "voting_text_disapproval_above_many_multi = ", encode.json(_"Disapproval (prefer to lower blocks) [many entries]"), ";\n",
|
bsw/jbe@19
|
163 "voting_text_disapproval_above_last_single = ", encode.json(_"Disapproval (prefer to last block) [single entry]"), ";\n",
|
bsw/jbe@19
|
164 "voting_text_disapproval_above_last_multi = ", encode.json(_"Disapproval (prefer to last block) [many entries]"), ";\n",
|
bsw/jbe@19
|
165 "voting_text_disapproval_single = ", encode.json(_"Disapproval [single entry]"), ";\n",
|
bsw/jbe@19
|
166 "voting_text_disapproval_multi = ", encode.json(_"Disapproval [many entries]"), ";\n"
|
bsw/jbe@19
|
167 )
|
bsw/jbe@19
|
168 end
|
bsw/jbe@19
|
169 }
|
bsw/jbe@5
|
170
|
bsw/jbe@5
|
171 ui.form{
|
bsw/jbe@19
|
172 attr = {
|
bsw/jbe@19
|
173 id = "voting_form",
|
bsw/jbe@19
|
174 class = readonly and "voting_form_readonly" or "voting_form_active"
|
bsw/jbe@19
|
175 },
|
bsw/jbe@5
|
176 module = "vote",
|
bsw/jbe@5
|
177 action = "update",
|
bsw/jbe@5
|
178 params = { issue_id = issue.id },
|
bsw/jbe@5
|
179 routing = {
|
bsw/jbe@5
|
180 default = {
|
bsw/jbe@5
|
181 mode = "redirect",
|
bsw/jbe@5
|
182 module = "issue",
|
bsw/jbe@5
|
183 view = "show",
|
bsw/jbe@5
|
184 id = issue.id
|
bsw/jbe@5
|
185 }
|
bsw/jbe@5
|
186 },
|
bsw/jbe@5
|
187 content = function()
|
bsw/jbe@19
|
188 if not readonly then
|
bsw/jbe@19
|
189 local scoring = param.get("scoring")
|
bsw/jbe@19
|
190 if not scoring then
|
bsw/jbe@19
|
191 for i, initiative in ipairs(initiatives) do
|
bsw/jbe@19
|
192 local vote = initiative.vote
|
bsw/jbe@19
|
193 if vote then
|
bsw/jbe@19
|
194 tempvotings[initiative.id] = vote.grade
|
bsw/jbe@19
|
195 end
|
bsw/jbe@19
|
196 end
|
bsw/jbe@19
|
197 local tempvotings_list = {}
|
bsw/jbe@19
|
198 for key, val in pairs(tempvotings) do
|
bsw/jbe@19
|
199 tempvotings_list[#tempvotings_list+1] = tostring(key) .. ":" .. tostring(val)
|
bsw/jbe@19
|
200 end
|
bsw/jbe@19
|
201 if #tempvotings_list > 0 then
|
bsw/jbe@19
|
202 scoring = table.concat(tempvotings_list, ";")
|
bsw/jbe@19
|
203 else
|
bsw/jbe@19
|
204 scoring = ""
|
bsw/jbe@19
|
205 end
|
bsw/jbe@19
|
206 end
|
bsw/jbe@19
|
207 slot.put('<input type="hidden" name="scoring" value="' .. scoring .. '"/>')
|
bsw/jbe@19
|
208 -- TODO abstrahieren
|
bsw/jbe@19
|
209 ui.tag{
|
bsw/jbe@19
|
210 tag = "input",
|
bsw/jbe@19
|
211 attr = {
|
bsw@86
|
212 type = "submit",
|
bsw/jbe@19
|
213 class = "voting_done",
|
bsw/jbe@19
|
214 value = _"Finish voting"
|
bsw/jbe@19
|
215 }
|
bsw/jbe@5
|
216 }
|
bsw/jbe@19
|
217 end
|
bsw/jbe@5
|
218 ui.container{
|
bsw/jbe@5
|
219 attr = { id = "voting" },
|
bsw/jbe@5
|
220 content = function()
|
bsw/jbe@19
|
221 local approval_index, disapproval_index = 0, 0
|
bsw/jbe@5
|
222 for grade = max_grade, min_grade, -1 do
|
bsw/jbe@19
|
223 local entries = sections[grade]
|
bsw/jbe@5
|
224 local class
|
bsw/jbe@5
|
225 if grade > 0 then
|
bsw/jbe@5
|
226 class = "approval"
|
bsw/jbe@5
|
227 elseif grade < 0 then
|
bsw/jbe@5
|
228 class = "disapproval"
|
bsw/jbe@5
|
229 else
|
bsw/jbe@5
|
230 class = "abstention"
|
bsw/jbe@5
|
231 end
|
bsw/jbe@19
|
232 if
|
bsw/jbe@19
|
233 #entries > 0 or
|
bsw/jbe@19
|
234 (grade == 1 and not approval_used) or
|
bsw/jbe@19
|
235 (grade == -1 and not disapproval_used) or
|
bsw/jbe@19
|
236 grade == 0
|
bsw/jbe@19
|
237 then
|
bsw/jbe@19
|
238 ui.container{
|
bsw/jbe@19
|
239 attr = { class = class },
|
bsw/jbe@19
|
240 content = function()
|
bsw/jbe@19
|
241 local heading
|
bsw/jbe@19
|
242 if class == "approval" then
|
bsw/jbe@19
|
243 approval_used = true
|
bsw/jbe@19
|
244 approval_index = approval_index + 1
|
bsw/jbe@19
|
245 if approval_count > 1 then
|
bsw/jbe@19
|
246 if approval_index == 1 then
|
bsw/jbe@19
|
247 if #entries == 1 then
|
bsw/jbe@19
|
248 heading = _"Approval (first preference) [single entry]"
|
bsw/jbe@19
|
249 else
|
bsw/jbe@19
|
250 heading = _"Approval (first preference) [many entries]"
|
bsw/jbe@19
|
251 end
|
bsw/jbe@19
|
252 elseif approval_index == 2 then
|
bsw/jbe@19
|
253 if #entries == 1 then
|
bsw/jbe@19
|
254 heading = _"Approval (second preference) [single entry]"
|
bsw/jbe@19
|
255 else
|
bsw/jbe@19
|
256 heading = _"Approval (second preference) [many entries]"
|
bsw/jbe@19
|
257 end
|
bsw/jbe@19
|
258 elseif approval_index == 3 then
|
bsw/jbe@19
|
259 if #entries == 1 then
|
bsw/jbe@19
|
260 heading = _"Approval (third preference) [single entry]"
|
bsw/jbe@19
|
261 else
|
bsw/jbe@19
|
262 heading = _"Approval (third preference) [many entries]"
|
bsw/jbe@19
|
263 end
|
bsw/jbe@19
|
264 else
|
bsw/jbe@19
|
265 if #entries == 1 then
|
bsw/jbe@19
|
266 heading = _"Approval (#th preference) [single entry]"
|
bsw/jbe@19
|
267 else
|
bsw/jbe@19
|
268 heading = _"Approval (#th preference) [many entries]"
|
bsw/jbe@19
|
269 end
|
bsw/jbe@19
|
270 end
|
bsw/jbe@19
|
271 else
|
bsw/jbe@19
|
272 if #entries == 1 then
|
bsw/jbe@19
|
273 heading = _"Approval [single entry]"
|
bsw/jbe@19
|
274 else
|
bsw/jbe@19
|
275 heading = _"Approval [many entries]"
|
bsw/jbe@19
|
276 end
|
bsw/jbe@19
|
277 end
|
bsw/jbe@19
|
278 elseif class == "abstention" then
|
bsw/jbe@19
|
279 if #entries == 1 then
|
bsw/jbe@19
|
280 heading = _"Abstention [single entry]"
|
bsw/jbe@19
|
281 else
|
bsw/jbe@19
|
282 heading = _"Abstention [many entries]"
|
bsw/jbe@19
|
283 end
|
bsw/jbe@19
|
284 elseif class == "disapproval" then
|
bsw/jbe@19
|
285 disapproval_used = true
|
bsw/jbe@19
|
286 disapproval_index = disapproval_index + 1
|
bsw/jbe@19
|
287 if disapproval_count > disapproval_index + 1 then
|
bsw/jbe@19
|
288 if #entries == 1 then
|
bsw/jbe@19
|
289 heading = _"Disapproval (prefer to lower blocks) [single entry]"
|
bsw/jbe@19
|
290 else
|
bsw/jbe@19
|
291 heading = _"Disapproval (prefer to lower blocks) [many entries]"
|
bsw/jbe@19
|
292 end
|
bsw/jbe@19
|
293 elseif disapproval_count == 2 and disapproval_index == 1 then
|
bsw/jbe@19
|
294 if #entries == 1 then
|
bsw/jbe@19
|
295 heading = _"Disapproval (prefer to lower block) [single entry]"
|
bsw/jbe@19
|
296 else
|
bsw/jbe@19
|
297 heading = _"Disapproval (prefer to lower block) [many entries]"
|
bsw/jbe@19
|
298 end
|
bsw/jbe@19
|
299 elseif disapproval_index == disapproval_count - 1 then
|
bsw/jbe@19
|
300 if #entries == 1 then
|
bsw/jbe@19
|
301 heading = _"Disapproval (prefer to last block) [single entry]"
|
bsw/jbe@19
|
302 else
|
bsw/jbe@19
|
303 heading = _"Disapproval (prefer to last block) [many entries]"
|
bsw/jbe@19
|
304 end
|
bsw/jbe@19
|
305 else
|
bsw/jbe@19
|
306 if #entries == 1 then
|
bsw/jbe@19
|
307 heading = _"Disapproval [single entry]"
|
bsw/jbe@19
|
308 else
|
bsw/jbe@19
|
309 heading = _"Disapproval [many entries]"
|
bsw/jbe@6
|
310 end
|
bsw/jbe@19
|
311 end
|
bsw/jbe@19
|
312 end
|
bsw/jbe@19
|
313 ui.tag {
|
bsw/jbe@19
|
314 tag = "div",
|
bsw/jbe@19
|
315 attr = { class = "cathead" },
|
bsw/jbe@19
|
316 content = heading
|
bsw/jbe@19
|
317 }
|
bsw/jbe@19
|
318 for i, initiative in ipairs(entries) do
|
bsw/jbe@19
|
319 ui.container{
|
bsw/jbe@19
|
320 attr = {
|
bsw/jbe@19
|
321 class = "movable",
|
bsw/jbe@19
|
322 id = "entry_" .. tostring(initiative.id)
|
bsw/jbe@19
|
323 },
|
bsw/jbe@19
|
324 content = function()
|
bsw/jbe@19
|
325 local initiators_selector = initiative:get_reference_selector("initiating_members")
|
bsw/jbe@19
|
326 :add_where("accepted")
|
bsw/jbe@19
|
327 local initiators = initiators_selector:exec()
|
bsw/jbe@19
|
328 local initiator_names = {}
|
bsw/jbe@19
|
329 for i, initiator in ipairs(initiators) do
|
bsw/jbe@19
|
330 initiator_names[#initiator_names+1] = initiator.name
|
bsw/jbe@19
|
331 end
|
bsw/jbe@19
|
332 local initiator_names_string = table.concat(initiator_names, ", ")
|
bsw/jbe@19
|
333 ui.container{
|
bsw/jbe@19
|
334 attr = { style = "float: right;" },
|
bsw/jbe@19
|
335 content = function()
|
bsw/jbe@19
|
336 ui.link{
|
bsw/jbe@19
|
337 attr = { class = "clickable" },
|
bsw/jbe@19
|
338 content = _"Show",
|
bsw/jbe@19
|
339 module = "initiative",
|
bsw/jbe@19
|
340 view = "show",
|
bsw/jbe@19
|
341 id = initiative.id
|
bsw/jbe@19
|
342 }
|
bsw/jbe@19
|
343 slot.put(" ")
|
bsw/jbe@19
|
344 ui.link{
|
bsw/jbe@19
|
345 attr = { class = "clickable", target = "_blank" },
|
bsw/jbe@19
|
346 content = _"(new window)",
|
bsw/jbe@19
|
347 module = "initiative",
|
bsw/jbe@19
|
348 view = "show",
|
bsw/jbe@19
|
349 id = initiative.id
|
bsw/jbe@19
|
350 }
|
bsw/jbe@19
|
351 if not readonly then
|
bsw/jbe@19
|
352 slot.put(" ")
|
bsw/jbe@19
|
353 ui.image{ attr = { class = "grabber" }, static = "icons/grabber.png" }
|
bsw/jbe@19
|
354 end
|
bsw/jbe@19
|
355 end
|
bsw/jbe@19
|
356 }
|
bsw/jbe@19
|
357 if not readonly then
|
bsw/jbe@19
|
358 ui.container{
|
bsw/jbe@19
|
359 attr = { style = "float: left;" },
|
bsw/jbe@19
|
360 content = function()
|
bsw/jbe@19
|
361 ui.tag{
|
bsw/jbe@19
|
362 tag = "input",
|
bsw/jbe@19
|
363 attr = {
|
bsw/jbe@19
|
364 onclick = "voting_moveUp(this.parentNode.parentNode); return(false);",
|
bsw/jbe@19
|
365 name = "move_up",
|
bsw/jbe@19
|
366 value = initiative.id,
|
bsw/jbe@19
|
367 class = not disabled and "clickable" or nil,
|
bsw/jbe@19
|
368 type = "image",
|
bsw/jbe@19
|
369 src = encode.url{ static = "icons/move_up.png" },
|
bsw/jbe@19
|
370 alt = _"Move up"
|
bsw/jbe@19
|
371 }
|
bsw/jbe@19
|
372 }
|
bsw/jbe@19
|
373 slot.put(" ")
|
bsw/jbe@19
|
374 ui.tag{
|
bsw/jbe@19
|
375 tag = "input",
|
bsw/jbe@19
|
376 attr = {
|
bsw/jbe@19
|
377 onclick = "voting_moveDown(this.parentNode.parentNode); return(false);",
|
bsw/jbe@19
|
378 name = "move_down",
|
bsw/jbe@19
|
379 value = initiative.id,
|
bsw/jbe@19
|
380 class = not disabled and "clickable" or nil,
|
bsw/jbe@19
|
381 type = "image",
|
bsw/jbe@19
|
382 src = encode.url{ static = "icons/move_down.png" },
|
bsw/jbe@19
|
383 alt = _"Move down"
|
bsw/jbe@19
|
384 }
|
bsw/jbe@19
|
385 }
|
bsw/jbe@19
|
386 slot.put(" ")
|
bsw/jbe@19
|
387 end
|
bsw/jbe@6
|
388 }
|
bsw/jbe@6
|
389 end
|
bsw/jbe@6
|
390 ui.container{
|
bsw/jbe@19
|
391 content = function()
|
bsw/jbe@19
|
392 slot.put(encode.html(initiative.shortened_name))
|
bsw/jbe@19
|
393 if #initiators > 1 then
|
bsw/jbe@19
|
394 ui.container{
|
bsw/jbe@19
|
395 attr = { style = "font-size: 80%;" },
|
bsw/jbe@19
|
396 content = _"Initiators" .. ": " .. initiator_names_string
|
bsw/jbe@19
|
397 }
|
bsw/jbe@19
|
398 else
|
bsw/jbe@19
|
399 ui.container{
|
bsw/jbe@19
|
400 attr = { style = "font-size: 80%;" },
|
bsw/jbe@19
|
401 content = _"Initiator" .. ": " .. initiator_names_string
|
bsw/jbe@19
|
402 }
|
bsw/jbe@19
|
403 end
|
bsw/jbe@19
|
404 end
|
bsw/jbe@6
|
405 }
|
bsw/jbe@6
|
406 end
|
bsw/jbe@19
|
407 }
|
bsw/jbe@19
|
408 end
|
bsw/jbe@5
|
409 end
|
bsw/jbe@19
|
410 }
|
bsw/jbe@19
|
411 end
|
bsw/jbe@5
|
412 end
|
bsw/jbe@5
|
413 end
|
bsw/jbe@5
|
414 }
|
bsw/jbe@19
|
415 if not readonly then
|
bsw/jbe@19
|
416 ui.tag{
|
bsw/jbe@19
|
417 tag = "input",
|
bsw/jbe@19
|
418 attr = {
|
bsw@86
|
419 type = "submit",
|
bsw/jbe@19
|
420 class = "voting_done",
|
bsw/jbe@19
|
421 value = _"Finish voting"
|
bsw/jbe@19
|
422 }
|
bsw/jbe@5
|
423 }
|
bsw/jbe@19
|
424 end
|
bsw/jbe@5
|
425 end
|
bsw/jbe@5
|
426 }
|
bsw/jbe@5
|
427
|
bsw/jbe@5
|
428
|