bsw/jbe@0: bsw/jbe@0: bsw/jbe@0: slot.select("support", function() bsw/jbe@0: bsw/jbe@0: local initiative = param.get("initiative", "table") bsw/jbe@0: bsw/jbe@0: if not initiative.issue.frozen and not initiative.issue.closed then bsw/jbe@0: bsw/jbe@0: local supported = Supporter:by_pk(initiative.id, app.session.member.id) and true or false bsw/jbe@0: bsw/jbe@0: local text bsw/jbe@0: if supported then bsw/jbe@0: text = _"Direct supporter [change]" bsw/jbe@0: else bsw/jbe@0: text = _"No supporter [change]" bsw/jbe@0: end bsw/jbe@0: ui.container{ bsw/jbe@0: attr = { bsw/jbe@0: class = "head", bsw/jbe@0: style = "cursor: pointer;", bsw/jbe@0: onclick = "document.getElementById('support_content').style.display = 'block';" bsw/jbe@0: }, bsw/jbe@0: content = text bsw/jbe@0: } bsw/jbe@0: bsw/jbe@0: bsw/jbe@0: ui.container{ bsw/jbe@0: attr = { class = "content", id = "support_content" }, bsw/jbe@0: content = function() bsw/jbe@0: if supported then bsw/jbe@0: ui.link{ bsw/jbe@0: content = function() bsw/jbe@0: ui.image{ static = "icons/16/thumb_down_red.png" } bsw/jbe@0: slot.put(_"Remove my support from this initiative") bsw/jbe@0: end, bsw/jbe@0: module = "initiative", bsw/jbe@0: action = "remove_support", bsw/jbe@0: id = initiative.id 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@0: id = initiative.id bsw/jbe@0: } bsw/jbe@0: end bsw/jbe@0: end bsw/jbe@0: } bsw/jbe@0: end bsw/jbe@0: bsw/jbe@0: end)