liquid_feedback_frontend
diff app/main/issue/_show_vote_later_box.lua @ 16:559c6be0e1e9
"Vote later" feature; Refactored interest box
| author | bsw |
|---|---|
| date | Tue Feb 02 00:10:17 2010 +0100 (2010-02-02) |
| parents | |
| children | 00d1004545f1 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/issue/_show_vote_later_box.lua Tue Feb 02 00:10:17 2010 +0100 1.3 @@ -0,0 +1,79 @@ 1.4 +local issue = param.get("issue", "table") 1.5 + 1.6 + 1.7 +if issue.closed and issue.half_frozen then 1.8 + return 1.9 +end 1.10 + 1.11 +local interest = Interest:by_pk(issue.id, app.session.member.id) 1.12 + 1.13 +if not interest then 1.14 + return 1.15 +end 1.16 + 1.17 +if interest.voting_requested ~= nil then 1.18 + slot.select("actions", function() 1.19 + 1.20 + ui.container{ 1.21 + attr = { class = "voting_requested vote_info"}, 1.22 + content = function() 1.23 + ui.container{ 1.24 + attr = { 1.25 + class = "head head_active", 1.26 + onclick = "document.getElementById('voting_requested_content').style.display = 'block';" 1.27 + }, 1.28 + content = function() 1.29 + if interest.voting_requested == false then 1.30 + ui.image{ 1.31 + static = "icons/16/clock_play.png" 1.32 + } 1.33 + slot.put(_"You want to vote later") 1.34 + ui.image{ 1.35 + static = "icons/16/dropdown.png" 1.36 + } 1.37 + end 1.38 + end 1.39 + } 1.40 + ui.container{ 1.41 + attr = { class = "content", id = "voting_requested_content" }, 1.42 + content = function() 1.43 + ui.container{ 1.44 + attr = { 1.45 + class = "close", 1.46 + style = "cursor: pointer;", 1.47 + onclick = "document.getElementById('voting_requested_content').style.display = 'none';" 1.48 + }, 1.49 + content = function() 1.50 + ui.image{ static = "icons/16/cross.png" } 1.51 + end 1.52 + } 1.53 + ui.link{ 1.54 + content = _"Remove my request to vote later", 1.55 + module = "interest", 1.56 + action = "update_voting_requested", 1.57 + params = { issue_id = issue.id, voting_requested = nil }, 1.58 + routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } } 1.59 + } 1.60 + slot.put("<br />") 1.61 + end 1.62 + } 1.63 + end 1.64 + } 1.65 + end) 1.66 +else 1.67 + if not issue.closed and not issue.half_frozen then 1.68 + ui.link{ 1.69 + content = function() 1.70 + ui.image{ static = "icons/16/clock_play.png" } 1.71 + slot.put(_"Vote later") 1.72 + end, 1.73 + module = "interest", 1.74 + action = "update_voting_requested", 1.75 + params = { 1.76 + issue_id = issue.id, 1.77 + voting_requested = false 1.78 + }, 1.79 + routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } } 1.80 + } 1.81 + end 1.82 +end 1.83 \ No newline at end of file