bsw/jbe@0: bsw/jbe@0: slot.select("support", function() bsw/jbe@0: local initiative = param.get("initiative", "table") bsw/jbe@5: local supporter = Supporter:by_pk(initiative.id, app.session.member.id) bsw/jbe@0: bsw@10: if not initiative.issue.fully_frozen and not initiative.issue.closed then bsw@10: if supporter then bsw@10: if not supporter:has_critical_opinion() then bsw@10: ui.container{ bsw@10: attr = { bsw@10: class = "head head_supporter", bsw@10: style = "cursor: pointer;", bsw@10: onclick = "document.getElementById('support_content').style.display = 'block';" bsw@10: }, bsw@10: content = function() bsw@10: ui.image{ bsw@10: static = "icons/16/thumb_up_green.png" bsw@10: } bsw@10: slot.put(_"Your are supporter") bsw@10: ui.image{ bsw@10: static = "icons/16/dropdown.png" bsw/jbe@5: } bsw@10: end bsw@10: } bsw@10: else bsw@10: ui.container{ bsw@10: attr = { bsw@10: class = "head head_potential_supporter", bsw@10: style = "cursor: pointer;", bsw@10: onclick = "document.getElementById('support_content').style.display = 'block';" bsw@10: }, bsw@10: content = function() bsw@10: ui.image{ bsw@10: static = "icons/16/thumb_up.png" bsw@10: } bsw@10: slot.put(_"Your are potential supporter") bsw@10: ui.image{ bsw@10: static = "icons/16/dropdown.png" bsw/jbe@5: } bsw/jbe@5: end bsw@10: } bsw@10: end bsw@10: ui.container{ bsw@10: attr = { class = "content", id = "support_content" }, bsw@10: content = function() bsw/jbe@4: ui.container{ bsw@10: attr = { bsw@10: class = "close", bsw@10: style = "cursor: pointer;", bsw@10: onclick = "document.getElementById('support_content').style.display = 'none';" bsw@10: }, bsw/jbe@0: content = function() bsw@10: ui.image{ static = "icons/16/cross.png" } bsw/jbe@4: end bsw/jbe@0: } bsw@10: if supporter then bsw@10: ui.link{ bsw@10: content = function() bsw@10: ui.image{ static = "icons/16/thumb_down_red.png" } bsw@10: slot.put(_"Remove my support from this initiative") bsw@10: end, bsw@10: module = "initiative", bsw@10: action = "remove_support", bsw@10: id = initiative.id, bsw@10: routing = { bsw@10: default = { bsw@10: mode = "redirect", bsw@10: module = request.get_module(), bsw@10: view = request.get_view(), bsw@10: id = param.get_id_cgi(), bsw@10: params = param.get_all_cgi() bsw@10: } bsw/jbe@4: } bsw/jbe@4: } bsw@10: else bsw@10: end bsw@10: end bsw@10: } bsw@10: else bsw@10: if not initiative.revoked then bsw@10: ui.link{ bsw@10: content = function() bsw@10: ui.image{ static = "icons/16/thumb_up_green.png" } bsw@10: slot.put(_"Support this initiative") bsw@10: end, bsw@10: module = "initiative", bsw@10: action = "add_support", bsw@10: id = initiative.id, bsw@10: routing = { bsw@10: default = { bsw@10: mode = "redirect", bsw@10: module = request.get_module(), bsw@10: view = request.get_view(), bsw@10: id = param.get_id_cgi(), bsw@10: params = param.get_all_cgi() bsw@10: } bsw/jbe@0: } bsw@10: } bsw/jbe@0: end bsw/jbe@4: end bsw@10: end bsw@10: bsw/jbe@0: end)