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