bsw/jbe@1309: local unit_id = config.single_unit_id or tonumber(request.get_param{ name = "unit" }) bsw/jbe@1309: if unit_id == "all" then bsw/jbe@1309: unit_id = nil bsw/jbe@1309: end bsw/jbe@1309: local unit bsw/jbe@1309: if unit_id then bsw/jbe@1309: unit = Unit:by_id(unit_id) bsw/jbe@1309: end bsw/jbe@1309: local area_id = config.single_area_id or tonumber(request.get_param{ name = "area" }) bsw/jbe@1309: if area_id == "all" then bsw/jbe@1309: area_id = nil bsw/jbe@1309: end bsw/jbe@1309: local area bsw/jbe@1309: if area_id then bsw/jbe@1309: area = Area:by_id(area_id) bsw/jbe@1309: end bsw/jbe@1309: if area and unit and area.unit_id ~= unit.id then bsw/jbe@1309: area_id = nil bsw/jbe@1309: end bsw/jbe@1309: if area and area.unit_id == unit_id then bsw/jbe@1309: if app.session.member_id then bsw/jbe@1309: area:load_delegation_info_once_for_member_id(app.session.member_id) bsw/jbe@1309: end bsw/jbe@1309: bsw/jbe@1309: ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() bsw/jbe@1309: if unit then bsw/jbe@1309: ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() bsw/jbe@1309: if not config.single_area_id then bsw/jbe@1309: ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name .. " / " .. area.name } bsw/jbe@1309: else bsw/jbe@1309: ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name } bsw/jbe@1309: end bsw/jbe@1309: end } bsw/jbe@1309: end bsw/jbe@1309: if area.description and #(area.description) > 0 then bsw/jbe@1309: if not config.single_area_id then bsw/jbe@1309: ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = area.description } bsw/jbe@1309: else bsw/jbe@1309: ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = unit.description } bsw/jbe@1309: end bsw/jbe@1309: end bsw/jbe@1309: if not (config.voting_only and config.disable_delegations) and app.session.member_id then bsw/jbe@1309: ui.container{ attr = { class = "mdl-card__actions" }, content = function() bsw/jbe@1309: bsw/jbe@1309: if app.session.member_id then bsw/jbe@1309: if area.delegation_info.first_trustee_id then bsw/jbe@1309: local member = Member:by_id(area.delegation_info.first_trustee_id) bsw/jbe@1309: ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" } bsw/jbe@1309: execute.view{ bsw/jbe@1309: module = "member_image", bsw/jbe@1309: view = "_show", bsw/jbe@1309: params = { bsw/jbe@1309: member = member, bsw/jbe@1309: image_type = "avatar", bsw/jbe@1309: show_dummy = true bsw/jbe@1309: } bsw/jbe@1309: } bsw/jbe@1309: end bsw/jbe@1309: bsw/jbe@1309: if not config.disable_delegations then bsw/jbe@1309: if area.delegation_info.own_delegation_scope == "unit" then bsw/jbe@1309: ui.link { bsw/jbe@1309: attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" }, bsw/jbe@1309: module = "delegation", view = "show", params = { bsw/jbe@1309: unit_id = area.unit_id, bsw/jbe@1309: }, bsw/jbe@1309: content = _("change/revoke delegation of organizational unit") bsw/jbe@1309: } bsw/jbe@1309: slot.put("   ") bsw/jbe@1309: end bsw/jbe@1309: if area.delegation_info.own_delegation_scope == nil then bsw/jbe@1309: local text bsw/jbe@1309: if config.single_area_id then bsw/jbe@1309: text = _"choose delegatee" bsw/jbe@1309: else bsw/jbe@1309: text = _"choose subject area delegatee" bsw/jbe@1309: end bsw/jbe@1309: ui.link { bsw/jbe@1309: attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" }, bsw/jbe@1309: module = "delegation", view = "show", params = { bsw/jbe@1309: area_id = area.id bsw/jbe@1309: }, bsw/jbe@1309: content = function() bsw/jbe@1309: ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" } bsw/jbe@1309: ui.tag{ content = text } bsw/jbe@1309: end bsw/jbe@1309: } bsw/jbe@1309: slot.put("   ") bsw/jbe@1309: elseif area.delegation_info.own_delegation_scope == "area" then bsw/jbe@1309: local text bsw/jbe@1309: if config.single_area_id then bsw/jbe@1309: text = _"change/revoke delegation" bsw/jbe@1309: else bsw/jbe@1309: text = _"change/revoke area delegation" bsw/jbe@1309: end bsw/jbe@1309: ui.link { bsw/jbe@1309: attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" }, bsw/jbe@1309: module = "delegation", view = "show", params = { bsw/jbe@1309: area_id = area.id bsw/jbe@1309: }, bsw/jbe@1309: content = text bsw/jbe@1309: } bsw/jbe@1309: slot.put("   ") bsw/jbe@1309: else bsw/jbe@1309: ui.link { bsw/jbe@1309: attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" }, bsw/jbe@1309: module = "delegation", view = "show", params = { bsw/jbe@1309: area_id = area.id bsw/jbe@1309: }, bsw/jbe@1309: content = _"change/revoke delegation only for this subject area" bsw/jbe@1309: } bsw/jbe@1309: slot.put("   ") bsw/jbe@1309: end bsw/jbe@1309: end bsw/jbe@1309: end bsw/jbe@1309: if not config.voting_only and app.session.member_id and app.session.member:has_initiative_right_for_unit_id ( area.unit_id ) then bsw/jbe@1309: ui.link { bsw/jbe@1309: attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" }, bsw@1496: module = "draft", view = "new", bsw/jbe@1309: params = { area_id = area.id }, bsw/jbe@1309: content = function() bsw/jbe@1309: ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "add" } bsw/jbe@1309: ui.tag{ content = _"new issue" } bsw/jbe@1309: end bsw/jbe@1309: } bsw/jbe@1309: end bsw/jbe@1309: end } bsw/jbe@1309: end bsw/jbe@1309: end } bsw/jbe@1309: elseif unit then bsw/jbe@1309: ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() bsw/jbe@1309: ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() bsw/jbe@1309: ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name } bsw/jbe@1309: end } bsw/jbe@1309: if unit.description and #(unit.description) > 0 then bsw/jbe@1309: ui.container{ attr = { class = "mdl-card__supporting-text mdl-card--border" }, content = unit.description } bsw/jbe@1309: end bsw@1532: if config.render_external_reference_unit then bsw@1532: config.render_external_reference_unit(unit) bsw@1532: end bsw/jbe@1309: --ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function() bsw/jbe@1309: --end } bsw/jbe@1309: end } bsw@1489: else bsw@1489: ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() bsw@1489: ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() bsw@1489: ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"All issues" } bsw@1489: end } bsw@1489: ui.container{ attr = { class = "mdl-card__supporting-text mdl-card--border" }, content = _"All issues in your units. Use filters above to limit results." } bsw@1489: end } bsw/jbe@1309: end bsw/jbe@1309: