bsw@2: local delegations_selector = param.get("delegations_selector", "table") bsw@2: local outgoing = param.get("outgoing", atom.boolean) bsw@2: local incoming = param.get("incoming", atom.boolean) bsw@2: bsw@2: local function delegation_scope(delegation) bsw@1045: ui.tag{ bsw@2: attr = { class = "delegation_scope" }, bsw@2: content = function() bsw@2: local area bsw@599: local unit bsw@2: if delegation.issue then bsw@2: area = delegation.issue.area bsw@1045: unit = area.unit bsw@599: elseif delegation.area then bsw@599: area = delegation.area bsw@1045: unit = area.unit bsw@2: else bsw@599: unit = delegation.unit bsw@2: end bsw@1045: slot.put("
") bsw@1045: ui.heading { attr = { style = "float: left;" }, level = 3, content = function() bsw@599: ui.link{ bsw@1045: content = unit.name, bsw@599: module = "unit", bsw@599: view = "show", bsw@599: id = unit.id bsw@599: } bsw@1045: if area then bsw@1045: slot.put(" · ") bsw@1045: ui.link{ bsw@1045: content = area.name, bsw@1045: module = "area", bsw@1045: view = "show", bsw@1045: id = area.id bsw@1045: } bsw@1045: end bsw@1045: if delegation.issue then bsw@1045: slot.put(" · ") bsw@1045: ui.link{ bsw@1045: content = delegation.issue.name, bsw@1045: module = "issue", bsw@1045: view = "show", bsw@1045: id = delegation.issue.id bsw@1045: } bsw@1045: end bsw@1045: end } bsw@2: end bsw@2: } bsw@2: end bsw@2: bsw/jbe@0: bsw@1045: --ui.paginate{ bsw@1045: -- selector = delegations_selector, bsw@1045: -- name = incoming and "delegation_incoming" or "delegation_outgoing", bsw@1045: -- content = function() bsw@1045: local last_scope = {} bsw@2: for i, delegation in ipairs(delegations_selector:exec()) do bsw@1045: if last_scope.unit_id ~= delegation.unit_id bsw@1045: or last_scope.area_id ~= delegation.area_id bsw@1045: or last_scope.issue_id ~= delegation.issue_id bsw@1045: then bsw@1045: last_scope.unit_id = delegation.unit_id bsw@1045: last_scope.area_id = delegation.area_id bsw@1045: last_scope.issue_id = delegation.issue_id bsw@1045: delegation_scope(delegation) bsw@1045: end bsw@1045: if incoming then bsw@1045: execute.view{ module = "member_image", view = "_show", params = { bsw@1045: member_id = delegation.truster_id, class = "micro_avatar", popup_text = delegation.truster.name, bsw@1045: image_type = "avatar", show_dummy = true, bsw@1045: } } bsw@1045: elseif delegation.trustee then bsw@1045: ui.image{ bsw@1045: attr = { class = "delegation_arrow" }, bsw@1045: static = "delegation_arrow_24_horizontal.png" bsw@1045: } bsw@1045: execute.view{ module = "member_image", view = "_show", params = { bsw@1045: member_id = delegation.trustee_id, class = "micro_avatar", popup_text = delegation.trustee.name, bsw@1045: image_type = "avatar", show_dummy = true, bsw@1045: } } bsw@1045: else bsw@1045: ui.tag{ content = _"Delegation abandoned" } bsw@1045: end bsw@2: end bsw@1045: -- end bsw@1045: --}