liquid_feedback_frontend
diff app/main/initiative/show_support.lua @ 273:7196685f9dd7
More optical enhancements, more repositioning
| author | bsw |
|---|---|
| date | Wed Feb 08 18:49:22 2012 +0100 (2012-02-08) |
| parents | d13b27a37ad5 |
| children | fc14e76afe31 |
line diff
1.1 --- a/app/main/initiative/show_support.lua Wed Feb 08 00:55:17 2012 +0100 1.2 +++ b/app/main/initiative/show_support.lua Wed Feb 08 18:49:22 2012 +0100 1.3 @@ -9,21 +9,107 @@ 1.4 id = initiative.id, 1.5 target = "initiative_" .. tostring(initiative.id) .. "_support", 1.6 content = function() 1.7 + 1.8 ui.container{ 1.9 - attr = { 1.10 - class = "slot_support vote_info", 1.11 - }, 1.12 + attr = { class = "actions" }, 1.13 content = function() 1.14 - ui.container{ 1.15 - attr = { class = "actions" }, 1.16 - content = function() 1.17 - execute.view{ 1.18 - module = "supporter", 1.19 - view = "_show_box", 1.20 - params = { initiative = initiative } 1.21 + 1.22 + local initiative = param.get("initiative", "table") 1.23 + local supporter = Supporter:by_pk(initiative.id, app.session.member.id) 1.24 + 1.25 + local unique_string = multirand.string(16, '0123456789abcdef') 1.26 + 1.27 + 1.28 + local partial = { 1.29 + routing = { 1.30 + default = { 1.31 + mode = "redirect", 1.32 + module = "initiative", 1.33 + view = "show_support", 1.34 + id = initiative.id 1.35 } 1.36 + } 1.37 + } 1.38 + 1.39 + local routing = { 1.40 + default = { 1.41 + mode = "redirect", 1.42 + module = request.get_module(), 1.43 + view = request.get_view(), 1.44 + id = param.get_id_cgi(), 1.45 + params = param.get_all_cgi() 1.46 + } 1.47 + } 1.48 + 1.49 + if not initiative.issue.fully_frozen and not initiative.issue.closed then 1.50 + if supporter then 1.51 + if not supporter:has_critical_opinion() then 1.52 + ui.tag{ content = function() 1.53 + ui.image{ 1.54 + static = "icons/16/thumb_up_green.png" 1.55 + } 1.56 + slot.put(_"Your are supporter") 1.57 + end } 1.58 + else 1.59 + ui.tag{ content = function() 1.60 + ui.image{ 1.61 + static = "icons/16/thumb_up.png" 1.62 + } 1.63 + slot.put(_"Your are potential supporter") 1.64 + end } 1.65 + end 1.66 + slot.put(" · ") 1.67 + ui.link{ 1.68 + text = _"Remove my support from this initiative", 1.69 + module = "initiative", 1.70 + action = "remove_support", 1.71 + id = initiative.id, 1.72 + routing = routing, 1.73 + partial = partial 1.74 + } 1.75 + else 1.76 + 1.77 + if not initiative.revoked then 1.78 + local params = param.get_all_cgi() 1.79 + params.dyn = nil 1.80 + ui.link{ 1.81 + text = _"Support this initiative", 1.82 + module = "initiative", 1.83 + action = "add_support", 1.84 + id = initiative.id, 1.85 + routing = routing, 1.86 + partial = partial 1.87 + } 1.88 + end 1.89 end 1.90 - } 1.91 + end 1.92 + 1.93 + 1.94 + if (initiative.discussion_url and #initiative.discussion_url > 0) then 1.95 + if initiative.discussion_url:find("^https?://") then 1.96 + if initiative.discussion_url and #initiative.discussion_url > 0 then 1.97 + ui.link{ 1.98 + attr = { 1.99 + target = "_blank", 1.100 + title = _"Discussion with initiators" 1.101 + }, 1.102 + image = { static = "icons/16/comments.png" }, 1.103 + text = _"Discuss with initiators", 1.104 + external = initiative.discussion_url 1.105 + } 1.106 + end 1.107 + else 1.108 + slot.put(encode.html(initiative.discussion_url)) 1.109 + end 1.110 + end 1.111 + if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then 1.112 + ui.link{ 1.113 + text = _"change discussion URL", 1.114 + module = "initiative", 1.115 + view = "edit", 1.116 + id = initiative.id 1.117 + } 1.118 + end 1.119 end 1.120 } 1.121 slot.put("<div style='clear: left;'></div>")