bsw@211: local issues = param.get("issues", "table") bsw@211: bsw@211: for i, issue in ipairs(issues) do bsw@211: local initiatives = issue.initiatives bsw@211: bsw@211: local interested_members = issue.interested_members bsw@211: bsw@211: -- prepare interest of current user bsw@211: local interest = issue.interest bsw@211: bsw@211: -- prepare trustees bsw@211: local trustees = Member:new_selector() bsw@211: :add_field("delegation_chain.*") bsw@211: :join("delegation_chain(" .. tostring(app.session.member.id) .. ", 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 global_delegation bsw@211: local area_delegation bsw@211: local issue_delegation bsw@211: bsw@211: for i, delegation in ipairs(issue.outgoing_delegations) do bsw@211: if delegation.scope == "global" then global_delegation = delegation bsw@211: elseif delegation.scope == "area" then area_delegation = delegation bsw@211: elseif delegation.scope == "issue" then issue_delegation = delegation bsw@211: end bsw@211: end bsw@211: bsw@211: local delegation = issue_delegation or area_delegation or global_delegation bsw@211: bsw@211: local delegating_interest = issue.delegating_interest bsw@211: bsw@211: ui.box{ class = "issue", content = function() bsw@211: bsw@211: ui.box_row{ class = "head", content = function() bsw@211: bsw@211: ui.box_col{ class = "issue_id left", content = function() bsw@211: ui.link{ bsw@211: module = "lf2", view = "issue", id = issue.id, bsw@211: content = _("Issue ##{id}", { id = issue.id }) bsw@211: } bsw@211: end } bsw@211: bsw@211: ui.box_col{ class = "unit_name right", content = function() bsw@211: ui.link{ bsw@211: module = "lf2", view = "unit", id = 1, bsw@211: content = "Dummy unit name" bsw@211: } bsw@211: end } bsw@211: ui.box_col{ class = "area_name right clearright", content = function() bsw@211: ui.link{ bsw@211: module = "lf2", view = "area_name", id = issue.area_id, bsw@211: content = issue.area.name bsw@211: } bsw@211: end } bsw@211: ui.box_col{ class = "policy_name left clearleft first", 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 } bsw@211: bsw@211: end } bsw@211: bsw@211: ui.box_row{ class = "head2", content = function() bsw@211: bsw@211: ui.box_col{ class = "state_name left", content = function() bsw@211: ui.tag{ content = issue.state_name } bsw@211: slot.put(" · ") bsw@211: 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@211: end } bsw@211: end } bsw@211: bsw@211: if interest or delegation then bsw@211: ui.box_row{ class = "head2", content = function() bsw@211: ui.box_col{ class = "interest left", content = function() bsw@211: if interest then bsw@211: ui.image{ static = "lf2/icon_star.png" } bsw@211: if issue.closed then bsw@211: slot.put(" ", _"You were interested in this issue") bsw@211: else bsw@211: slot.put(" ", _"You are interested in this issue") bsw@211: end bsw@211: elseif delegating_interest then bsw@211: ui.image{ static = "lf2/icon_delegated_star.png" } bsw@211: if issue.closed then bsw@211: slot.put(" ", _"You were interested in this issue by delegation") bsw@211: else bsw@211: slot.put(" ", _"You are interested in this issue by delegation") bsw@211: end bsw@211: elseif trustees then bsw@211: slot.put(_"You have delegated this issue") bsw@211: else bsw@211: slot.put(_"You are not interested in this issue") bsw@211: end bsw@211: end } bsw@211: -- TODO if delegation ist falsch bsw@211: if delegation then bsw@211: slot.put(tostring(delegation.id)) bsw@211: ui.box_col{ class = "delegation right", content = function() bsw@211: execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } } bsw@211: end } bsw@211: end bsw@211: end } bsw@211: end bsw@211: bsw@211: for i, initiative in ipairs(issue.initiatives) do bsw@211: ui.box_row{ class = "initiative", content = function() ui.box_col { content = function() bsw@211: execute.view{ module = "lf2", view = "_initiative", params = { initiative = initiative } } bsw@211: end } end } bsw@211: end bsw@211: bsw@211: end } bsw@211: end