bsw@211: local issue = param.get("issue", "table") bsw@213: local initiative_id = param.get("initiative_id", atom.integer) bsw@211: bsw@215: local alternative_initiatives = param.get("alternative_initiatives", "table") bsw@215: bsw@211: local initiatives = issue.initiatives bsw@211: bsw@211: local interested_members_selector = Member:new_selector() bsw@211: :join("direct_interest_snapshot", "dis", { "dis.issue_id = ? AND dis.member_id = member.id and dis.event = (select latest_snapshot_event from issue where id = ?)", issue.id, issue.id }) bsw@211: :add_field("dis.weight", "weight") bsw@211: :add_order_by("dis.weight DESC") bsw@211: local interested_members = interested_members_selector:exec() bsw@211: bsw@211: local interest = issue.interest bsw@211: bsw@211: local trustees = Member:new_selector() bsw@211: :add_field("delegation_chain.*") bsw@217: :join("delegation_chain(" .. tostring(app.session.member.id) .. ", NULL, NULL, " .. tostring(issue.id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id") bsw@211: :add_order_by("index") bsw@211: :exec() bsw@211: bsw@211: local delegating_interest = issue.delegating_interest bsw@211: bsw@211: ui.box{ class = "issue", content = function() bsw@211: bsw@217: ui.box_row{ class = "issue_id head", content = function() ui.box_col{ class = "head", content = function() 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 } end } bsw@217: bsw@217: if not issue.closed then bsw@217: ui.box_row{ class = "interest", content = function() ui.box_col{ content = function() bsw@217: if interest then bsw@218: local text bsw@218: if issue.close then bsw@218: text = _"You were interested" bsw@218: else bsw@218: text = _"You are interested" bsw@218: end bsw@218: ui.image{ static = "lf2/icon_star.png" } bsw@218: slot.put(" ") bsw@218: ui.tag{ content = text } bsw@218: slot.put(" · ") bsw@217: ui.link{ bsw@217: module = "interest", action = "update", params = { issue_id = issue.id, delete = true }, bsw@217: routing = { default = { bsw@217: mode = "redirect", module = "lf2", view = initiative_id and "initiative" or "issue", id = initiative_id or issue.id, bsw@217: } }, bsw@218: content = _"remove" bsw@217: } bsw@218: elseif delegating_interest then bsw@218: local text bsw@218: if issue.closed then bsw@218: text = _"Someone in your delegation chain was interested" bsw@218: else bsw@218: text = _"Someone in your delegation chain is interested" bsw@218: end bsw@218: ui.image{ attr = { title = text, alt = text}, static = "lf2/icon_delegated_star.png" } bsw@217: else bsw@217: ui.link{ bsw@217: module = "interest", action = "update", params = { issue_id = issue.id }, bsw@217: routing = { default = { bsw@217: mode = "redirect", module = "lf2", view = initiative_id and "initiative" or "issue", id = initiative_id or issue.id, bsw@217: } }, bsw@217: content = _"Add my interest" bsw@217: } bsw@217: end bsw@217: end } end } bsw@217: end bsw@217: bsw@218: if #trustees > 1 then bsw@218: ui.box_row{ class = "delegation", content = function() ui.box_col{ content = function() bsw@218: execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small", issue_id = issue.id } } bsw@218: end } end } bsw@218: end bsw@218: bsw@217: if not issue.closed then bsw@217: ui.box_row{ class = "interest", content = function() ui.box_col{ content = function() bsw@217: if #trustees > 1 and trustees[1].scope_out == "issue" then bsw@217: ui.link{ bsw@217: module = "lf2", view = "delegation", params = { issue_id = issue.id, initiative_id = initiative_id }, bsw@218: content = _"Change or remove delegation" bsw@218: } bsw@217: else bsw@217: ui.link{ bsw@217: module = "lf2", view = "delegation", params = { issue_id = issue.id, initiative_id = initiative_id }, bsw@218: content = _"Set issue delegation" bsw@218: } bsw@217: end bsw@217: bsw@217: end } end } bsw@217: end bsw@217: bsw@217: ui.box_row{ class = "unit_name", content = function() ui.box_col{ content = function() bsw@211: ui.link{ bsw@215: module = "lf2", view = "index", id = 1, bsw@211: content = "DE / Berlin / Friedrichshain-Kreuzberg" bsw@211: } bsw@211: end } end } bsw@211: bsw@217: ui.box_row{ class = "area_name", content = function() ui.box_col{ content = function() bsw@211: ui.link{ bsw@211: module = "lf2", view = "area", id = issue.area_id, bsw@211: content = issue.area.name bsw@211: } bsw@211: end } end } bsw@211: bsw@216: ui.box_row{ class = "policy_name", content = function() ui.box_col{ content = function() bsw@211: ui.link{ bsw@211: module = "lf2", view = "policy", id = issue.policy_id, bsw@211: content = issue.policy.name bsw@211: } bsw@211: end } end } bsw@211: bsw@216: ui.box_row{ class = "time_left", content = function() bsw@216: ui.box_col{ class = "left", content = function() bsw@216: ui.tag{ content = issue.state_name } bsw@216: slot.put(" · ") bsw@216: 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@216: end } bsw@211: end } bsw@211: bsw@216: ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Initiatives" } end } bsw@215: ui.box_row{ class = "initiatives last", content = function() bsw@217: ui.box_col{ id = "resizable", class = "scrolled", content = function() bsw@215: execute.view{ module = "lf2", view = "_issue_initiatives", params = { initiatives = alternative_initiatives, current_initiative_id = initiative_id } } bsw@215: end } bsw@215: end } bsw@215: bsw@217: ui.script{ script = "$(function() { $( '#resizable' ).resizable(); });" } bsw@215: bsw@211: end }