mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-11 23:14:49 +02:00
Place no other contacts reason box on own page
This commit is contained in:
parent
dd44d405fa
commit
ab34629a7b
8 changed files with 58 additions and 11 deletions
|
@ -35,6 +35,7 @@ for step, view in [
|
||||||
(Step.PURPOSE, views.Purpose),
|
(Step.PURPOSE, views.Purpose),
|
||||||
(Step.YOUR_CONTACT, views.YourContact),
|
(Step.YOUR_CONTACT, views.YourContact),
|
||||||
(Step.OTHER_CONTACTS, views.OtherContacts),
|
(Step.OTHER_CONTACTS, views.OtherContacts),
|
||||||
|
(Step.NO_OTHER_CONTACTS, views.NoOtherContacts),
|
||||||
(Step.SECURITY_EMAIL, views.SecurityEmail),
|
(Step.SECURITY_EMAIL, views.SecurityEmail),
|
||||||
(Step.ANYTHING_ELSE, views.AnythingElse),
|
(Step.ANYTHING_ELSE, views.AnythingElse),
|
||||||
(Step.REQUIREMENTS, views.Requirements),
|
(Step.REQUIREMENTS, views.Requirements),
|
||||||
|
|
|
@ -662,7 +662,7 @@ OtherContactsFormSet = forms.formset_factory(
|
||||||
|
|
||||||
class NoOtherContactsForm(RegistrarForm):
|
class NoOtherContactsForm(RegistrarForm):
|
||||||
no_other_contacts_rationale = forms.CharField(
|
no_other_contacts_rationale = forms.CharField(
|
||||||
required=False,
|
required=True,
|
||||||
# label has to end in a space to get the label_suffix to show
|
# label has to end in a space to get the label_suffix to show
|
||||||
label=(
|
label=(
|
||||||
"If you can’t provide other contacts for your organization,"
|
"If you can’t provide other contacts for your organization,"
|
||||||
|
|
|
@ -545,6 +545,10 @@ class DomainApplication(TimeStampedModel):
|
||||||
DomainApplication.OrganizationChoices.INTERSTATE,
|
DomainApplication.OrganizationChoices.INTERSTATE,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def show_no_other_contacts_rationale(self) -> bool:
|
||||||
|
"""Show this step if the other contacts are blank."""
|
||||||
|
return not self.other_contacts.exists()
|
||||||
|
|
||||||
def is_federal(self) -> Union[bool, None]:
|
def is_federal(self) -> Union[bool, None]:
|
||||||
"""Is this application for a federal agency?
|
"""Is this application for a federal agency?
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{% extends 'application_form.html' %}
|
||||||
|
{% load static field_helpers %}
|
||||||
|
|
||||||
|
{% block form_fields %}
|
||||||
|
{% input_with_errors forms.0.no_other_contacts_rationale %}
|
||||||
|
{% endblock %}
|
|
@ -39,8 +39,4 @@
|
||||||
<use xlink:href="{%static 'img/sprite.svg'%}#add_circle"></use>
|
<use xlink:href="{%static 'img/sprite.svg'%}#add_circle"></use>
|
||||||
</svg><span class="margin-left-05">Add another contact</span>
|
</svg><span class="margin-left-05">Add another contact</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<h2>No contacts</h2>
|
|
||||||
|
|
||||||
{% input_with_errors forms.1.no_other_contacts_rationale %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -36,7 +36,9 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if step == Step.AUTHORIZING_OFFICIAL %}
|
{% if step == Step.AUTHORIZING_OFFICIAL %}
|
||||||
{% if application.authorizing_official %}
|
{% if application.authorizing_official %}
|
||||||
{% include "includes/contact.html" with contact=application.authorizing_official %}
|
<div class="margin-bottom-105">
|
||||||
|
{% include "includes/contact.html" with contact=application.authorizing_official %}
|
||||||
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
Incomplete
|
Incomplete
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -51,8 +53,10 @@
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if step == Step.DOTGOV_DOMAIN %}
|
{% if step == Step.DOTGOV_DOMAIN %}
|
||||||
<ul class="add-list-reset">
|
<ul class="add-list-reset margin-bottom-105">
|
||||||
<li>{{ application.requested_domain.name|default:"Incomplete" }}</li>
|
<li>{{ application.requested_domain.name|default:"Incomplete" }}</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="add-list-reset">
|
||||||
{% for site in application.alternative_domains.all %}
|
{% for site in application.alternative_domains.all %}
|
||||||
<li>{{ site.website }}</li>
|
<li>{{ site.website }}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -63,18 +67,25 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if step == Step.YOUR_CONTACT %}
|
{% if step == Step.YOUR_CONTACT %}
|
||||||
{% if application.submitter %}
|
{% if application.submitter %}
|
||||||
{% include "includes/contact.html" with contact=application.submitter %}
|
<div class="margin-bottom-105">
|
||||||
|
{% include "includes/contact.html" with contact=application.submitter %}
|
||||||
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
Incomplete
|
Incomplete
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if step == Step.OTHER_CONTACTS %}
|
{% if step == Step.OTHER_CONTACTS %}
|
||||||
{% for other in application.other_contacts.all %}
|
{% for other in application.other_contacts.all %}
|
||||||
|
<div class="margin-bottom-105">
|
||||||
{% include "includes/contact.html" with contact=other %}
|
{% include "includes/contact.html" with contact=other %}
|
||||||
|
</div>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
None
|
None
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if step == Step.NO_OTHER_CONTACTS %}
|
||||||
|
{{ application.no_other_contacts_rationale|default:"Incomplete" }}
|
||||||
|
{% endif %}
|
||||||
{% if step == Step.SECURITY_EMAIL %}
|
{% if step == Step.SECURITY_EMAIL %}
|
||||||
{{ application.security_email|default:"None" }}
|
{{ application.security_email|default:"None" }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -82,7 +93,7 @@
|
||||||
{{ application.anything_else|default:"No" }}
|
{{ application.anything_else|default:"No" }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if step == Step.REQUIREMENTS %}
|
{% if step == Step.REQUIREMENTS %}
|
||||||
{{ application.is_policy_acknowledged|yesno:"Agree,Do not agree,Do not agree" }}
|
{{ application.is_policy_acknowledged|yesno:"I agree.,I do not agree.,I do not agree." }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -124,7 +124,8 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
this test work.
|
this test work.
|
||||||
"""
|
"""
|
||||||
num_pages_tested = 0
|
num_pages_tested = 0
|
||||||
SKIPPED_PAGES = 3 # elections, type_of_work, tribal_government
|
# elections, type_of_work, tribal_government, no_other_contacts
|
||||||
|
SKIPPED_PAGES = 4
|
||||||
num_pages = len(self.TITLES) - SKIPPED_PAGES
|
num_pages = len(self.TITLES) - SKIPPED_PAGES
|
||||||
|
|
||||||
type_page = self.app.get(reverse("application:")).follow()
|
type_page = self.app.get(reverse("application:")).follow()
|
||||||
|
@ -724,6 +725,24 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
|
|
||||||
self.assertContains(contact_page, self.TITLES[Step.TYPE_OF_WORK])
|
self.assertContains(contact_page, self.TITLES[Step.TYPE_OF_WORK])
|
||||||
|
|
||||||
|
def test_application_no_other_contacts(self):
|
||||||
|
"""Applicants with no other contacts have to give a reason."""
|
||||||
|
contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||||
|
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||||
|
# resetting the session key on each new request, thus destroying the concept
|
||||||
|
# of a "session". We are going to do it manually, saving the session ID here
|
||||||
|
# and then setting the cookie on each request.
|
||||||
|
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||||
|
|
||||||
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
|
result = contacts_page.form.submit()
|
||||||
|
# follow first redirect
|
||||||
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
|
no_contacts_page = result.follow()
|
||||||
|
expected_url_slug = str(Step.NO_OTHER_CONTACTS)
|
||||||
|
actual_url_slug = no_contacts_page.request.path.split("/")[-2]
|
||||||
|
self.assertEqual(expected_url_slug, actual_url_slug)
|
||||||
|
|
||||||
def test_application_type_of_work_interstate(self):
|
def test_application_type_of_work_interstate(self):
|
||||||
"""Special districts have to answer an additional question."""
|
"""Special districts have to answer an additional question."""
|
||||||
type_page = self.app.get(reverse("application:")).follow()
|
type_page = self.app.get(reverse("application:")).follow()
|
||||||
|
|
|
@ -35,6 +35,7 @@ class Step(StrEnum):
|
||||||
PURPOSE = "purpose"
|
PURPOSE = "purpose"
|
||||||
YOUR_CONTACT = "your_contact"
|
YOUR_CONTACT = "your_contact"
|
||||||
OTHER_CONTACTS = "other_contacts"
|
OTHER_CONTACTS = "other_contacts"
|
||||||
|
NO_OTHER_CONTACTS = "no_other_contacts"
|
||||||
SECURITY_EMAIL = "security_email"
|
SECURITY_EMAIL = "security_email"
|
||||||
ANYTHING_ELSE = "anything_else"
|
ANYTHING_ELSE = "anything_else"
|
||||||
REQUIREMENTS = "requirements"
|
REQUIREMENTS = "requirements"
|
||||||
|
@ -80,6 +81,7 @@ class ApplicationWizard(LoginRequiredMixin, TemplateView):
|
||||||
Step.PURPOSE: _("Purpose of your domain"),
|
Step.PURPOSE: _("Purpose of your domain"),
|
||||||
Step.YOUR_CONTACT: _("Your contact information"),
|
Step.YOUR_CONTACT: _("Your contact information"),
|
||||||
Step.OTHER_CONTACTS: _("Other contacts for your organization"),
|
Step.OTHER_CONTACTS: _("Other contacts for your organization"),
|
||||||
|
Step.NO_OTHER_CONTACTS: _("No other contacts?"),
|
||||||
Step.SECURITY_EMAIL: _("Security email for public use"),
|
Step.SECURITY_EMAIL: _("Security email for public use"),
|
||||||
Step.ANYTHING_ELSE: _("Anything else we should know?"),
|
Step.ANYTHING_ELSE: _("Anything else we should know?"),
|
||||||
Step.REQUIREMENTS: _(
|
Step.REQUIREMENTS: _(
|
||||||
|
@ -99,6 +101,9 @@ class ApplicationWizard(LoginRequiredMixin, TemplateView):
|
||||||
"show_organization_election", False
|
"show_organization_election", False
|
||||||
),
|
),
|
||||||
Step.TYPE_OF_WORK: lambda w: w.from_model("show_type_of_work", False),
|
Step.TYPE_OF_WORK: lambda w: w.from_model("show_type_of_work", False),
|
||||||
|
Step.NO_OTHER_CONTACTS: lambda w: w.from_model(
|
||||||
|
"show_no_other_contacts_rationale", False
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -410,7 +415,12 @@ class YourContact(ApplicationWizard):
|
||||||
|
|
||||||
class OtherContacts(ApplicationWizard):
|
class OtherContacts(ApplicationWizard):
|
||||||
template_name = "application_other_contacts.html"
|
template_name = "application_other_contacts.html"
|
||||||
forms = [forms.OtherContactsFormSet, forms.NoOtherContactsForm]
|
forms = [forms.OtherContactsFormSet]
|
||||||
|
|
||||||
|
|
||||||
|
class NoOtherContacts(ApplicationWizard):
|
||||||
|
template_name = "application_no_other_contacts.html"
|
||||||
|
forms = [forms.NoOtherContactsForm]
|
||||||
|
|
||||||
|
|
||||||
class SecurityEmail(ApplicationWizard):
|
class SecurityEmail(ApplicationWizard):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue