bsw@215: slot.set_layout("lf2") bsw@215: bsw@216: slot.put_into("leftright_pre", '
') bsw@215: bsw@216: local issue = Issue:by_id(param.get("issue_id", atom.integer)) bsw@216: local member = Member:by_id(param.get("member_id", atom.integer)) bsw@215: bsw@215: local area = issue.area bsw@215: bsw@215: -- TODO broken bsw@215: --issue:load("interested_members_snapshot", {}, "interested_members") bsw@216: issue:load("delegating_interest_snapshot_for_member", { member_id = member.id }, "delegating_interest") bsw@216: issue:load("interest_for_member", { member_id = member.id }, "interest") bsw@216: issue:load("outgoing_delegations_for_member", { member_id = member.id }, "outgoing_delegations") bsw@216: issue:load("trusters_for_member", { member_id = member.id }, "trusters") bsw@215: bsw@215: local initiatives = issue.initiatives bsw@215: bsw@216: local supported_initiatives = Initiative:new_selector() bsw@216: :add_where{ "initiative.issue_id = ?", issue.id } bsw@216: :join("supporter", nil, { "supporter.initiative_id = initiative.id AND supporter.member_id = ?", member.id }) bsw@216: :exec() bsw@216: bsw@215: bsw@215: local interest = issue.interest bsw@215: bsw@215: local delegations = issue.delegations bsw@215: bsw@215: local trustees = Member:new_selector() bsw@215: :add_field("delegation_chain.*") bsw@216: :join("delegation_chain(" .. tostring(member.id) .. ", " .. tostring(issue.area_id or "NULL") .. ", " .. tostring(issue_id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id") bsw@215: :add_order_by("index") bsw@215: :exec() bsw@215: bsw@215: local global_delegation bsw@215: local area_delegation bsw@215: local issue_delegation bsw@215: bsw@215: for i, delegation in ipairs(issue.delegations) do bsw@215: if delegation.scope == "global" then global_delegation = delegation bsw@215: elseif delegation.scope == "area" then area_delegation = delegation bsw@215: elseif delegation.scope == "issue" then issue_delegation = delegation bsw@215: end bsw@215: end bsw@215: bsw@215: local delegation = issue_delegation or area_delegation or global_delegation bsw@215: bsw@215: local delegating_interest = issue.delegating_interest bsw@215: bsw@215: app.topnav_phase = issue.phase bsw@215: app.topnav_area_id = issue.area_id bsw@215: bsw@215: slot.select("sidebar", function() bsw@216: execute.view{ module = "lf2", view = "_sidebar_issue", params = { issue = issue, alternative_initiatives = initiatives } } bsw@216: bsw@215: end) bsw@215: bsw@216: ui.box{ content = function() bsw@216: ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = function() bsw@216: ui.link{ module = "lf2", view = "member", id = member.id, content = function() bsw@216: ui.avatar(member) bsw@216: slot.put(" ") bsw@216: ui.tag{ content = member.name } bsw@216: end } bsw@216: end } end } bsw@216: if not member.active then bsw@216: ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = function() bsw@216: ui.tag{ content = _"Member is deactivated" } bsw@216: end } end } bsw@216: end bsw@216: ui.box_row{ content = function() ui.box_col{ content = function() bsw@216: if interest then bsw@216: ui.image{ static = "lf2/icon_star.png" } bsw@216: slot.put(" ") bsw@216: ui.tag{ content = _"Member is interested in this issue" } bsw@216: elseif delegating_interest then bsw@216: ui.image{ static = "lf2/icon_delegated_star.png" } bsw@216: slot.put(" ") bsw@216: ui.tag{ content = _"Someone in members delegation chain is interested" } bsw@216: else bsw@216: ui.image{ static = "lf2/icon_star_grey.png" } bsw@216: slot.put(" ") bsw@216: ui.tag{ content = _"Member is not interested" } bsw@216: end bsw@216: end } end } bsw@216: if #trustees > 1 then bsw@216: ui.box_row{ content = function() ui.box_col{ content = function() bsw@216: execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small", issue_id = issue.id } } bsw@216: end } end } bsw@216: end bsw@215: bsw@217: if statement then bsw@217: ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Statement about issue" } end } bsw@217: end bsw@217: bsw@217: if #supported_initiatives > 0 then bsw@217: ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Supported initiatives" } end } bsw@217: execute.view{ module = "lf2", view = "_initiatives", params = { initiatives = supported_initiatives } } bsw@217: end bsw@217: bsw@217: if #(issue.trusters) > 0 then bsw@217: ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Incoming delegations" } end } bsw@217: ui.box_row{ content = function() ui.box_col{ content = function() bsw@217: execute.view{ module = "lf2", view = "_avatars", params = { members = issue.trusters, size = "small", issue_id = issue.id } } bsw@217: end } end } bsw@217: end bsw@216: bsw@216: end } bsw@216: