Merge remote-tracking branch 'origin/main' into nl/1595-auto-run-migrations

This commit is contained in:
CocoByte 2024-01-26 12:40:55 -07:00
commit e7cb563911
No known key found for this signature in database
GPG key ID: BBFAA2526384C97F
9 changed files with 200 additions and 107 deletions

View file

@ -0,0 +1,14 @@
@use "uswds-core" as *;
dt {
color: color('primary-dark');
margin-top: units(2);
font-weight: font-weight('semibold');
// The units mixin can only get us close, so it's between
// hardcoding the value and using in markup
font-size: 16.96px;
}
dd {
margin-left: 0;
}

View file

@ -6,12 +6,14 @@
margin-top: units(-1);
}
//Tighter spacing when H2 is immediatly after H1
// Tighter spacing when h2 is immediatly after h1
.register-form-step .usa-fieldset:first-of-type h2:first-of-type,
.register-form-step h1 + h2 {
margin-top: units(1);
}
// register-form-review-header is used on the summary page and
// should not be styled like the register form headers
.register-form-step h3 {
color: color('primary-dark');
letter-spacing: $letter-space--xs;
@ -23,6 +25,16 @@
}
}
h3.register-form-review-header {
color: color('primary-dark');
margin-top: units(2);
margin-bottom: 0;
font-weight: font-weight('semibold');
// The units mixin can only get us close, so it's between
// hardcoding the value and using in markup
font-size: 16.96px;
}
.register-form-step h4 {
margin-bottom: 0;

View file

@ -10,6 +10,7 @@
--- Custom Styles ---------------------------------*/
@forward "base";
@forward "typography";
@forward "lists";
@forward "buttons";
@forward "forms";
@forward "fieldsets";

View file

@ -57,6 +57,9 @@ class DomainHelper:
# If blank ok is true, just return the domain
return domain
if domain.startswith("www."):
domain = domain[4:]
if domain.endswith(".gov"):
domain = domain[:-4]

View file

@ -20,108 +20,158 @@
{% block form_fields %}
{% for step in steps.all|slice:":-1" %}
<section class="review__step">
<hr />
<div class="review__step__title display-flex flex-justify">
<div class="review__step__value">
<div class="review__step__name">{{ form_titles|get_item:step }}</div>
<div>
{% if step == Step.ORGANIZATION_TYPE %}
{% if application.organization_type is not None %}
{% with long_org_type=application.organization_type|get_organization_long_name %}
{{ long_org_type }}
{% endwith %}
{% else %}
Incomplete
{% endif %}
<section class="summary-item margin-top-3">
{% if step == Step.ORGANIZATION_TYPE %}
{% namespaced_url 'application' step as application_url %}
{% if application.organization_type is not None %}
{% with title=form_titles|get_item:step value=application.organization_type|get_organization_long_name|default:"Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% else %}
{% with title=form_titles|get_item:step value="Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %}
{% if step == Step.TRIBAL_GOVERNMENT %}
{{ application.tribe_name|default:"Incomplete" }}
{% if application.federally_recognized_tribe %}<p>Federally-recognized tribe</p>{% endif %}
{% if application.state_recognized_tribe %}<p>State-recognized tribe</p>{% endif %}
{% endif %}
{% if step == Step.TRIBAL_GOVERNMENT %}
{% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.tribe_name|default:"Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% if application.federally_recognized_tribe %}<p>Federally-recognized tribe</p>{% endif %}
{% if application.state_recognized_tribe %}<p>State-recognized tribe</p>{% endif %}
{% endif %}
{% if step == Step.ORGANIZATION_FEDERAL %}
{% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.get_federal_type_display|default:"Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %}
{% if step == Step.ORGANIZATION_ELECTION %}
{% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.is_election_board|yesno:"Yes,No,Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %}
{% if step == Step.ORGANIZATION_CONTACT %}
{% namespaced_url 'application' step as application_url %}
{% if application.organization_name %}
{% with title=form_titles|get_item:step value=application %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url address='true' %}
{% endwith %}
{% else %}
{% with title=form_titles|get_item:step value='Incomplete' %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %}
{% if step == Step.ORGANIZATION_FEDERAL %}
{{ application.get_federal_type_display|default:"Incomplete" }}
{% endif %}
{% if step == Step.ABOUT_YOUR_ORGANIZATION %}
{% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.about_your_organization|default:"Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %}
{% if step == Step.AUTHORIZING_OFFICIAL %}
{% namespaced_url 'application' step as application_url %}
{% if application.authorizing_official is not None %}
{% with title=form_titles|get_item:step value=application.authorizing_official %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url contact='true' %}
{% endwith %}
{% else %}
{% with title=form_titles|get_item:step value="Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %}
{% if step == Step.ORGANIZATION_ELECTION %}
{{ application.is_election_board|yesno:"Yes,No,Incomplete" }}
{% endif %}
{% if step == Step.CURRENT_SITES %}
{% namespaced_url 'application' step as application_url %}
{% if application.current_websites.all %}
{% with title=form_titles|get_item:step value=application.current_websites.all %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url list='true' %}
{% endwith %}
{% else %}
{% with title=form_titles|get_item:step value='None' %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %}
{% if step == Step.ORGANIZATION_CONTACT %}
{% if application.organization_name %}
{% include "includes/organization_address.html" with organization=application %}
{% else %}
Incomplete
{% endif %}
{% endif %}
{% if step == Step.ABOUT_YOUR_ORGANIZATION %}
<p>{{ application.about_your_organization|default:"Incomplete" }}</p>
{% endif %}
{% if step == Step.AUTHORIZING_OFFICIAL %}
{% if application.authorizing_official %}
<div class="margin-bottom-105">
{% include "includes/contact.html" with contact=application.authorizing_official %}
</div>
{% else %}
Incomplete
{% endif %}
{% endif %}
{% if step == Step.CURRENT_SITES %}
<ul class="add-list-reset">
{% for site in application.current_websites.all %}
<li>{{ site.website }}</li>
{% empty %}
<li>None</li>
{% endfor %}
</ul>
{% endif %}
{% if step == Step.DOTGOV_DOMAIN %}
<ul class="add-list-reset margin-bottom-105">
<li>{{ application.requested_domain.name|default:"Incomplete" }}</li>
</ul>
<ul class="add-list-reset">
{% endif %}
{% if step == Step.DOTGOV_DOMAIN %}
{% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.requested_domain.name|default:"Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% if application.alternative_domains.all %}
<h3 class="register-form-review-header">Alternative domains</h3>
<ul class="usa-list usa-list--unstyled margin-top-0">
{% for site in application.alternative_domains.all %}
<li>{{ site.website }}</li>
{% endfor %}
</ul>
{% endif %}
{% if step == Step.PURPOSE %}
{{ application.purpose|default:"Incomplete" }}
{% endif %}
{% if step == Step.PURPOSE %}
{% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.purpose|default:"Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %}
{% if step == Step.YOUR_CONTACT %}
{% namespaced_url 'application' step as application_url %}
{% if application.submitter is not None %}
{% with title=form_titles|get_item:step value=application.submitter %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url contact='true' %}
{% endwith %}
{% else %}
{% with title=form_titles|get_item:step value="Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %}
{% if step == Step.YOUR_CONTACT %}
{% if application.submitter %}
<div class="margin-bottom-105">
{% include "includes/contact.html" with contact=application.submitter %}
</div>
{% else %}
Incomplete
{% endif %}
{% endif %}
{% if step == Step.OTHER_CONTACTS %}
{% namespaced_url 'application' step as application_url %}
{% if application.other_contacts.all %}
{% with title=form_titles|get_item:step value=application.other_contacts.all %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url contact='true' list='true' %}
{% endwith %}
{% else %}
{% with title=form_titles|get_item:step value=application.no_other_contacts_rationale|default:"Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %}
{% if step == Step.OTHER_CONTACTS %}
{% for other in application.other_contacts.all %}
<div class="margin-bottom-105">
<p class="text-semibold margin-top-1 margin-bottom-0">Contact {{ forloop.counter }}</p>
{% include "includes/contact.html" with contact=other %}
</div>
{% empty %}
<div class="margin-bottom-105">
<p class="text-semibold margin-top-1 margin-bottom-0">No other employees from your organization?</p>
{{ application.no_other_contacts_rationale|default:"Incomplete" }}
</div>
{% endfor %}
{% endif %}
{% if step == Step.ANYTHING_ELSE %}
{{ application.anything_else|default:"No" }}
{% endif %}
{% if step == Step.REQUIREMENTS %}
{{ application.is_policy_acknowledged|yesno:"I agree.,I do not agree.,I do not agree." }}
{% endif %}
</div>
</div>
<a
aria-describedby="review_step_title__{{step}}"
href="{% namespaced_url 'application' step %}"
>Edit<span class="sr-only"> {{ form_titles|get_item:step }}</span></a>
</div>
{% endif %}
{% if step == Step.ANYTHING_ELSE %}
{% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.anything_else|default:"No" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %}
{% if step == Step.REQUIREMENTS %}
{% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.is_policy_acknowledged|yesno:"I agree.,I do not agree.,I do not agree." %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %}
</section>
{% endfor %}
{% endblock %}

View file

@ -22,8 +22,10 @@ Current websites: {% for site in application.current_websites.all %}
{% endfor %}{% endif %}
.gov domain:
{{ application.requested_domain.name }}
{% if application.alternative_domains.all %}
Alternative domains:
{% for site in application.alternative_domains.all %}{% spaceless %}{{ site.website }}{% endspaceless %}
{% endfor %}
{% endfor %}{% endif %}
Purpose of your domain:
{{ application.purpose }}

View file

@ -28,17 +28,22 @@
{% if value|length == 1 %}
{% include "includes/contact.html" with contact=value|first %}
{% else %}
<ul class="usa-list usa-list--unstyled margin-top-0">
{% for item in value %}
<li>
<p class="text-semibold margin-top-1 margin-bottom-0">
Contact {{forloop.counter}}
</p>
{% include "includes/contact.html" with contact=item %}</li>
{% empty %}
<li>None</li>
{% endfor %}
</ul>
{% if value %}
<dl class="usa-list usa-list--unstyled margin-top-0">
{% for item in value %}
<dt>
Contact {{forloop.counter}}
</dt>
<dd>
{% include "includes/contact.html" with contact=item %}
</dd>
{% endfor %}
</dl>
{% else %}
<p>
None
</p>
{% endif %}
{% endif %}
{% else %}
{% include "includes/contact.html" with contact=value %}
@ -57,10 +62,10 @@
{% endspaceless %})
{% endif %}
{% else %}
<p class="margin-top-0">{{ value | first }} </p>
<p class="margin-top-0 margin-bottom-0">{{ value | first }} </p>
{% endif %}
{% else %}
<ul class="usa-list margin-top-0">
<ul class="usa-list usa-list--unstyled margin-top-0">
{% for item in value %}
{% if users %}
<li>{{ item.user.email }}</li>

View file

@ -117,7 +117,7 @@ class TestEmails(TestCase):
body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"]
self.assertIn("city1.gov", body)
# spacing should be right between adjacent elements
self.assertRegex(body, r"city.gov\ncity1.gov\n\nPurpose of your domain:")
self.assertRegex(body, r"city.gov\n\nAlternative domains:\ncity1.gov\n\nPurpose of your domain:")
@boto3_mocking.patching
def test_submission_confirmation_no_alternative_govdomain_spacing(self):

View file

@ -64,6 +64,12 @@ class TestFormValidation(MockEppLib):
form = DotGovDomainForm(data={"requested_domain": "top-level-agency"})
self.assertEqual(len(form.errors), 0)
def test_requested_domain_starting_www(self):
"""Test a valid domain name with .www at the beginning."""
form = DotGovDomainForm(data={"requested_domain": "www.top-level-agency"})
self.assertEqual(len(form.errors), 0)
self.assertEqual(form.cleaned_data["requested_domain"], "top-level-agency")
def test_requested_domain_ending_dotgov(self):
"""Just a valid domain name with .gov at the end."""
form = DotGovDomainForm(data={"requested_domain": "top-level-agency.gov"})