bsw@1045: if not app.session.member then bsw@1045: return bsw@1045: end bsw@1045: bsw@1045: local initiative = param.get("initiative", "table") bsw@1045: bsw@1045: local initiative_info = initiative.member_info bsw@1045: local issue_info = initiative.issue.member_info bsw@1045: bsw@1045: local active_trustee_id bsw@1045: if not issue_info.own_participation then bsw@1045: if issue_info.first_trustee_participation then bsw@1045: active_trustee_id = issue_info.first_trustee_id bsw@1045: elseif issue_info.other_trustee_participation then bsw@1045: active_trustee_id = issue_info.other_trustee_id bsw@1045: end bsw@1045: end bsw@1045: bsw@1045: bsw@1045: slot.select ( "sidebar", function () bsw@1045: bsw@1045: if bsw@1045: not initiative.issue.fully_frozen bsw@1045: and not initiative.issue.closed bsw@1045: and (issue_info.own_participation or active_trustee_id) bsw@1045: then bsw@1045: ui.container { bsw@1045: attr = { class = "tab-whatcanido sidebarSection" }, bsw@1045: content = function () bsw@1045: bsw@1045: bsw@1045: if initiative_info.supported then bsw@1045: ui.heading { level = 1, content = function () bsw@1045: ui.tag { content = _"I'm supporting this initiative" } bsw@1045: if issue_info.weight then bsw@1045: slot.put ( " " ) bsw@1045: ui.link { bsw@1045: module = "delegation", view = "show_incoming", params = { bsw@1045: issue_id = initiative.issue_id, bsw@1045: member_id = app.session.member_id bsw@1045: }, bsw@1045: content = "+" .. issue_info.weight bsw@1045: } bsw@1045: end bsw@1045: end } bsw@1045: bsw@1045: else bsw@1045: ui.heading { level = 1, content = function () bsw@1045: ui.tag { content = _"I'm interested in this issue" } bsw@1045: if issue_info.weight then bsw@1045: slot.put ( " " ) bsw@1045: ui.link { bsw@1045: module = "delegation", view = "show_incoming", params = { bsw@1045: issue_id = initiative.issue_id, bsw@1045: member_id = app.session.member_id bsw@1045: }, bsw@1045: content = "+" .. issue_info.weight bsw@1045: } bsw@1045: end bsw@1045: end } bsw@1045: end bsw@1045: bsw@1045: if active_trustee_id then bsw@1045: ui.tag { content = _"via delegation" } bsw@1045: elseif issue_info.first_trustee_id then bsw@1045: ui.tag { content = _"delegation suspended during discussion" } bsw@1045: end bsw@1045: end bsw@1045: } bsw@1045: end bsw@1045: bsw@1045: if bsw@1045: initiative.issue.fully_frozen and bsw@1045: (issue_info.direct_voted or active_trustee_id) bsw@1045: then bsw@1045: ui.container { bsw@1045: attr = { class = "tab-whatcanido sidebarSection" }, bsw@1045: content = function () bsw@1045: bsw@1045: if issue_info.direct_voted then bsw@1045: ui.heading { level = 1, content = _"You have been voted" } bsw@1045: ui.link { bsw@1045: content = _"Show my voting ballot", bsw@1045: module = "vote", view = "list", params = { bsw@1045: issue_id = initiative.issue.id bsw@1045: } bsw@1045: } bsw@1045: else bsw@1045: bsw@1045: bsw@1045: if active_trustee_id then bsw@1045: ui.heading { level = 1, content = _"You have been voted" } bsw@1045: ui.container { bsw@1045: content = _"via delegation" bsw@1045: } bsw@1045: ui.link { bsw@1045: content = _"Show voting ballot", bsw@1045: module = "vote", view = "list", params = { bsw@1045: issue_id = initiative.issue.id, member_id = active_trustee_id bsw@1045: } bsw@1045: } bsw@1045: end bsw@1045: end bsw@1045: end bsw@1045: } bsw@1045: end bsw@1045: end ) bsw@1045: