{{ domain.name }}
+{{ domain.name }}
{% if contact.title %}{{ contact.title }}
{% endif %} {% if contact.email %}{{ contact.email }}
{% endif %} - {% if contact.phone %}{{ contact.phone.as_national }}{% endif %} + {% if not portfolio and contact.phone %}{{ contact.phone.as_national }}{% endif %} diff --git a/src/registrar/templates/includes/organization_address.html b/src/registrar/templates/includes/organization_address.html index d6126d681..5b03620c0 100644 --- a/src/registrar/templates/includes/organization_address.html +++ b/src/registrar/templates/includes/organization_address.html @@ -1,6 +1,6 @@ - {% if organization.federal_agency %} - {{ organization.federal_agency }}
+ {% if not portfolio and organization.federal_agency %} + {{ organization.federal_agency }}
{% endif %} {% if organization.organization_name %} {{ organization.organization_name }} diff --git a/src/registrar/templates/includes/summary_item.html b/src/registrar/templates/includes/summary_item.html index 0ce7910bb..057423488 100644 --- a/src/registrar/templates/includes/summary_item.html +++ b/src/registrar/templates/includes/summary_item.html @@ -1,6 +1,8 @@ {% load static url_helpers %} -
@@ -17,63 +15,18 @@ {% include 'portfolio_organization_sidebar.html' %}
Organization
- -The name of your organization will be publicly listed as the domain registrant.
- - {% if has_edit_portfolio_permission %} -- Your organization name can’t be updated here. - To suggest an update, email help@get.gov. -
- - {% include "includes/required_fields.html" %} - - {% else %} -Organization name
-- {{ portfolio.federal_agency }} -
- {% if form.address_line1.value is not None %} - {% include "includes/input_read_only.html" with field=form.address_line1 %} - {% endif %} - {% if form.address_line2.value is not None %} - {% include "includes/input_read_only.html" with field=form.address_line2 %} - {% endif %} - {% if form.city.value is not None %} - {% include "includes/input_read_only.html" with field=form.city %} - {% endif %} - {% if form.state_territory.value is not None %} - {% include "includes/input_read_only.html" with field=form.state_territory %} - {% endif %} - {% if form.zipcode.value is not None %} - {% include "includes/input_read_only.html" with field=form.zipcode %} - {% endif %} - {% endif %} - -Organization overview
+{{ portfolio }}
+ {% url 'organization-info' as url %} + {% include "includes/summary_item.html" with title='Organization' value=portfolio address='true' edit_link=url editable=has_edit_portfolio_permission view_button='true' portfolio_first_section='true'%} + + {% url 'organization-senior-official' as url %} + {% include "includes/summary_item.html" with title='Senior official' value=portfolio.senior_official contact='true' edit_link=url view_button='true' %} ++ Portfolio name: {{ portfolio }} +
+ + {% include 'portfolio_organization_sidebar.html' %} +Organization
+The name of your organization will be publicly listed as the domain registrant.
+ + {% if has_edit_portfolio_permission %} ++ Your organization name can’t be updated here. + To suggest an update, email help@get.gov. +
+ + {% include "includes/required_fields.html" %} + + {% else %} +Organization name
++ {{ portfolio.federal_agency }} +
+ {% if form.address_line1.value is not None %} + {% include "includes/input_read_only.html" with field=form.address_line1 %} + {% endif %} + {% if form.address_line2.value is not None %} + {% include "includes/input_read_only.html" with field=form.address_line2 %} + {% endif %} + {% if form.city.value is not None %} + {% include "includes/input_read_only.html" with field=form.city %} + {% endif %} + {% if form.state_territory.value is not None %} + {% include "includes/input_read_only.html" with field=form.state_territory %} + {% endif %} + {% if form.zipcode.value is not None %} + {% include "includes/input_read_only.html" with field=form.zipcode %} + {% endif %} + {% endif %} +- {% url 'organization' as url %} + + Organization overview + + + +
- + {% url 'organization-info' as url %} @@ -13,7 +22,7 @@
-
- {% url 'senior-official' as url %}
+ {% url 'organization-senior-official' as url %}
diff --git a/src/registrar/templates/portfolio_senior_official.html b/src/registrar/templates/portfolio_senior_official.html
index d521c015b..0b48befe2 100644
--- a/src/registrar/templates/portfolio_senior_official.html
+++ b/src/registrar/templates/portfolio_senior_official.html
@@ -5,10 +5,10 @@
{% load static %}
-{% block portfolio_content %}
+{% block portfolio_organization_content %}
--++diff --git a/src/registrar/templatetags/custom_filters.py b/src/registrar/templatetags/custom_filters.py index e02a29e73..a2e727557 100644 --- a/src/registrar/templatetags/custom_filters.py +++ b/src/registrar/templatetags/custom_filters.py @@ -241,7 +241,8 @@ def is_portfolio_subpage(path): # Since our pages aren't unified under a common path, we need this approach for now. url_names = [ "organization", - "senior-official", + "organization-info", + "organization-senior-official", ] return get_url_name(path) in url_names diff --git a/src/registrar/tests/test_views_portfolio.py b/src/registrar/tests/test_views_portfolio.py index 81be0d3ad..40a9482f1 100644 --- a/src/registrar/tests/test_views_portfolio.py +++ b/src/registrar/tests/test_views_portfolio.py @@ -74,7 +74,7 @@ class TestPortfolio(WebTest): additional_permissions=[UserPortfolioPermissionChoices.VIEW_PORTFOLIO], ) - so_portfolio_page = self.app.get(reverse("senior-official")) + so_portfolio_page = self.app.get(reverse("organization-senior-official")) # Assert that we're on the right page self.assertContains(so_portfolio_page, "Senior official") self.assertContains(so_portfolio_page, "Saturn Enceladus") @@ -196,29 +196,119 @@ class TestPortfolio(WebTest): self.assertEqual(response.status_code, 403) @less_console_noise_decorator - def test_portfolio_organization_page_read_only(self): - """Test that user with a portfolio can access the portfolio organization page, read only""" + def test_portfolio_organization_page_includes_org_info_and_senior_official(self): + """Test that portfolio user on the organization overview page includes sections on the organization's + info and senior official""" + self.app.set_user(self.user.username) + portfolio_permission, _ = UserPortfolioPermission.objects.get_or_create( + user=self.user, + portfolio=self.portfolio, + additional_permissions=[ + UserPortfolioPermissionChoices.VIEW_PORTFOLIO, + UserPortfolioPermissionChoices.EDIT_PORTFOLIO, + ], + ) + so = SeniorOfficial.objects.create( + first_name="Saturn", last_name="Enceladus", title="Planet/Moon", email="spacedivision@igorville.com" + ) + + self.portfolio.senior_official = so + self.portfolio.organization_name = "Hotel California" + self.portfolio.city = "Los Angeles" + self.portfolio.save() + + with override_flag("organization_feature", active=True): + # User can access organization info form via organization overview page + response = self.app.get(reverse("organization")) + self.assertEqual(response.status_code, 200) + # Organization overview page includes organization name + self.assertContains(response, "
@@ -19,6 +19,20 @@
+ {% block breadcrumb %} + + + {% endblock breadcrumb %} + {% include "includes/senior_official.html" with can_edit=False %}Organization overview
") + self.assertContains(response, "Hotel California") + # Organization overview page includes organization info and senior official details + self.assertContains(response, "Los Angeles") + self.assertContains(response, "spacedivision@igorville.com") + + @less_console_noise_decorator + def test_portfolio_organization_page_directs_to_org_detail_forms(self): + """Test that portfolio user on the organization overview page can click on the overview + sections to their respective forms""" + self.app.set_user(self.user.username) + portfolio_permission, _ = UserPortfolioPermission.objects.get_or_create( + user=self.user, + portfolio=self.portfolio, + additional_permissions=[ + UserPortfolioPermissionChoices.VIEW_PORTFOLIO, + UserPortfolioPermissionChoices.EDIT_PORTFOLIO, + ], + ) + self.portfolio.save() + + with override_flag("organization_feature", active=True): + # User can access organization info form via organization overview page + response = self.app.get(reverse("organization")) + # The overview page includes button to edit organization + org_info_url = reverse("organization-info") + org_senior_official_url = reverse("organization-senior-official") + self.assertContains(response, f'href="{org_info_url}"') + self.assertContains(response, f'href="{org_senior_official_url}"') + + @less_console_noise_decorator + def test_portfolio_organization_page_section_viewonly_icon(self): + """Test organization page setion displays viewonly icon for portfolio nonadmin member""" self.app.set_user(self.user.username) portfolio_permission, _ = UserPortfolioPermission.objects.get_or_create( user=self.user, portfolio=self.portfolio, additional_permissions=[UserPortfolioPermissionChoices.VIEW_PORTFOLIO], ) - self.portfolio.city = "Los Angeles" self.portfolio.save() + with override_flag("organization_feature", active=True): - response = self.app.get(reverse("organization")) - # Assert the response is a 200 - self.assertEqual(response.status_code, 200) - # The label for Federal agency will always be a h4 - self.assertContains(response, 'Organization name
') - # The read only label for city will be a h4 - self.assertContains(response, 'City
') - self.assertNotContains(response, 'for="id_city"') - self.assertContains(response, 'Los Angeles
') + # User can access view-only form via organization overview page + org_overview_response = self.app.get(reverse("organization")) + # Viewonly icons for org info and senior official (which is always viewonly) + # visibility is html id of view only icon + self.assertContains(org_overview_response, "visibility", count=2) @less_console_noise_decorator - def test_portfolio_organization_page_edit_access(self): + def test_portfolio_organization_page_section_edit_icon(self): + """Test organization page setion displays viewonly icon for portfolio nonadmin member""" + self.app.set_user(self.user.username) + portfolio_permission, _ = UserPortfolioPermission.objects.get_or_create( + user=self.user, + portfolio=self.portfolio, + additional_permissions=[UserPortfolioPermissionChoices.VIEW_PORTFOLIO], + ) + self.portfolio.save() + + with override_flag("organization_feature", active=True): + # User can access view-only form via organization overview page + org_overview_response = self.app.get(reverse("organization")) + # Viewonly icons for org info and senior official (which is always viewonly) + # visibility is html id of view only icon + self.assertContains(org_overview_response, "visibility", count=2) + + @less_console_noise_decorator + def test_portfolio_organization_info_page_read_only(self): + """Test that user with a portfolio can access the portfolio organization page, read only""" + self.app.set_user(self.user.username) + portfolio_permission, _ = UserPortfolioPermission.objects.get_or_create( + user=self.user, + portfolio=self.portfolio, + additional_permissions=[ + UserPortfolioPermissionChoices.VIEW_PORTFOLIO, + UserPortfolioPermissionChoices.EDIT_PORTFOLIO, + ], + ) + self.portfolio.save() + with override_flag("organization_feature", active=True): + # User can access view-only form via organization overview page + org_overview_response = self.app.get(reverse("organization")) + # Edit icons for org info (senior official is always viewonly) + self.assertContains(org_overview_response, "Edit") + + @less_console_noise_decorator + def test_portfolio_organization_info_page_edit_access(self): """Test that user with a portfolio can access the portfolio organization page, read only""" self.app.set_user(self.user.username) portfolio_permission, _ = UserPortfolioPermission.objects.get_or_create( @@ -231,8 +321,10 @@ class TestPortfolio(WebTest): ) self.portfolio.city = "Los Angeles" self.portfolio.save() + with override_flag("organization_feature", active=True): - response = self.app.get(reverse("organization")) + # User can access editable form via organization info page + response = self.app.get(reverse("organization-info")) # Assert the response is a 200 self.assertEqual(response.status_code, 200) # The label for Federal agency will always be a h4 @@ -242,6 +334,33 @@ class TestPortfolio(WebTest): self.assertNotContains(response, 'Los Angeles
') self.assertContains(response, 'for="id_city"') + @less_console_noise_decorator + def test_portfolio_organization_detail_pages_include_breadcrumb(self): + """Test that breadcrumb menus display on portfolio detail pages""" + self.app.set_user(self.user.username) + portfolio_permission, _ = UserPortfolioPermission.objects.get_or_create( + user=self.user, + portfolio=self.portfolio, + additional_permissions=[ + UserPortfolioPermissionChoices.VIEW_PORTFOLIO, + UserPortfolioPermissionChoices.EDIT_PORTFOLIO, + ], + ) + self.portfolio.organization_name = "Hotel California" + self.portfolio.save() + + with override_flag("organization_feature", active=True): + # Breadcrumb appears on organization info page + org_info_response = self.app.get(reverse("organization-info")) + self._assert_has_organization_breadcrumb(org_info_response) + so_response = self.app.get(reverse("organization-senior-official")) + self._assert_has_organization_breadcrumb(so_response) + + def _assert_has_organization_breadcrumb(self, response): + self.assertContains(response, '