bsw@526: if not app.session.member_id then bsw@526: return bsw@526: end bsw@526: bsw@525: local unit = param.get("unit", "table") bsw@525: local area = param.get("area", "table") bsw@525: local issue = param.get("issue", "table") bsw@525: bsw@525: local unit_id = unit and unit.id or nil bsw@525: local area_id = area and area.id or nil bsw@525: local issue_id = issue and issue.id or nil bsw@525: bsw@525: local info bsw@525: local delegation_text bsw@525: bsw@525: if unit then bsw@525: info = unit.delegation_info bsw@525: delegation_text = _"Delegate unit" bsw@525: end bsw@525: bsw@525: if area then bsw@525: area:load_delegation_info_once_for_member_id(app.session.member_id) bsw@525: info = area.delegation_info bsw@525: delegation_text = _"Delegate area" bsw@525: end bsw@525: bsw@525: if issue then bsw@551: if app.session.member_id then bsw@551: info = issue.member_info bsw@551: end bsw@525: delegation_text = _"Delegate issue" bsw@525: end bsw@525: bsw@529: if info.own_participation or info.first_trustee_id then bsw@525: bsw@529: ui.link{ bsw@529: module = "delegation", view = "show", params = { bsw@529: unit_id = unit_id, bsw@529: area_id = area_id, bsw@529: issue_id = issue_id bsw@529: }, bsw@529: attr = { class = "delegation_info" }, content = function() bsw@525: bsw@525: bsw@529: local participant_occured = false bsw@525: bsw@529: if info.own_participation or info.first_trustee_id then bsw@529: bsw@525: local class = "micro_avatar" bsw@529: if info.own_participation then bsw@525: participant_occured = true bsw@525: class = class .. " highlighted" bsw@525: end bsw@525: bsw@525: execute.view{ module = "member_image", view = "_show", params = { bsw@529: member = app.session.member, class = class, popup_text = app.session.member.name, bsw@525: image_type = "avatar", show_dummy = true, bsw@525: } } bsw@525: bsw@525: end bsw@525: bsw@529: if not (issue and issue.state == "voting" and info.own_participation) then bsw@529: bsw@529: if info.first_trustee_id then bsw@529: bsw@529: local text = _"delegates to" bsw@529: ui.image{ bsw@529: attr = { class = "delegation_arrow", alt = text, title = text }, bsw@529: static = "delegation_arrow_24_horizontal.png" bsw@529: } bsw@525: bsw@529: local class = "micro_avatar" bsw@529: if not participant_occured and info.first_trustee_participation then bsw@529: participant_occured = true bsw@529: class = class .. " highlighted" bsw@529: end bsw@529: bsw@529: execute.view{ module = "member_image", view = "_show", params = { bsw@529: member_id = info.first_trustee_id, class = class, popup_text = info.first_trustee_name, bsw@529: image_type = "avatar", show_dummy = true, bsw@529: } } bsw@529: bsw@529: end bsw@529: bsw@529: if info.first_trustee_ellipsis then bsw@529: bsw@529: local text = _"delegates to" bsw@529: ui.image{ bsw@529: attr = { class = "delegation_arrow", alt = text, title = text }, bsw@529: static = "delegation_arrow_24_horizontal.png" bsw@529: } bsw@529: bsw@529: slot.put("...") bsw@529: bsw@529: end bsw@525: bsw@529: if info.other_trustee_id then bsw@529: bsw@529: local text = _"delegates to" bsw@529: ui.image{ bsw@529: attr = { class = "delegation_arrow", alt = text, title = text }, bsw@529: static = "delegation_arrow_24_horizontal.png" bsw@529: } bsw@525: bsw@529: local class = "micro_avatar" bsw@529: if not participant_occured and info.other_trustee_participation then bsw@529: participant_occured = true bsw@529: class = class .. " highlighted" bsw@529: end bsw@529: bsw@529: execute.view{ module = "member_image", view = "_show", params = { bsw@529: member_id = info.other_trustee_id, class = class, popup_text = info.other_trustee_name, bsw@529: image_type = "avatar", show_dummy = true, bsw@529: } } bsw@525: bsw@529: end bsw@529: bsw@529: if info.other_trustee_ellipsis then bsw@529: bsw@529: local text = _"delegates to" bsw@529: ui.image{ bsw@529: attr = { class = "delegation_arrow", alt = text, title = text }, bsw@529: static = "delegation_arrow_24_horizontal.png" bsw@529: } bsw@525: bsw@529: slot.put("...") bsw@529: bsw@529: end bsw@529: bsw@529: local trailing_ellipsis = info.other_trustee_ellipsis or bsw@529: (info.first_trustee_ellipsis and not info.other_trustee_id) bsw@529: bsw@529: if info.delegation_loop == "own" then bsw@529: bsw@525: local text = _"delegates to" bsw@525: ui.image{ bsw@525: attr = { class = "delegation_arrow", alt = text, title = text }, bsw@525: static = "delegation_arrow_24_horizontal.png" bsw@525: } bsw@525: bsw@525: execute.view{ module = "member_image", view = "_show", params = { bsw@529: member = app.session.member, class = "micro_avatar", popup_text = app.session.member.name, bsw@525: image_type = "avatar", show_dummy = true, bsw@525: } } bsw@529: bsw@529: elseif info.delegation_loop == "first" then bsw@529: if info.first_trustee_ellipsis then bsw@529: if not trailing_ellipsis then bsw@529: bsw@529: local text = _"delegates to" bsw@529: ui.image{ bsw@529: attr = { class = "delegation_arrow", alt = text, title = text }, bsw@529: static = "delegation_arrow_24_horizontal.png" bsw@529: } bsw@529: bsw@529: slot.put("...") bsw@529: end bsw@529: bsw@529: else bsw@529: bsw@529: local text = _"delegates to" bsw@529: ui.image{ bsw@529: attr = { class = "delegation_arrow", alt = text, title = text }, bsw@529: static = "delegation_arrow_24_horizontal.png" bsw@529: } bsw@529: bsw@529: execute.view{ module = "member_image", view = "_show", params = { bsw@529: member_id = info.first_trustee_id, class = "micro_avatar", popup_text = info.first_trustee_name, bsw@529: image_type = "avatar", show_dummy = true, bsw@529: } } bsw@529: end bsw@529: bsw@529: bsw@529: elseif info.delegation_loop and not trailing_ellipsis then bsw@529: local text = _"delegates to" bsw@529: ui.image{ bsw@529: attr = { class = "delegation_arrow", alt = text, title = text }, bsw@529: static = "delegation_arrow_24_horizontal.png" bsw@529: } bsw@529: bsw@529: slot.put("...") bsw@525: end bsw@525: bsw@525: end bsw@525: bsw@525: end bsw@529: bsw@529: } bsw@525: bsw@551: end