Skip to content

Commit

Permalink
Merge pull request #865 from GSA/803-keep-current-service-visible
Browse files Browse the repository at this point in the history
803 - keep current service visible
  • Loading branch information
ccostino authored Nov 2, 2023
2 parents cbfccb7 + 7f56c62 commit 25dcdd1
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 27 deletions.
2 changes: 1 addition & 1 deletion app/main/views/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def terms():
)


@main.route("/features/using-notify")
@main.route("/features/using_notify")
@user_is_logged_in
def using_notify():
return (
Expand Down
76 changes: 76 additions & 0 deletions app/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,82 @@ class HeaderNavigation(Navigation):
"message_status",
"guidance_index",
},
"accounts-or-dashboard": {
"conversation",
"inbox",
"monthly",
"service_dashboard",
"template_usage",
"view_notification",
"view_notifications",
"action_blocked",
"add_service_template",
"check_messages",
"check_notification",
"choose_template",
"choose_template_to_copy",
"confirm_redact_template",
"conversation_reply",
"copy_template",
"delete_service_template",
"edit_service_template",
"manage_template_folder",
"send_messages",
"send_one_off",
"send_one_off_step",
"send_one_off_to_myself",
"set_sender",
"set_template_sender",
"view_template",
"view_template_version",
"view_template_versions",
"uploads",
"view_job",
"view_jobs",
"confirm_edit_user_email",
"confirm_edit_user_mobile_number",
"edit_user_email",
"edit_user_mobile_number",
"edit_user_permissions",
"invite_user",
"manage_users",
"remove_user_from_service",
"usage",
"email_branding_govuk",
"email_branding_govuk_and_org",
"email_branding_organization",
"email_branding_request",
"email_branding_something_else",
"estimate_usage",
"link_service_to_organization",
"request_to_go_live",
"service_add_email_reply_to",
"service_add_sms_sender",
"service_confirm_delete_email_reply_to",
"service_confirm_delete_sms_sender",
"service_edit_email_reply_to",
"service_edit_sms_sender",
"service_email_reply_to",
"service_name_change",
"service_preview_email_branding",
"service_set_auth_type",
"service_set_channel",
"send_files_by_email_contact_details",
"service_set_email_branding",
"service_set_inbound_number",
"service_set_inbound_sms",
"service_set_international_sms",
"service_set_reply_to_email",
"service_set_sms_prefix",
"service_verify_reply_to_address",
"service_verify_reply_to_address_updates",
"service_settings",
"service_sms_senders",
"set_free_sms_allowance",
"set_message_limit",
"set_rate_limit",
"submit_request_to_go_live",
},
"pricing": {
"how_to_pay",
"billing_details",
Expand Down
12 changes: 11 additions & 1 deletion app/templates/admin_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
{% if current_user.is_authenticated %}
{% if current_user.platform_admin %}
{% set navigation = [
{
"href": url_for("main.show_accounts_or_dashboard"),
"text": "Current service",
"active": header_navigation.is_selected('accounts-or-dashboard')
},
{
"href": url_for('main.get_started'),
"text": "Using Notify",
Expand Down Expand Up @@ -75,6 +80,11 @@
] %}
{% else %}
{% set navigation = [
{
"href": url_for("main.show_accounts_or_dashboard"),
"text": "Current service",
"active": header_navigation.is_selected('accounts-or-dashboard')
},
{
"href": url_for('main.get_started'),
"text": "Using Notify",
Expand All @@ -92,7 +102,7 @@
},
{
"href": url_for('main.user_profile'),
"text": current_user.name,
"text": "User profile",
"active": header_navigation.is_selected('user-profile')
},
{
Expand Down
2 changes: 1 addition & 1 deletion app/templates/service_navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
{% endmacro %}

<div class="navigation-service margin-top-2 display-flex flex-align-end flex-justify border-bottom padding-bottom-1">
<div class="navigation-service margin-top-5 display-flex flex-align-end flex-justify border-bottom padding-bottom-1">
{% if current_service.organization_id %}
{% if current_user.platform_admin or
(current_user.belongs_to_organization(current_service.organization_id) and current_service.live) %}
Expand Down
4 changes: 2 additions & 2 deletions app/templates/views/dashboard/write-first-messages.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2 class="font-body-lg">Get started</h2>
<a class="usa-button" href="{{ url_for('.choose_template', service_id=current_service.id) }}">
<h2 class="font-body-lg margin-top-0 margin-bottom-1">Get started</h2>
<a class="usa-button margin-bottom-5" href="{{ url_for('.choose_template', service_id=current_service.id) }}">
Create your first template
</a>
6 changes: 3 additions & 3 deletions app/templates/views/user-profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
{% from "components/table.html" import mapping_table, row, text_field, optional_text_field, edit_field, field, boolean_field with context %}

{% block per_page_title %}
Your profile
User profile
{% endblock %}

{% block maincolumn_content %}

<h1 class="font-body-2xl margin-bottom-3">Your profile</h1>
<h1 class="font-body-2xl margin-bottom-3">User profile</h1>

<div class="body-copy-table">
{% call mapping_table(
caption='Your profile',
caption='User profile',
field_headings_visible=False,
caption_visible=False
) %}
Expand Down
4 changes: 2 additions & 2 deletions app/templates/withoutnav_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

{% block beforeContent %}
{% if current_service and current_service.active and current_user.is_authenticated and current_user.belongs_to_service(current_service.id) %}
<div class="navigation-service usa-breadcrumb">
<!-- <div class="navigation-service usa-breadcrumb">
<a href="{{ url_for('main.show_accounts_or_dashboard') }}" class="usa-link usa-breadcrumb__link usa-breadcrumb-back-to">Back to {{ current_service.name }}</a>
</div>
</div> -->
{% endif %}
{% block backLink %}{% endblock %}
{% endblock %}
Expand Down
30 changes: 16 additions & 14 deletions tests/app/main/views/accounts/test_choose_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,21 +256,23 @@ def test_choose_account_should_should_organizations_link_for_platform_admin(
] == expected_headings


def test_choose_account_should_show_back_to_service_link(
client_request,
mock_get_orgs_and_services,
mock_get_organization,
mock_get_organization_services,
):
resp = client_request.get("main.choose_account")
# Moving the back to service link into the top navigation

service_navigation = resp.find(
"div", {"class": "navigation-service usa-breadcrumb"}
)
back_to_service_link = service_navigation.a
# def test_choose_account_should_show_back_to_service_link(
# client_request,
# mock_get_orgs_and_services,
# mock_get_organization,
# mock_get_organization_services,
# ):
# resp = client_request.get("main.choose_account")

assert back_to_service_link["href"] == url_for("main.show_accounts_or_dashboard")
assert back_to_service_link.text == "Back to service one"
# service_navigation = resp.find(
# "div", {"class": "navigation-service usa-breadcrumb"}
# )
# back_to_service_link = service_navigation.a

# assert back_to_service_link["href"] == url_for("main.show_accounts_or_dashboard")
# assert back_to_service_link.text == "Back to service one"


def test_choose_account_should_not_show_back_to_service_link_if_no_service_in_session(
Expand Down Expand Up @@ -322,7 +324,7 @@ def test_choose_account_should_not_show_back_to_service_link_if_service_archived

assert normalize_spaces(page.select_one("h1").text) == "Choose service"
if active:
assert page.select_one(".navigation-service a") is not None
assert page.select_one(".navigation-service a") is None
else:
assert page.select_one(".navigation-service a") is None

Expand Down
6 changes: 3 additions & 3 deletions tests/app/main/views/test_user_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_should_show_overview_page(
client_request,
):
page = client_request.get("main.user_profile")
assert page.select_one("h1").text.strip() == "Your profile"
assert page.select_one("h1").text.strip() == "User profile"
assert "Use platform admin view" not in page
assert "Security keys" not in page

Expand All @@ -27,7 +27,7 @@ def test_overview_page_shows_disable_for_platform_admin(
):
client_request.login(platform_admin_user)
page = client_request.get("main.user_profile")
assert page.select_one("h1").text.strip() == "Your profile"
assert page.select_one("h1").text.strip() == "User profile"
disable_platform_admin_row = page.select_one("#disable-platform-admin")
assert (
" ".join(disable_platform_admin_row.text.split())
Expand Down Expand Up @@ -365,7 +365,7 @@ def test_non_gov_user_cannot_see_change_email_link(
client_request.login(api_nongov_user_active)
page = client_request.get("main.user_profile")
assert not page.find("a", {"href": url_for("main.user_profile_email")})
assert page.select_one("h1").text.strip() == "Your profile"
assert page.select_one("h1").text.strip() == "User profile"


def test_non_gov_user_cannot_access_change_email_page(
Expand Down

0 comments on commit 25dcdd1

Please sign in to comment.