mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-24 03:30:50 +02:00
* Add admin list on org info page with rough styling * Use an unstyled unordered list for admin list * Remove admin title * Update indenting and change h4 to h3 to not jump heading levels * Readd accidentally deleted line; add another heading to give it semantic sense * Update with new design for headings and field data * Update tests to reflect html changes * Fix formating issue * Update styling; update field used for org name * Update org name value to show fed agency if org name doesn't exist * Utilize address template * Update styling to be determined by top-level wrapper * Linter updates * Update test to check address * Use federal_agency as intended
This commit is contained in:
parent
651112cca5
commit
4f77fa661f
4 changed files with 84 additions and 59 deletions
|
@ -39,15 +39,15 @@
|
||||||
</p>
|
</p>
|
||||||
<div class="desktop:margin-top-4">
|
<div class="desktop:margin-top-4">
|
||||||
{% if form.full_name.value is not None %}
|
{% if form.full_name.value is not None %}
|
||||||
{% include "includes/input_read_only.html" with field=form.full_name %}
|
<p class="margin-top-0 margin-bottom-0">{{ form.full_name.value }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if form.title.value is not None %}
|
{% if form.title.value is not None %}
|
||||||
{% include "includes/input_read_only.html" with field=form.title %}
|
<p class="margin-top-0 margin-bottom-0">{{ form.title.value }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if form.email.value is not None %}
|
{% if form.email.value is not None %}
|
||||||
{% include "includes/input_read_only.html" with field=form.email %}
|
<p class="margin-top-0 margin-bottom-0">{{ form.email.value }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -21,16 +21,17 @@
|
||||||
{% block breadcrumb %}
|
{% block breadcrumb %}
|
||||||
<!-- Navigation breadcrumbs -->
|
<!-- Navigation breadcrumbs -->
|
||||||
<nav class="usa-breadcrumb padding-top-0" aria-label="Portfolio organization breadcrumb">
|
<nav class="usa-breadcrumb padding-top-0" aria-label="Portfolio organization breadcrumb">
|
||||||
<ol class="usa-breadcrumb__list">
|
<ol class="usa-breadcrumb__list">
|
||||||
<li class="usa-breadcrumb__list-item">
|
<li class="usa-breadcrumb__list-item">
|
||||||
<a href="{% url 'organization' %}" class="usa-breadcrumb__link"><span>{{ portfolio }}</span></a>
|
<a href="{% url 'organization' %}" class="usa-breadcrumb__link"><span>{{ portfolio }}</span></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="usa-breadcrumb__list-item usa-current" aria-current="page">
|
<li class="usa-breadcrumb__list-item usa-current" aria-current="page">
|
||||||
<span>Organization</span>
|
<span>Organization</span>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
{% endblock breadcrumb %}
|
{% endblock breadcrumb %}
|
||||||
|
|
||||||
<!-- Form messages -->
|
<!-- Form messages -->
|
||||||
{% include "includes/form_errors.html" with form=form %}
|
{% include "includes/form_errors.html" with form=form %}
|
||||||
{% block messages %}
|
{% block messages %}
|
||||||
|
@ -42,49 +43,50 @@
|
||||||
<p>The name of your organization will be publicly listed as the domain registrant.</p>
|
<p>The name of your organization will be publicly listed as the domain registrant.</p>
|
||||||
|
|
||||||
{% if has_edit_portfolio_permission %}
|
{% if has_edit_portfolio_permission %}
|
||||||
<p>
|
<p>
|
||||||
Your organization name can’t be updated here.
|
Your organization name can’t be updated here.
|
||||||
To suggest an update, email <a href="mailto:help@get.gov" class="usa-link">help@get.gov</a>.
|
To suggest an update, email <a href="mailto:help@get.gov" class="usa-link">help@get.gov</a>.
|
||||||
</p>
|
</p>
|
||||||
|
{% endif %}
|
||||||
{% include "includes/required_fields.html" %}
|
<h2>Organization admins</h2>
|
||||||
<form class="usa-form usa-form--large desktop:margin-top-4" method="post" novalidate>
|
<ul class="usa-list usa-list--unstyled margin-top-2 margin-bottom-0">
|
||||||
{% csrf_token %}
|
{% for admin in portfolio_admins %}
|
||||||
<h4 class="margin-bottom-05">Organization name</h4>
|
<li>
|
||||||
<p class="margin-top-0">
|
<p class="margin-bottom-0">{{admin.first_name}} {{admin.last_name}}</p>
|
||||||
{{ portfolio.federal_agency }}
|
<p class="margin-top-0">{{admin.email}}</p>
|
||||||
</p>
|
</li>
|
||||||
{% input_with_errors form.address_line1 %}
|
{% endfor %}
|
||||||
{% input_with_errors form.address_line2 %}
|
</ul>
|
||||||
{% input_with_errors form.city %}
|
|
||||||
{% input_with_errors form.state_territory %}
|
<h2>Organization name and address</h2>
|
||||||
{% with add_class="usa-input--small" sublabel_text="Enter a 5-digit or 9-digit zip code, like 12345 or 12345-6789." %}
|
|
||||||
{% input_with_errors form.zipcode %}
|
{% if has_edit_portfolio_permission %}
|
||||||
{% endwith %}
|
{% include "includes/required_fields.html" with remove_margin_top=True %}
|
||||||
<button type="submit" class="usa-button">
|
<form class="usa-form usa-form--large" method="post" novalidate>
|
||||||
Save
|
{% csrf_token %}
|
||||||
</button>
|
<p class="margin-bottom-05 text-primary-darker text-bold">Organization name</p>
|
||||||
</form>
|
|
||||||
{% else %}
|
|
||||||
<h4 class="margin-bottom-05">Organization name</h4>
|
|
||||||
<p class="margin-top-0">
|
<p class="margin-top-0">
|
||||||
|
{% if portfolio.organization_name %}
|
||||||
|
{{ portfolio.organization_name }}
|
||||||
|
{% else %}
|
||||||
{{ portfolio.federal_agency }}
|
{{ portfolio.federal_agency }}
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
{% if form.address_line1.value is not None %}
|
{% input_with_errors form.address_line1 %}
|
||||||
{% include "includes/input_read_only.html" with field=form.address_line1 %}
|
{% input_with_errors form.address_line2 %}
|
||||||
{% endif %}
|
{% input_with_errors form.city %}
|
||||||
{% if form.address_line2.value is not None %}
|
{% input_with_errors form.state_territory %}
|
||||||
{% include "includes/input_read_only.html" with field=form.address_line2 %}
|
{% with add_class="usa-input--small" sublabel_text="Enter a 5-digit or 9-digit zip code, like 12345 or 12345-6789." %}
|
||||||
{% endif %}
|
{% input_with_errors form.zipcode %}
|
||||||
{% if form.city.value is not None %}
|
{% endwith %}
|
||||||
{% include "includes/input_read_only.html" with field=form.city %}
|
<button type="submit" class="usa-button">
|
||||||
{% endif %}
|
Save
|
||||||
{% if form.state_territory.value is not None %}
|
</button>
|
||||||
{% include "includes/input_read_only.html" with field=form.state_territory %}
|
</form>
|
||||||
{% endif %}
|
{% else %}
|
||||||
{% if form.zipcode.value is not None %}
|
<div class="margin-top-2">
|
||||||
{% include "includes/input_read_only.html" with field=form.zipcode %}
|
{% include "includes/organization_address.html" with organization=portfolio %}
|
||||||
{% endif %}
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -309,7 +309,7 @@ class TestPortfolio(WebTest):
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_portfolio_organization_info_page_edit_access(self):
|
def test_portfolio_organization_info_page_edit_access(self):
|
||||||
"""Test that user with a portfolio can access the portfolio organization page, read only"""
|
"""Test that user with a portfolio can access the portfolio organization page, edit access"""
|
||||||
self.app.set_user(self.user.username)
|
self.app.set_user(self.user.username)
|
||||||
portfolio_permission, _ = UserPortfolioPermission.objects.get_or_create(
|
portfolio_permission, _ = UserPortfolioPermission.objects.get_or_create(
|
||||||
user=self.user,
|
user=self.user,
|
||||||
|
@ -327,13 +327,36 @@ class TestPortfolio(WebTest):
|
||||||
response = self.app.get(reverse("organization-info"))
|
response = self.app.get(reverse("organization-info"))
|
||||||
# Assert the response is a 200
|
# Assert the response is a 200
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
# The label for Federal agency will always be a h4
|
self.assertContains(response, "<h2>Organization admins</h2>")
|
||||||
self.assertContains(response, '<h4 class="margin-bottom-05">Organization name</h4>')
|
self.assertContains(response, "<h2>Organization name and address</h2>")
|
||||||
# The read only label for city will be a h4
|
self.assertContains(
|
||||||
self.assertNotContains(response, '<h4 class="margin-bottom-05">City</h4>')
|
response, '<p class="margin-bottom-05 text-primary-darker text-bold">Organization name</p>'
|
||||||
self.assertNotContains(response, '<p class="margin-top-0">Los Angeles</p>')
|
)
|
||||||
|
self.assertNotContains(response, "<address>")
|
||||||
self.assertContains(response, 'for="id_city"')
|
self.assertContains(response, 'for="id_city"')
|
||||||
|
|
||||||
|
@less_console_noise_decorator
|
||||||
|
def test_portfolio_organization_detail_pages_shows_read_only(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,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.portfolio.organization_name = "Hotel California"
|
||||||
|
self.portfolio.save()
|
||||||
|
|
||||||
|
with override_flag("organization_feature", active=True):
|
||||||
|
org_info_response = self.app.get(reverse("organization-info"))
|
||||||
|
# We don't use the label "Organization name" in the view-only view
|
||||||
|
self.assertNotContains(
|
||||||
|
org_info_response, '<p class="margin-bottom-05 text-primary-darker text-bold">Organization name</p>'
|
||||||
|
)
|
||||||
|
self.assertContains(org_info_response, "<address>")
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_portfolio_organization_detail_pages_include_breadcrumb(self):
|
def test_portfolio_organization_detail_pages_include_breadcrumb(self):
|
||||||
"""Test that breadcrumb menus display on portfolio detail pages"""
|
"""Test that breadcrumb menus display on portfolio detail pages"""
|
||||||
|
@ -491,8 +514,7 @@ class TestPortfolio(WebTest):
|
||||||
self.portfolio.save()
|
self.portfolio.save()
|
||||||
page = self.app.get(reverse("organization-info"))
|
page = self.app.get(reverse("organization-info"))
|
||||||
# Org name in Sidenav, main nav, webpage title, and breadcrumb
|
# Org name in Sidenav, main nav, webpage title, and breadcrumb
|
||||||
self.assertContains(page, "Hotel California", count=4)
|
self.assertContains(page, "Hotel California", count=5)
|
||||||
self.assertContains(page, "Non-Federal Agency")
|
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_org_form_invalid_update(self):
|
def test_org_form_invalid_update(self):
|
||||||
|
|
|
@ -935,6 +935,7 @@ class PortfolioOrganizationInfoView(DetailView, FormMixin):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
portfolio = self.request.session.get("portfolio")
|
portfolio = self.request.session.get("portfolio")
|
||||||
context["has_edit_portfolio_permission"] = self.request.user.has_edit_portfolio_permission(portfolio)
|
context["has_edit_portfolio_permission"] = self.request.user.has_edit_portfolio_permission(portfolio)
|
||||||
|
context["portfolio_admins"] = portfolio.portfolio_admin_users
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def get_object(self, queryset=None):
|
def get_object(self, queryset=None):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue