Render dropdowns for permissions
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{% from "components/icon.html" import Icon %}
|
||||
{% from "components/tooltip.html" import Tooltip %}
|
||||
|
||||
{% macro OptionsInput(field, tooltip, inline=False) -%}
|
||||
{% macro OptionsInput(field, tooltip, inline=False, label=True) -%}
|
||||
<optionsinput
|
||||
name='{{ field.name }}'
|
||||
inline-template
|
||||
@@ -12,19 +12,21 @@
|
||||
v-bind:class="['usa-input', { 'usa-input--error': showError, 'usa-input--success': showValid }]">
|
||||
|
||||
<fieldset data-ally-disabled="true" v-on:change="onInput" class="usa-input__choices {% if inline %}usa-input__choices--inline{% endif %}">
|
||||
<legend>
|
||||
<div class="usa-input__title{% if not field.description %}-inline{% endif %}">
|
||||
{{ field.label | striptags}}
|
||||
{% if tooltip %}{{ Tooltip(tooltip) }}{% endif %}
|
||||
</div>
|
||||
{% if label %}
|
||||
<legend>
|
||||
<div class="usa-input__title{% if not field.description %}-inline{% endif %}">
|
||||
{{ field.label | striptags}}
|
||||
{% if tooltip %}{{ Tooltip(tooltip) }}{% endif %}
|
||||
</div>
|
||||
|
||||
{% if field.description %}
|
||||
<span class='usa-input__help'>{{ field.description | safe }}</span>
|
||||
{% endif %}
|
||||
{% if field.description %}
|
||||
<span class='usa-input__help'>{{ field.description | safe }}</span>
|
||||
{% endif %}
|
||||
|
||||
<span v-show='showError'>{{ Icon('alert',classes="icon-validation") }}</span>
|
||||
<span v-show='showValid'>{{ Icon('ok',classes="icon-validation") }}</span>
|
||||
</legend>
|
||||
<span v-show='showError'>{{ Icon('alert',classes="icon-validation") }}</span>
|
||||
<span v-show='showValid'>{{ Icon('ok',classes="icon-validation") }}</span>
|
||||
</legend>
|
||||
{% endif %}
|
||||
|
||||
{{ field() }}
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
{% from "components/icon.html" import Icon %}
|
||||
{% from "components/options_input.html" import OptionsInput %}
|
||||
|
||||
<section class="member-list">
|
||||
<div class='responsive-table-wrapper panel'>
|
||||
@@ -37,31 +38,27 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for member_data in members_data %}
|
||||
<tr>
|
||||
<td class='name'>{{ member_data.member.user_name }}
|
||||
{% if member_data.member.user == user %}
|
||||
{% for subform in permissions_form.members_permissions %}
|
||||
<tr>
|
||||
<td class='name'>{{ subform.member.data }}
|
||||
{% if subform.member.data == user.full_name %}
|
||||
<span class='you'>(<span class='green'>you</span>)</span>
|
||||
{% set archive_button_class = 'usa-button-disabled' %}
|
||||
{% else %}
|
||||
{% set archive_button_class = 'usa-button-secondary' %}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% set heading_perms = [member_data.app_mgmt, member_data.funding, member_data.reporting, member_data.portfolio_mgmt] %}
|
||||
|
||||
{% for has_perm in heading_perms %}
|
||||
{% if has_perm %}
|
||||
<td class='green'>Edit Access</td>
|
||||
{% else %}
|
||||
<td>View Only</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<td><button type="button" class='{{ archive_button_class }}'>{{ "portfolios.members.archive_button" | translate }}</button>
|
||||
</td>
|
||||
<td>{{ OptionsInput(subform.perms_app_mgmt, label=False) }}</td>
|
||||
<td>{{ OptionsInput(subform.perms_funding, label=False) }}</td>
|
||||
<td>{{ OptionsInput(subform.perms_reporting, label=False) }}</td>
|
||||
<td>{{ OptionsInput(subform.perms_portfolio_mgmt, label=False) }}</td>
|
||||
|
||||
<td><button type="button" class='{{ archive_button_class }}'>{{ "portfolios.members.archive_button" | translate }}</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<input type='submit' class='usa-button usa-button-primary' value='{{ "Save" }}' />
|
||||
@@ -69,6 +66,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
</section>
|
||||
|
@@ -14,13 +14,14 @@
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel__content">
|
||||
|
||||
{% if user_can(permissions.VIEW_PORTFOLIO_NAME) %}
|
||||
<form method="POST" action="{{ url_for('portfolios.edit_portfolio', portfolio_id=portfolio.id) }}" autocomplete="false">
|
||||
{{ form.csrf_token }}
|
||||
<div class='form-row'>
|
||||
<div class='form-col form-col--half'>
|
||||
{{ TextInput(form.name, validation="portfolioName") }}
|
||||
</div>
|
||||
<form method="POST" action="{{ url_for('portfolios.edit_portfolio', portfolio_id=portfolio.id) }}" autocomplete="false">
|
||||
{{ portfolio_form.csrf_token }}
|
||||
<div class='form-row'>
|
||||
<div class='form-col form-col--half'>
|
||||
{{ TextInput(portfolio_form.name, validation="portfolioName") }}
|
||||
</div>
|
||||
|
||||
<div class='edit-portfolio-name action-group'>
|
||||
<button type="submit" class="usa-button usa-button-big usa-button-primary" tabindex="0">Save</button>
|
||||
|
Reference in New Issue
Block a user