From 39a0716028b2c36584b75a14a1cfc549d370d997 Mon Sep 17 00:00:00 2001 From: rachel-dtr Date: Fri, 10 May 2019 10:28:02 -0400 Subject: [PATCH 1/3] Updating content across the site --- atst/forms/portfolio_member.py | 16 ++++++++-------- atst/forms/team.py | 8 ++++---- atst/utils/flash.py | 8 +++----- templates/portfolios/applications/index.html | 2 +- templates/portfolios/applications/members.html | 2 +- translations.yaml | 11 ++++++++--- 6 files changed, 25 insertions(+), 22 deletions(-) diff --git a/atst/forms/portfolio_member.py b/atst/forms/portfolio_member.py index 2a59848f..6ee3f3b5 100644 --- a/atst/forms/portfolio_member.py +++ b/atst/forms/portfolio_member.py @@ -14,29 +14,29 @@ class PermissionsForm(BaseForm): perms_app_mgmt = SelectField( translate("forms.new_member.app_mgmt"), choices=[ - (PermissionSets.VIEW_PORTFOLIO_APPLICATION_MANAGEMENT, "View only"), - (PermissionSets.EDIT_PORTFOLIO_APPLICATION_MANAGEMENT, "Edit access"), + (PermissionSets.VIEW_PORTFOLIO_APPLICATION_MANAGEMENT, "View"), + (PermissionSets.EDIT_PORTFOLIO_APPLICATION_MANAGEMENT, "Edit"), ], ) perms_funding = SelectField( translate("forms.new_member.funding"), choices=[ - (PermissionSets.VIEW_PORTFOLIO_FUNDING, "View only"), - (PermissionSets.EDIT_PORTFOLIO_FUNDING, "Edit access"), + (PermissionSets.VIEW_PORTFOLIO_FUNDING, "View"), + (PermissionSets.EDIT_PORTFOLIO_FUNDING, "Edit"), ], ) perms_reporting = SelectField( translate("forms.new_member.reporting"), choices=[ - (PermissionSets.VIEW_PORTFOLIO_REPORTS, "View only"), - (PermissionSets.EDIT_PORTFOLIO_REPORTS, "Edit access"), + (PermissionSets.VIEW_PORTFOLIO_REPORTS, "View"), + (PermissionSets.EDIT_PORTFOLIO_REPORTS, "Edit"), ], ) perms_portfolio_mgmt = SelectField( translate("forms.new_member.portfolio_mgmt"), choices=[ - (PermissionSets.VIEW_PORTFOLIO_ADMIN, "View only"), - (PermissionSets.EDIT_PORTFOLIO_ADMIN, "Edit access"), + (PermissionSets.VIEW_PORTFOLIO_ADMIN, "View"), + (PermissionSets.EDIT_PORTFOLIO_ADMIN, "Edit"), ], ) diff --git a/atst/forms/team.py b/atst/forms/team.py index 51e9c883..6e4ce3ee 100644 --- a/atst/forms/team.py +++ b/atst/forms/team.py @@ -13,15 +13,15 @@ class PermissionsForm(FlaskForm): perms_team_mgmt = SelectField( translate("portfolios.applications.members.new.manage_team"), choices=[ - (PermissionSets.VIEW_APPLICATION, "View only"), - (PermissionSets.EDIT_APPLICATION_TEAM, "Edit access"), + (PermissionSets.VIEW_APPLICATION, "View"), + (PermissionSets.EDIT_APPLICATION_TEAM, "Edit"), ], ) perms_env_mgmt = SelectField( translate("portfolios.applications.members.new.manage_envs"), choices=[ - (PermissionSets.VIEW_APPLICATION, "View only"), - (PermissionSets.EDIT_APPLICATION_ENVIRONMENTS, "Edit access"), + (PermissionSets.VIEW_APPLICATION, "View"), + (PermissionSets.EDIT_APPLICATION_ENVIRONMENTS, "Edit"), ], ) perms_del_env = SelectField( diff --git a/atst/utils/flash.py b/atst/utils/flash.py index 38383fdf..12b43b2d 100644 --- a/atst/utils/flash.py +++ b/atst/utils/flash.py @@ -79,10 +79,8 @@ MESSAGES = { "category": "error", }, "login_next": { - "title_template": "Log in Required.", - "message_template": """ - After you log in, you will be redirected to your destination page. - """, + "title_template": translate("flash.login_required_title"), + "message_template": translate("flash.login_required_message"), "category": "warning", }, "new_portfolio": { @@ -162,7 +160,7 @@ MESSAGES = { "title_template": translate("flash.success"), "message_template": """ {{ "flash.application.deleted" | translate({"application_name": application_name}) }} - Undo. + translate("common.undo") """, "category": "success", }, diff --git a/templates/portfolios/applications/index.html b/templates/portfolios/applications/index.html index b7c47315..6a20e277 100644 --- a/templates/portfolios/applications/index.html +++ b/templates/portfolios/applications/index.html @@ -24,7 +24,7 @@ {% if not portfolio.applications %} {{ EmptyState( - 'This portfolio doesn’t have any applications yet.', + 'This portfolio doesn’t have any applications', action_label='Add a new application' if can_create_applications else None, action_href=url_for('applications.new', portfolio_id=portfolio.id) if can_create_applications else None, icon='cloud', diff --git a/templates/portfolios/applications/members.html b/templates/portfolios/applications/members.html index 8bb3c3b4..52753a9e 100644 --- a/templates/portfolios/applications/members.html +++ b/templates/portfolios/applications/members.html @@ -14,7 +14,7 @@ {% set user_can_invite = user_can(permissions.CREATE_PORTFOLIO_USERS) %} {{ EmptyState( - 'There are currently no members in this Portfolio.', + 'There are currently no members in this portfolio', action_label='Invite a new Member' if user_can_invite else None, action_href='/members/new' if user_can_invite else None, sub_message=None if user_can_invite else 'Please contact your JEDI Cloud portfolio administrator to invite new members.', diff --git a/translations.yaml b/translations.yaml index 16824faf..560101f5 100644 --- a/translations.yaml +++ b/translations.yaml @@ -38,6 +38,7 @@ common: save_and_continue: Save & continue show: Show sign: Sign + undo: Undo resource_names: environments: Environments choose_role: Choose a role @@ -65,6 +66,8 @@ flash: congrats: Congrats! delete_member_success: 'You have successfully deleted {member_name} from the portfolio.' deleted_member: Portfolio member deleted + login_required_message: After you log in, you will be redirected to your destination page. + login_required_title: Log in required new_portfolio: You've created a new JEDI portfolio and jump-started your first task order! new_portfolio_member: 'You have successfully invited {user_name} to the portfolio.' new_ppoc_message: 'You have successfully added {ppoc_name} as the primary point of contact. You are no longer the PPoC.' @@ -423,6 +426,8 @@ portfolios: environments_heading: Application environments existing_application_title: '{application_name} Application Settings' new_application_title: New Application + no_applications: This portfolio doesn’t have any applications yet + no_members: There are currently no members in this portfolio settings_heading: Application Settings team_management: subheading: Team Management @@ -463,12 +468,12 @@ portfolios: archive_button: Delete member permissions: app_mgmt: App management - edit_access: Edit access + edit_access: Edit funding: Funding name: Name portfolio_mgmt: Portfolio management reporting: Reporting - view_only: View only + view_only: View task_orders: available_budget_help_description: The available budget shown includes the available budget of all active task orders requests: @@ -638,7 +643,7 @@ task_orders: so_info_title: Security officer information review: app_info: Overview - classified_inactive: (Available Soon) + classified_inactive: (Available soon) clin_1: 'CLIN #1: Unclassified Cloud' clin_2: 'CLIN #2: Classified Cloud' clin_3: 'CLIN #3: Unclassified Cloud' From 74422c57aab1c772a8cfd1a75a8fe8be8ba116da Mon Sep 17 00:00:00 2001 From: Montana Date: Mon, 13 May 2019 09:28:47 -0400 Subject: [PATCH 2/3] Use common "View" for translations -also pipe translate in injected html for a flash --- atst/forms/portfolio_member.py | 22 +++++++++++++-------- atst/utils/flash.py | 2 +- templates/fragments/admin/members_view.html | 2 +- translations.yaml | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/atst/forms/portfolio_member.py b/atst/forms/portfolio_member.py index 6ee3f3b5..4c39ad1e 100644 --- a/atst/forms/portfolio_member.py +++ b/atst/forms/portfolio_member.py @@ -14,29 +14,35 @@ class PermissionsForm(BaseForm): perms_app_mgmt = SelectField( translate("forms.new_member.app_mgmt"), choices=[ - (PermissionSets.VIEW_PORTFOLIO_APPLICATION_MANAGEMENT, "View"), - (PermissionSets.EDIT_PORTFOLIO_APPLICATION_MANAGEMENT, "Edit"), + ( + PermissionSets.VIEW_PORTFOLIO_APPLICATION_MANAGEMENT, + translate("common.view"), + ), + ( + PermissionSets.EDIT_PORTFOLIO_APPLICATION_MANAGEMENT, + translate("common.edit"), + ), ], ) perms_funding = SelectField( translate("forms.new_member.funding"), choices=[ - (PermissionSets.VIEW_PORTFOLIO_FUNDING, "View"), - (PermissionSets.EDIT_PORTFOLIO_FUNDING, "Edit"), + (PermissionSets.VIEW_PORTFOLIO_FUNDING, translate("common.view")), + (PermissionSets.EDIT_PORTFOLIO_FUNDING, translate("common.edit")), ], ) perms_reporting = SelectField( translate("forms.new_member.reporting"), choices=[ - (PermissionSets.VIEW_PORTFOLIO_REPORTS, "View"), - (PermissionSets.EDIT_PORTFOLIO_REPORTS, "Edit"), + (PermissionSets.VIEW_PORTFOLIO_REPORTS, translate("common.view")), + (PermissionSets.EDIT_PORTFOLIO_REPORTS, translate("common.edit")), ], ) perms_portfolio_mgmt = SelectField( translate("forms.new_member.portfolio_mgmt"), choices=[ - (PermissionSets.VIEW_PORTFOLIO_ADMIN, "View"), - (PermissionSets.EDIT_PORTFOLIO_ADMIN, "Edit"), + (PermissionSets.VIEW_PORTFOLIO_ADMIN, translate("common.view")), + (PermissionSets.EDIT_PORTFOLIO_ADMIN, translate("common.edit")), ], ) diff --git a/atst/utils/flash.py b/atst/utils/flash.py index 12b43b2d..f2b07ed6 100644 --- a/atst/utils/flash.py +++ b/atst/utils/flash.py @@ -160,7 +160,7 @@ MESSAGES = { "title_template": translate("flash.success"), "message_template": """ {{ "flash.application.deleted" | translate({"application_name": application_name}) }} - translate("common.undo") + {{ "common.undo" | translate }} """, "category": "success", }, diff --git a/templates/fragments/admin/members_view.html b/templates/fragments/admin/members_view.html index b79979b4..9e3a3368 100644 --- a/templates/fragments/admin/members_view.html +++ b/templates/fragments/admin/members_view.html @@ -18,7 +18,7 @@ {% if dict(access.choices).get(access.data) == ('portfolios.members.permissions.edit_access' | translate) %} {{ 'portfolios.members.permissions.edit_access' | translate }} {% else %} - {{ 'portfolios.members.permissions.view_only' | translate }} + {{ 'common.view' | translate }} {% endif %} {% endfor %} diff --git a/translations.yaml b/translations.yaml index 560101f5..de1d625a 100644 --- a/translations.yaml +++ b/translations.yaml @@ -39,6 +39,7 @@ common: show: Show sign: Sign undo: Undo + view: View resource_names: environments: Environments choose_role: Choose a role @@ -473,7 +474,6 @@ portfolios: name: Name portfolio_mgmt: Portfolio management reporting: Reporting - view_only: View task_orders: available_budget_help_description: The available budget shown includes the available budget of all active task orders requests: From 0a52cd01442329b99f4bd7029f33088a454511ad Mon Sep 17 00:00:00 2001 From: Montana Date: Mon, 13 May 2019 09:35:31 -0400 Subject: [PATCH 3/3] Update csrf test for updated content --- tests/routes/test_errors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/routes/test_errors.py b/tests/routes/test_errors.py index 35c0d82d..0ffff430 100644 --- a/tests/routes/test_errors.py +++ b/tests/routes/test_errors.py @@ -19,4 +19,4 @@ def test_csrf_error(csrf_enabled_app, client): body = response.data.decode() assert "Session Expired" in body - assert "Log in Required" in body + assert "Log in required" in body