liquid_feedback_frontend

view app/main/vote/list.lua @ 6:8d91bccab0bf

Version beta2

Possibility to browse voters of a closed issue

Registration with invite code

Email confirmation and password recovery

Download function (for database dumps) added

Critical bug solved, which made it impossible to select your opinion on other peoples suggestions

Catching error, when trying to set an opinion on a suggestion which has been meanwhile deleted

Fixed wrong sorting order for "supporters" or "potential supporters"

Added format info for birthday (Error when entering dates in wrong format is NOT fixed in this release)

Strip space characters from certain fields and ensure they contain at least 3 characters

Showing grade in opinion/list as clear text instead of integer value

More information on initiative is displayed while voting

Colored notification box shown on pages of issues or initiatives which are currently in voting state

Changed default filter for issues to "Open"

Back link on suggestion page

Some optical changes

Removed wrong space character in LICENSE file
author bsw/jbe
date Sat Jan 02 12:00:00 2010 +0100 (2010-01-02)
parents afd9f769c7ae
children 77d58efe99fd
line source
1 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."
3 ui.script{ static = "js/browser_warning.js" }
4 ui.script{ script = "checkBrowser(" .. encode.json(_"Your web browser is not fully supported yet." .. " " .. warning_text:gsub("\n", "\n\n")) .. ");" }
6 ui.tag{
7 tag = "noscript",
8 content = function()
9 slot.put(_"JavaScript is disabled or not available." .. " " .. encode.html_newlines(warning_text))
10 end
11 }
14 local issue = Issue:by_id(param.get("issue_id"), atom.integer)
16 local initiatives = issue.initiatives
18 local min_grade = -1;
19 local max_grade = 1;
21 for i, initiative in ipairs(initiatives) do
22 -- TODO performance
23 initiative.vote = Vote:by_pk(initiative.id, app.session.member.id)
24 if initiative.vote then
25 if initiative.vote.grade > max_grade then
26 max_grade = initiative.vote.grade
27 end
28 if initiative.vote.grade < min_grade then
29 min_grade = initiative.vote.grade
30 end
31 end
32 end
34 local sections = {}
35 for i = min_grade, max_grade do
36 sections[i] = {}
37 for j, initiative in ipairs(initiatives) do
38 if (initiative.vote and initiative.vote.grade == i) or (not initiative.vote and i == 0) then
39 sections[i][#(sections[i])+1] = initiative
40 end
41 end
42 end
44 slot.put_into("title", _"Voting")
46 slot.select("actions", function()
47 ui.link{
48 content = function()
49 ui.image{ static = "icons/16/cancel.png" }
50 slot.put(_"Cancel")
51 end,
52 module = "issue",
53 view = "show",
54 id = issue.id
55 }
56 end)
58 util.help("vote.list", _"Voting")
61 slot.put('<script src="' .. request.get_relative_baseurl() .. 'static/js/dragdrop.js"></script>')
62 slot.put('<script src="' .. request.get_relative_baseurl() .. 'static/js/voting.js"></script>')
64 ui.form{
65 attr = { id = "voting_form" },
66 module = "vote",
67 action = "update",
68 params = { issue_id = issue.id },
69 routing = {
70 default = {
71 mode = "redirect",
72 module = "issue",
73 view = "show",
74 id = issue.id
75 }
76 },
77 content = function()
78 slot.put('<input type="hidden" name="scoring" value=""/>')
79 -- TODO abstrahieren
80 ui.tag{
81 tag = "input",
82 attr = {
83 type = "button",
84 class = "voting_done",
85 value = _"Finish voting"
86 }
87 }
88 ui.container{
89 attr = { id = "voting" },
90 content = function()
91 for grade = max_grade, min_grade, -1 do
92 local section = sections[grade]
93 local class
94 if grade > 0 then
95 class = "approval"
96 elseif grade < 0 then
97 class = "disapproval"
98 else
99 class = "abstention"
100 end
101 ui.container{
102 attr = { class = class },
103 content = function()
104 slot.put('<div class="cathead"></div>')
105 for i, initiative in ipairs(section) do
106 ui.container{
107 attr = {
108 class = "movable",
109 id = "entry_" .. tostring(initiative.id)
110 },
111 content = function()
112 local initiators = initiative.initiating_members
113 local initiator_names = {}
114 for i, initiator in ipairs(initiators) do
115 initiator_names[#initiator_names+1] = initiator.name
116 end
117 local initiator_names_string = table.concat(initiator_names, ", ")
118 ui.container{
119 attr = { style = "float: right;" },
120 content = function()
121 ui.link{
122 attr = { class = "clickable" },
123 content = _"Show",
124 module = "initiative",
125 view = "show",
126 id = initiative.id
127 }
128 slot.put(" ")
129 ui.link{
130 attr = { class = "clickable", target = "_blank" },
131 content = _"(new window)",
132 module = "initiative",
133 view = "show",
134 id = initiative.id
135 }
136 slot.put(" ")
137 ui.image{ attr = { class = "grabber" }, static = "icons/grabber.png" }
138 end
139 }
140 slot.put(encode.html(initiative.shortened_name))
141 if #initiators > 1 then
142 ui.container{
143 attr = { style = "font-size: 80%;" },
144 content = _"Initiators" .. ": " .. initiator_names_string
145 }
146 else
147 ui.container{
148 attr = { style = "font-size: 80%;" },
149 content = _"Initiator" .. ": " .. initiator_names_string
150 }
151 end
152 end
153 }
154 end
155 end
156 }
157 end
158 end
159 }
160 ui.tag{
161 tag = "input",
162 attr = {
163 type = "button",
164 class = "voting_done",
165 value = _"Finish voting"
166 }
167 }
168 end
169 }

Impressum / About Us