liquid_feedback_frontend
diff app/main/delegation/_show_box.lua @ 19:00d1004545f1
Dynamic interface using XMLHttpRequests, and many other changes
Bugfixes:
- Only allow voting on admitted initiatives
- Repaired issue search
- Don't display delegations for closed issues on member page
- Don't show revoke link in initiative, when issue is already half_frozen
- Localization for voting JavaScript
- Display author of suggestions
Disclosure of voting data after voting is finished:
- Possibility to inspect every ballot including preferences
- Show number of voters preferring one initiative to another initiative
Interface behaviour changes:
- Reversed default order of drafts
- Default order of suggestions changed
- Show new drafts of initiatives only once per day in timeline
Accessibility:
- Barrier-free voting implemented
- POST links are now accessible without JavaScript
- Changed gray for unsatisfied supporters in bar graph to a lighter gray
Other interface improvements:
- Optical enhancements
- Dynamic interface using XMLHttpRequests
- Show usage terms in about section
- Show own membership in area listing
- Show uninformed supporters greyed out and marked with yellow question mark
- Warning box in non-admitted initiatives
- When voted, don't display voting notice and change label of voting link
- Show object counts in more tabulator heads
- Enlarged member statement input field
Miscellaneous:
- Code cleanup
- Added README file containing installation instructions
- Use new WebMCP function ui.filters{...} instead of own ui.filter and ui.order functions
Bugfixes:
- Only allow voting on admitted initiatives
- Repaired issue search
- Don't display delegations for closed issues on member page
- Don't show revoke link in initiative, when issue is already half_frozen
- Localization for voting JavaScript
- Display author of suggestions
Disclosure of voting data after voting is finished:
- Possibility to inspect every ballot including preferences
- Show number of voters preferring one initiative to another initiative
Interface behaviour changes:
- Reversed default order of drafts
- Default order of suggestions changed
- Show new drafts of initiatives only once per day in timeline
Accessibility:
- Barrier-free voting implemented
- POST links are now accessible without JavaScript
- Changed gray for unsatisfied supporters in bar graph to a lighter gray
Other interface improvements:
- Optical enhancements
- Dynamic interface using XMLHttpRequests
- Show usage terms in about section
- Show own membership in area listing
- Show uninformed supporters greyed out and marked with yellow question mark
- Warning box in non-admitted initiatives
- When voted, don't display voting notice and change label of voting link
- Show object counts in more tabulator heads
- Enlarged member statement input field
Miscellaneous:
- Code cleanup
- Added README file containing installation instructions
- Use new WebMCP function ui.filters{...} instead of own ui.filter and ui.order functions
author | bsw/jbe |
---|---|
date | Sat Feb 20 22:10:31 2010 +0100 (2010-02-20) |
parents | afd9f769c7ae |
children | bf885faf3452 |
line diff
1.1 --- a/app/main/delegation/_show_box.lua Tue Feb 02 00:31:06 2010 +0100 1.2 +++ b/app/main/delegation/_show_box.lua Sat Feb 20 22:10:31 2010 +0100 1.3 @@ -1,43 +1,106 @@ 1.4 -slot.select("actions", function() 1.5 - 1.6 - local delegation 1.7 - local area_id 1.8 - local issue_id 1.9 - 1.10 - local scope = "global" 1.11 +function change_delegation(scope, area_id, issue, delegation) 1.12 + local image 1.13 + local text 1.14 + if scope == "global" and delegation then 1.15 + image = { static = "icons/16/table_go.png" } 1.16 + text = _"Change global delegation" 1.17 + elseif scope == "global" and not delegation then 1.18 + image = { static = "icons/16/table_go.png" } 1.19 + text = _"Set global delegation" 1.20 + elseif scope == "area" and delegation and delegation.area_id then 1.21 + image = { static = "icons/16/table_go.png" } 1.22 + text = _"Change area delegation" 1.23 + elseif scope == "area" and not (delegation and delegation.area_id) then 1.24 + image = { static = "icons/16/table_go.png" } 1.25 + text = _"Set area delegation" 1.26 + elseif scope == "issue" then 1.27 + if delegation and delegation.issue_id then 1.28 + image = { static = "icons/16/table_go.png" } 1.29 + text = _"Change issue delegation" 1.30 + elseif issue.state ~= "finished" and issue.state ~= "cancelled" then 1.31 + image = { static = "icons/16/table_go.png" } 1.32 + text = _"Set issue delegation" 1.33 + end 1.34 + end 1.35 + ui.container{ 1.36 + attr = { 1.37 + class = "change_delegation", 1.38 + }, 1.39 + content = function() 1.40 + ui.link{ 1.41 + image = image, 1.42 + text = text, 1.43 + module = "delegation", 1.44 + view = "new", 1.45 + params = { 1.46 + issue_id = issue and issue.id or nil, 1.47 + area_id = area_id 1.48 + }, 1.49 + } 1.50 + if delegation then 1.51 + ui.link{ 1.52 + image = { static = "icons/16/delete.png" }, 1.53 + text = _"Revoke", 1.54 + module = "delegation", 1.55 + action = "update", 1.56 + params = { issue_id = delegation.issue_id, area_id = delegation.area_id, delete = true }, 1.57 + routing = { 1.58 + default = { 1.59 + mode = "redirect", 1.60 + module = request.get_module(), 1.61 + view = request.get_view(), 1.62 + id = param.get_id_cgi(), 1.63 + params = param.get_all_cgi() 1.64 + } 1.65 + } 1.66 + } 1.67 + end 1.68 + end 1.69 + } 1.70 +end 1.71 1.72 - if param.get("initiative_id", atom.integer) then 1.73 - issue_id = Initiative:by_id(param.get("initiative_id", atom.integer)).issue_id 1.74 - scope = "issue" 1.75 - end 1.76 +local delegation 1.77 +local area_id 1.78 +local issue_id 1.79 + 1.80 +local scope = "global" 1.81 1.82 - if param.get("issue_id", atom.integer) then 1.83 - issue_id = param.get("issue_id", atom.integer) 1.84 - scope = "issue" 1.85 - end 1.86 +if param.get("initiative_id", atom.integer) then 1.87 + issue_id = Initiative:by_id(param.get("initiative_id", atom.integer)).issue_id 1.88 + scope = "issue" 1.89 +end 1.90 1.91 - if param.get("area_id", atom.integer) then 1.92 - area_id = param.get("area_id", atom.integer) 1.93 - scope = "area" 1.94 - end 1.95 +if param.get("issue_id", atom.integer) then 1.96 + issue_id = param.get("issue_id", atom.integer) 1.97 + scope = "issue" 1.98 +end 1.99 + 1.100 +if param.get("area_id", atom.integer) then 1.101 + area_id = param.get("area_id", atom.integer) 1.102 + scope = "area" 1.103 +end 1.104 1.105 1.106 1.107 - local delegation 1.108 - local issue 1.109 - if issue_id then 1.110 - issue = Issue:by_id(issue_id) 1.111 - delegation = Delegation:by_pk(app.session.member.id, nil, issue_id) 1.112 - if not delegation then 1.113 - delegation = Delegation:by_pk(app.session.member.id, issue.area_id) 1.114 - end 1.115 - elseif area_id then 1.116 - delegation = Delegation:by_pk(app.session.member.id, area_id) 1.117 +local delegation 1.118 +local issue 1.119 +if issue_id then 1.120 + issue = Issue:by_id(issue_id) 1.121 + delegation = Delegation:by_pk(app.session.member.id, nil, issue_id) 1.122 + if not delegation then 1.123 + delegation = Delegation:by_pk(app.session.member.id, issue.area_id) 1.124 end 1.125 +elseif area_id then 1.126 + delegation = Delegation:by_pk(app.session.member.id, area_id) 1.127 +end 1.128 1.129 - if not delegation then 1.130 - delegation = Delegation:by_pk(app.session.member.id) 1.131 - end 1.132 +if not delegation then 1.133 + delegation = Delegation:by_pk(app.session.member.id) 1.134 +end 1.135 + 1.136 + 1.137 +slot.select("actions", function() 1.138 + 1.139 if delegation then 1.140 ui.container{ 1.141 attr = { class = "delegation vote_info"}, 1.142 @@ -85,6 +148,10 @@ 1.143 :add_order_by("index") 1.144 :exec() 1.145 1.146 + if not issue or (issue.state ~= "finished" and issue.state ~= "cancelled") then 1.147 + change_delegation(scope, area_id, issue, delegation) 1.148 + end 1.149 + 1.150 for i, record in ipairs(delegation_chain) do 1.151 local style 1.152 local overridden = record.overridden 1.153 @@ -115,29 +182,6 @@ 1.154 end 1.155 end 1.156 } 1.157 - if i == 2 then 1.158 - if not issue or (issue.state ~= "finished" and issue.state ~= "cancelled") then 1.159 - ui.link{ 1.160 - attr = { class = "revoke" }, 1.161 - content = function() 1.162 - ui.image{ static = "icons/16/delete.png" } 1.163 - slot.put(_"Revoke") 1.164 - end, 1.165 - module = "delegation", 1.166 - action = "update", 1.167 - params = { issue_id = delegation.issue_id, area_id = delegation.area_id, delete = true }, 1.168 - routing = { 1.169 - default = { 1.170 - mode = "redirect", 1.171 - module = request.get_module(), 1.172 - view = request.get_view(), 1.173 - id = param.get_id_cgi(), 1.174 - params = param.get_all_cgi() 1.175 - } 1.176 - } 1.177 - } 1.178 - end 1.179 - end 1.180 end 1.181 } 1.182 end 1.183 @@ -155,7 +199,7 @@ 1.184 ui.container{ 1.185 attr = { class = "delegation_participation" }, 1.186 content = function() 1.187 - slot.put("<br /><br />-----> Participation<br />") 1.188 + slot.put(_"This member is participating, the rest of delegation chain is suspended while discussing") 1.189 end 1.190 } 1.191 end 1.192 @@ -165,38 +209,7 @@ 1.193 } 1.194 end 1.195 } 1.196 - 1.197 - 1.198 + else 1.199 + change_delegation(scope, area_id, issue) 1.200 end 1.201 - ui.link{ 1.202 - content = function() 1.203 - if scope == "global" and delegation then 1.204 - ui.image{ static = "icons/16/table_go.png" } 1.205 - slot.put(_"Change global delegation") 1.206 - elseif scope == "global" and not delegation then 1.207 - ui.image{ static = "icons/16/table_go.png" } 1.208 - slot.put(_"Set global delegation") 1.209 - elseif scope == "area" and delegation and delegation.area_id then 1.210 - ui.image{ static = "icons/16/table_go.png" } 1.211 - slot.put(_"Change area delegation") 1.212 - elseif scope == "area" and not (delegation and delegation.area_id) then 1.213 - ui.image{ static = "icons/16/table_go.png" } 1.214 - slot.put(_"Set area delegation") 1.215 - elseif scope == "issue" then 1.216 - if delegation and delegation.issue_id then 1.217 - ui.image{ static = "icons/16/table_go.png" } 1.218 - slot.put(_"Change issue delegation") 1.219 - elseif issue.state ~= "finished" and issue.state ~= "cancelled" then 1.220 - ui.image{ static = "icons/16/table_go.png" } 1.221 - slot.put(_"Set issue delegation") 1.222 - end 1.223 - end 1.224 - end, 1.225 - module = "delegation", 1.226 - view = "new", 1.227 - params = { 1.228 - area_id = area_id, 1.229 - issue_id = issue_id 1.230 - } 1.231 - } 1.232 end)