mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-10 23:23:27 -05:00
The yes/no pattern didn’t work too well, because: - it didn’t read naturally as a question and answer - often users left them completely unclicked if they didn’t want to set the permission (rather than clicking no) This commit changes both the invite and edit user pages to use checkboxes to set permissions. If also rewords these pages to read more naturally, and explain what the permissions mean. This meant changing some of the view logic around invites and persmissions, and I ended up refactoring a bunch of it because I found it hard to understand what was going on.
69 lines
2.4 KiB
HTML
69 lines
2.4 KiB
HTML
{% extends "withnav_template.html" %}
|
||
{% from "components/table.html" import list_table, row, field, boolean_field, hidden_field_heading %}
|
||
{% from "components/page-footer.html" import page_footer %}
|
||
|
||
{% set table_options = {
|
||
'field_headings': [
|
||
'Name', 'Send messages', 'Modify service', 'Access API keys', hidden_field_heading('Link to change')
|
||
],
|
||
'field_headings_visible': True,
|
||
'caption_visible': True
|
||
} %}
|
||
|
||
{% block page_title %}
|
||
Manage users – GOV.UK Notify
|
||
{% endblock %}
|
||
|
||
{% block maincolumn_content %}
|
||
|
||
<div class="grid-row">
|
||
<div class="column-two-thirds">
|
||
<h1 class="heading-large">
|
||
Manage team
|
||
</h1>
|
||
</div>
|
||
<div class="column-one-third">
|
||
<a href="{{ url_for('.invite_user', service_id=service_id) }}" class="button align-with-heading">Invite team member</a>
|
||
</div>
|
||
</div>
|
||
|
||
{% call(item) list_table(
|
||
users, caption='Active', **table_options
|
||
) %}
|
||
{% call field() %}
|
||
{{ item.name }}
|
||
{% endcall %}
|
||
{{ boolean_field(item.has_permissions(permissions=['send_texts', 'send_emails', 'send_letters'])) }}
|
||
{{ boolean_field(item.has_permissions(permissions=['manage_users', 'manage_templates', 'manage_settings'])) }}
|
||
{{ boolean_field(item.has_permissions(permissions=['manage_api_keys', 'access_developer_docs'])) }}
|
||
{% call field(align='right') %}
|
||
{% if current_user.id != item.id %}
|
||
<a href="{{ url_for('.edit_user_permissions', service_id=service_id, user_id=item.id)}}">Edit permission</a>
|
||
{% endif %}
|
||
{% endcall %}
|
||
{% endcall %}
|
||
|
||
{% if invited_users %}
|
||
{% call(item) list_table(
|
||
invited_users, caption='Invited', **table_options
|
||
) %}
|
||
{% call field() %}
|
||
{{ item.email_address }}
|
||
{% endcall %}
|
||
{{ boolean_field(item.has_permissions(permissions=['send_texts', 'send_emails', 'send_letters'])) }}
|
||
{{ boolean_field(item.has_permissions(permissions=['manage_users', 'manage_templates', 'manage_settings'])) }}
|
||
{{ boolean_field(item.has_permissions(permissions=['manage_api_keys', 'access_developer_docs'])) }}
|
||
{% if item.status == 'pending' %}
|
||
{% call field(align='right') %}
|
||
<a href="{{ url_for('.cancel_invited_user', service_id=service_id, invited_user_id=item.id)}}">Cancel invitation</a>
|
||
{% endcall %}
|
||
{% else %}
|
||
{% call field() %}
|
||
{{ item.status }}
|
||
{% endcall %}
|
||
{% endif %}
|
||
{% endcall %}
|
||
{% endif %}
|
||
|
||
{% endblock %}
|