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