bsw@217: local issue = param.get("issue", "table") bsw@217: local for_list = param.get("for_list", atom.boolean) bsw@217: bsw@217: local initiatives = issue.initiatives bsw@217: bsw@217: local interested_members = issue.interested_members bsw@217: bsw@217: -- prepare interest of current user bsw@217: local interest = issue.interest bsw@217: bsw@217: -- prepare trustees bsw@217: local trustees = Member:new_selector() bsw@217: :add_field("delegation_chain.*") bsw@217: :join({ "delegation_chain(?, null, null, " .. tostring(issue.id or "NULL") .. ")", app.session.member.id }, "delegation_chain", "member.id = delegation_chain.member_id") bsw@217: :add_order_by("index") bsw@217: :exec() bsw@217: bsw@217: local global_delegation bsw@217: local area_delegation bsw@217: local issue_delegation bsw@217: bsw@217: for i, delegation in ipairs(issue.outgoing_delegations) do bsw@217: if delegation.scope == "global" then global_delegation = delegation bsw@217: elseif delegation.scope == "area" then area_delegation = delegation bsw@217: elseif delegation.scope == "issue" then issue_delegation = delegation bsw@217: end bsw@217: end bsw@217: bsw@217: local delegation = issue_delegation or area_delegation or global_delegation bsw@217: bsw@217: local delegating_interest = issue.delegating_interest bsw@217: --[[ bsw@217: local current_delegating_interest = false bsw@217: bsw@217: for i, trustee in ipairs(trustees) do bsw@217: if i > 1 and trustee.participation then bsw@217: delegating_interest = true bsw@217: end bsw@217: end bsw@217: --]] bsw@217: local row_count = #initiatives + 3 bsw@217: if #trustees > 1 then bsw@217: row_count = row_count + 1 bsw@217: end bsw@217: bsw@217: ui.box{ class = "issue", content = function() bsw@217: ui.box_row{ class = "head", content = function() bsw@217: bsw@217: ui.box_col{ class = "issue_id left head", content = function() bsw@217: if interest then bsw@217: local text bsw@217: if issue.close then bsw@217: text = _"You were interested in this issue" bsw@217: else bsw@217: text = _"You are interested in this issue" bsw@217: end bsw@217: ui.image{ attr = { title = text, alt = text}, static = "lf2/icon_star.png" } bsw@217: elseif delegating_interest then bsw@217: local text bsw@217: if issue.closed then bsw@217: text = _"Someone in your delegation chain was interested" bsw@217: else bsw@217: text = _"Someone in your delegation chain is interested" bsw@217: end bsw@217: ui.image{ attr = { title = text, alt = text}, static = "lf2/icon_delegated_star.png" } bsw@217: end bsw@217: slot.put(" ") bsw@217: ui.link{ bsw@217: module = "lf2", view = "issue", id = issue.id, bsw@217: content = _("Issue ##{id}", { id = issue.id }) bsw@217: } bsw@217: end } bsw@217: bsw@217: end } bsw@217: bsw@217: if #trustees > 1 then bsw@218: ui.box_row{ class = "", content = function() bsw@218: ui.box_col{ class = "left", content = function() bsw@217: execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small", issue_id = issue.id } } bsw@217: end } bsw@217: end } bsw@217: end bsw@217: bsw@217: if not issue.closed and not issue.fully_frozen then bsw@217: ui.box_row{ content = function() bsw@217: ui.box_col{ class = "head", content = function() bsw@217: if interest then bsw@217: ui.link{ bsw@217: text = _"Remove interest", bsw@217: module = "interest", action = "update", params = { issue_id = issue.id, delete = true }, bsw@217: routing = { default = { mode = "redirect", module = "lf2", view = "issue", id = issue.id } } bsw@217: } bsw@217: elseif not issue.closed and not issue.fully_frozen then bsw@217: ui.link{ bsw@217: text = _"Add my interest", bsw@217: module = "interest", action = "update", params = { issue_id = issue.id }, bsw@217: routing = { default = { mode = "redirect", module = "lf2", view = "issue", id = issue.id } } bsw@217: } bsw@217: end bsw@217: slot.put(" · ") bsw@218: if trustees[1].scope_out == "issue" then bsw@218: text = _"Change or revoke issue delegation" bsw@218: else bsw@218: text = _"Set issue delegation" bsw@218: end bsw@218: ui.link{ bsw@218: text = text, bsw@218: module = "lf2", view = "delegation", params = { issue_id = issue.id } bsw@218: } bsw@217: end } bsw@217: bsw@217: end } bsw@217: end bsw@217: bsw@217: ui.box_row{ content = function() bsw@217: ui.box_col{ class = "unit_name left", content = function() bsw@217: ui.link{ bsw@217: module = "lf2", view = "index", id = issue.area.unit_id, bsw@217: params = { phase = issue.phase }, bsw@218: text = issue.area.unit.name_with_path bsw@217: } bsw@217: end } bsw@217: ui.box_col{ class = "policy_name right", content = function() bsw@217: ui.link{ bsw@217: module = "lf2", view = "policy", id = issue.policy_id, bsw@217: content = issue.policy.name bsw@217: } bsw@217: end } bsw@217: end } bsw@217: bsw@217: ui.box_row{ content = function() bsw@217: ui.box_col{ class = "area_name left", content = function() bsw@217: ui.link{ bsw@217: module = "lf2", view = "area", id = issue.area_id, bsw@217: params = { phase = issue.phase }, bsw@217: text = issue.area.name bsw@217: } bsw@217: end } bsw@217: ui.box_col{ class = "state_time_left right", content = function() bsw@217: ui.tag{ content = issue.state_name } bsw@217: slot.put(" · ") bsw@217: ui.tag{ content = issue.closed and _("since #{date}", { date = format.date(issue.closed.date) }) or _("#{time_left} left", { time_left = issue.state_time_left }) } bsw@217: end } bsw@217: end } bsw@217: bsw@217: bsw@217: ui.box_row{ class = "subhead", content = function() bsw@217: ui.box_col{ class = "head", content = _"Initiatives" } bsw@217: end } bsw@217: bsw@217: for i, initiative in ipairs(issue.initiatives) do bsw@217: ui.box_row{ class = "initiative", content = function() ui.box_col { content = function() bsw@217: execute.view{ module = "lf2", view = "_initiative", params = { initiative = initiative } } bsw@217: end } end } bsw@217: end bsw@217: if not for_list then bsw@217: -- TODO bugfix for not working reference loader bsw@217: interested_members = issue:get_reference_selector("interested_members_snapshot"):exec() bsw@217: bsw@217: ui.box_row{ class = "subhead", content = function() bsw@217: ui.box_col{ class = "head left", content = _"Members, interested in this issue" } bsw@217: ui.box_col{ class = "right", content = _("#{count} members", { count = #interested_members }) } bsw@217: end } bsw@217: ui.box_row{ class = "interested", content = function() bsw@217: ui.box_col{ class = "", content = function() bsw@217: execute.view{ module = "lf2", view = "_avatars", params = { members = interested_members, issue_id = issue.id } } bsw@217: end } bsw@217: end } bsw@217: end bsw@217: end }