mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-09 19:04:33 -04:00
Merge pull request #1034 from GSA/1031-update-team-member-area
1031 update team member area
This commit is contained in:
@@ -114,12 +114,46 @@ td.table-empty-message {
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.button-flex-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
@include at-media(desktop) {
|
||||
flex-direction: row;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
|
||||
.user-list-edit-link:active:before,
|
||||
.user-list-edit-link:focus:before {
|
||||
box-shadow: none;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.user-list {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
gap: units(2);
|
||||
.user-list-item {
|
||||
@include at-media(desktop) {
|
||||
flex: 1 1 calc(50% - units(2));
|
||||
}
|
||||
flex: 1 1 calc(100% - units(2));
|
||||
border: 1px solid color('gray-cool-10');
|
||||
padding: units(2);
|
||||
.tick-cross-list-permissions {
|
||||
margin: units(1) 0;
|
||||
padding-left: units(2);
|
||||
}
|
||||
.hint {
|
||||
display: block;
|
||||
font-size: size("body", "sm");
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.template-list-item-without-ancestors .template-list-folder:active,
|
||||
.template-list-item-without-ancestors .template-list-folder:active::before,
|
||||
.template-list-item-without-ancestors .template-list-folder:focus,
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<div class="display-flex flex-justify flex-align-center">
|
||||
<h1 class="font-body-xl margin-0">
|
||||
Team members
|
||||
</h1>
|
||||
<div class="button-flex-header">
|
||||
<h1 class="font-body-xl margin-0">
|
||||
Team members
|
||||
</h1>
|
||||
{% if current_user.has_permissions('manage_service') %}
|
||||
{{ usaButton({
|
||||
"element": "a",
|
||||
@@ -32,68 +32,65 @@
|
||||
<div class="user-list">
|
||||
{% for user in users %}
|
||||
<div class="user-list-item">
|
||||
<div class="grid-row">
|
||||
<div class="grid-col-9">
|
||||
<h2 class="user-list-item-heading" title="{{ user.email_address }}">
|
||||
{%- if user.name -%}
|
||||
<span class="heading-small live-search-relevant">{{ user.name }}</span> 
|
||||
{%- endif -%}
|
||||
<span class="hint">
|
||||
{%- if user.status == 'pending' -%}
|
||||
<span class="live-search-relevant">{{ user.email_address }}</span> (invited)
|
||||
{%- elif user.status == 'cancelled' -%}
|
||||
<span class="live-search-relevant">{{ user.email_address }}</span> (cancelled invite)
|
||||
{%- elif user.status == 'expired' -%}
|
||||
<span class="live-search-relevant">{{ user.email_address }}</span> (expired invite)
|
||||
{%- elif user.id == current_user.id -%}
|
||||
<span class="live-search-relevant">(you)</span>
|
||||
{% else %}
|
||||
<span class="live-search-relevant">{{ user.email_address }}</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
</h2>
|
||||
<h3 class="margin-bottom-05">Permissions</h3>
|
||||
<ul class="tick-cross-list-permissions">
|
||||
{% for permission, label in permissions %}
|
||||
{{ tick_cross(
|
||||
user.has_permission_for_service(current_service.id, permission),
|
||||
label
|
||||
) }}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{# only show if the service has folders #}
|
||||
{% if current_service.all_template_folders %}
|
||||
<p class="usa-body tick-cross-list-hint">
|
||||
{% set folder_count = user.template_folders_for_service(current_service) | length %}
|
||||
|
||||
{% if folder_count == 0 %}
|
||||
Cannot see any folders
|
||||
{% elif folder_count != current_service.all_template_folders | length %}
|
||||
Can see {{ folder_count }} folder{% if folder_count > 1 %}s{% endif %}
|
||||
{% else %}
|
||||
Can see all folders
|
||||
{% endif%}
|
||||
</p>
|
||||
<h2 class="user-list-item-heading font-body-lg margin-top-0" title="{{ user.email_address }}">
|
||||
{%- if user.name -%}
|
||||
<span class="heading-small live-search-relevant">{{ user.name }}</span>
|
||||
{%- endif -%}
|
||||
{%- if user.status == 'pending' -%}
|
||||
<span class="live-search-relevant">{{ user.email_address }}</span><span class="hint">(invited)</span>
|
||||
{%- elif user.status == 'cancelled' -%}
|
||||
<span class="live-search-relevant">{{ user.email_address }}</span><span class="hint">(cancelled invite)</span>
|
||||
{%- elif user.status == 'expired' -%}
|
||||
<span class="live-search-relevant">{{ user.email_address }}</span><span class="hint">(expired invite)</span>
|
||||
{%- elif user.id == current_user.id -%}
|
||||
<span class="live-search-relevant"></span><span class="hint">(you)</span>
|
||||
{% else %}
|
||||
<span class="live-search-relevant">{{ user.email_address }}</span>
|
||||
{% endif %}
|
||||
</h2>
|
||||
<h3 class="margin-bottom-0">Permissions</h3>
|
||||
<ul class="tick-cross-list-permissions">
|
||||
{% for permission, label in permissions %}
|
||||
{{ tick_cross(
|
||||
user.has_permission_for_service(current_service.id, permission),
|
||||
label
|
||||
) }}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{# only show if the service has folders #}
|
||||
{% if current_service.all_template_folders %}
|
||||
<p class="usa-body tick-cross-list-hint">
|
||||
{% set folder_count = user.template_folders_for_service(current_service) | length %}
|
||||
{% if folder_count == 0 %}
|
||||
Cannot see any folders
|
||||
{% elif folder_count != current_service.all_template_folders | length %}
|
||||
Can see {{ folder_count }} folder{% if folder_count > 1 %}s{% endif %}
|
||||
{% else %}
|
||||
Can see all folders
|
||||
{% endif%}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if current_service.has_permission('email_auth') %}
|
||||
<p class="usa-body tick-cross-list-hint">
|
||||
Signs in with
|
||||
{{ user.auth_type | format_auth_type(with_indefinite_article=True) }}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if current_service.has_permission('email_auth') %}
|
||||
<p class="usa-body tick-cross-list-hint">
|
||||
Signs in with
|
||||
{{ user.auth_type | format_auth_type(with_indefinite_article=True) }}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if current_user.has_permissions('manage_service') %}
|
||||
{% if user.status == 'pending' %}
|
||||
<a class="user-list-edit-link usa-link" href="{{ url_for('.cancel_invited_user', service_id=current_service.id, invited_user_id=user.id)}}">Cancel invitation<span class="usa-sr-only"> for {{ user.email_address }}</span></a>
|
||||
{% elif user.status == 'expired' %}
|
||||
<a class="user-list-edit-link usa-link" href="{{ url_for('.resend_invite', service_id=current_service.id, invited_user_id=user.id)}}">Resend invite<span class="usa-sr-only"> for {{ user.email_address }}</span></a>
|
||||
{% elif user.is_editable_by(current_user) %}
|
||||
<a class="user-list-edit-link usa-link" href="{{ url_for('.edit_user_permissions', service_id=current_service.id, user_id=user.id)}}">Change details<span class="usa-sr-only"> for {{ user.name }} {{ user.email_address }}</span></a>
|
||||
{% endif %}
|
||||
{% if current_service.has_permission('email_auth') %}
|
||||
<p class="usa-body tick-cross-list-hint">
|
||||
Signs in with
|
||||
{{ user.auth_type | format_auth_type(with_indefinite_article=True) }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="grid-col-3">
|
||||
{% if current_user.has_permissions('manage_service') %}
|
||||
{% if user.status == 'pending' %}
|
||||
<a class="user-list-edit-link usa-link" href="{{ url_for('.cancel_invited_user', service_id=current_service.id, invited_user_id=user.id)}}">Cancel invitation<span class="usa-sr-only"> for {{ user.email_address }}</span></a>
|
||||
{% elif user.status == 'expired' %}
|
||||
<a class="user-list-edit-link usa-link" href="{{ url_for('.resend_invite', service_id=current_service.id, invited_user_id=user.id)}}">Resend invite<span class="usa-sr-only"> for {{ user.email_address }}</span></a>
|
||||
{% elif user.is_editable_by(current_user) %}
|
||||
<a class="user-list-edit-link usa-link" href="{{ url_for('.edit_user_permissions', service_id=current_service.id, user_id=user.id)}}">Change details<span class="usa-sr-only"> for {{ user.name }} {{ user.email_address }}</span></a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@ from tests.conftest import (
|
||||
(
|
||||
create_active_user_with_permissions(),
|
||||
(
|
||||
"Test User (you) "
|
||||
"Test User(you) "
|
||||
"Permissions "
|
||||
"Can See dashboard "
|
||||
"Can Send messages "
|
||||
@@ -39,18 +39,18 @@ from tests.conftest import (
|
||||
),
|
||||
(
|
||||
create_active_user_empty_permissions(),
|
||||
("Test User With Empty Permissions (you) " "Permissions"),
|
||||
("Test User With Empty Permissions(you) " "Permissions"),
|
||||
False,
|
||||
),
|
||||
(
|
||||
create_active_user_view_permissions(),
|
||||
("Test User With Permissions (you) " "Permissions " "Can See dashboard"),
|
||||
("Test User With Permissions(you) " "Permissions " "Can See dashboard"),
|
||||
False,
|
||||
),
|
||||
(
|
||||
create_active_user_manage_template_permissions(),
|
||||
(
|
||||
"Test User With Permissions (you) "
|
||||
"Test User With Permissions(you) "
|
||||
"Permissions "
|
||||
"Can See dashboard "
|
||||
"Can Add and edit templates"
|
||||
@@ -232,7 +232,7 @@ def test_should_show_caseworker_on_overview_page(
|
||||
|
||||
assert normalize_spaces(page.select_one("h1").text) == "Team members"
|
||||
assert normalize_spaces(page.select(".user-list-item")[0].text) == (
|
||||
"Test User With Permissions (you) " "Permissions " "Can See dashboard"
|
||||
"Test User With Permissions(you) " "Permissions " "Can See dashboard"
|
||||
)
|
||||
# [1:5] are invited users
|
||||
assert normalize_spaces(page.select(".user-list-item")[6].text) == (
|
||||
@@ -1240,7 +1240,7 @@ def test_cancel_invited_user_doesnt_work_if_user_not_invited_to_this_service(
|
||||
(
|
||||
"pending",
|
||||
(
|
||||
"invited_user@test.gsa.gov (invited) "
|
||||
"invited_user@test.gsa.gov(invited) "
|
||||
"Permissions "
|
||||
"Can See dashboard "
|
||||
"Can Send messages "
|
||||
@@ -1252,7 +1252,7 @@ def test_cancel_invited_user_doesnt_work_if_user_not_invited_to_this_service(
|
||||
(
|
||||
"cancelled",
|
||||
(
|
||||
"invited_user@test.gsa.gov (cancelled invite) "
|
||||
"invited_user@test.gsa.gov(cancelled invite) "
|
||||
"Permissions"
|
||||
# all permissions are greyed out
|
||||
),
|
||||
@@ -1413,10 +1413,7 @@ def test_manage_user_page_shows_how_many_folders_user_can_view(
|
||||
user_div = page.select_one(
|
||||
"h2[title='notify@digital.cabinet-office.gov.uk']"
|
||||
).parent
|
||||
assert (
|
||||
user_div.select_one(".tick-cross-list-hint:last-child").text.strip()
|
||||
== expected_message
|
||||
)
|
||||
assert user_div.select_one(".tick-cross-list-hint").text.strip() == expected_message
|
||||
|
||||
|
||||
def test_manage_user_page_doesnt_show_folder_hint_if_service_has_no_folders(
|
||||
|
||||
Reference in New Issue
Block a user