Previously, we were encoding the portfolio_role.user_id as part of the form data for the portfolio admin page. This was convenient because it allowed us to easily determine certain display attributes in the template. Instead, we should rely on the PortfolioRole as the source of truth for member information. This commit adds: - Portfolio.owner_role to return the PortfolioRole of the owner - explicitly passes the PortfolioRole IDs for the PPoC and current user to the template - PortfolioRole.full_name for deriving the member name
27 lines
941 B
HTML
27 lines
941 B
HTML
{% for subform in member_perms_form.members_permissions %}
|
|
{% set ppoc = subform.member_id.data == ppoc_id %}
|
|
{% set heading_perms = [subform.perms_app_mgmt, subform.perms_funding, subform.perms_reporting, subform.perms_portfolio_mgmt] %}
|
|
|
|
<tr>
|
|
<td class='name'>{{ subform.member_name.data }}
|
|
<div>
|
|
{% if ppoc %}
|
|
<span class='you'>PPoC</span>
|
|
{% endif %}
|
|
{% if subform.member_id.data == current_member_id %}
|
|
<span class='you'>(<span class='green'>you</span>)</span>
|
|
{% endif %}
|
|
</div>
|
|
</td>
|
|
|
|
{% for access in heading_perms %}
|
|
{% if dict(access.choices).get(access.data) == ('portfolios.members.permissions.edit_access' | translate) %}
|
|
<td class='green'>{{ 'portfolios.members.permissions.edit_access' | translate }}</td>
|
|
{% else %}
|
|
<td>{{ 'common.view' | translate }}</td>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
</tr>
|
|
{% endfor %}
|