From 1d6ee255e9482b2b6258e5172f9abb094fde8107 Mon Sep 17 00:00:00 2001 From: igorkorenfeld Date: Wed, 16 Nov 2022 12:18:02 -0500 Subject: [PATCH] Address PR comments --- src/.pa11yci | 28 ++++----- src/registrar/config/settings.py | 3 + src/registrar/forms/application_wizard.py | 57 +++++++++---------- .../application_authorizing_official.html | 8 +-- .../templates/application_org_election.html | 16 +++++- ...ization.html => application_org_type.html} | 0 .../templates/application_other_contacts.html | 8 +-- .../templates/application_your_contact.html | 8 +-- 8 files changed, 69 insertions(+), 59 deletions(-) rename src/registrar/templates/{application_organization.html => application_org_type.html} (100%) diff --git a/src/.pa11yci b/src/.pa11yci index cc4e79190..49b33779b 100644 --- a/src/.pa11yci +++ b/src/.pa11yci @@ -4,19 +4,19 @@ "http://app:8080/health/", "http://app:8080/whoami/", "http://app:8080/register/", - "http://app:8080/register/organization.html", - "http://app:8080/register/org_federal.html", - "http://app:8080/register/org_election.html", - "http://app:8080/register/org_contact.html", - "http://app:8080/register/authorizing_official.html", - "http://app:8080/register/current_sites.html", - "http://app:8080/register/dotgov_domain.html", - "http://app:8080/register/purpose.html", - "http://app:8080/register/your_contact.html", - "http://app:8080/register/other_contacts.html", - "http://app:8080/register/security_email.html", - "http://app:8080/register/anything_else.html", - "http://app:8080/register/requirements.html", - "http://app:8080/register/review.html" + "http://app:8080/register/organization/", + "http://app:8080/register/org_federal/", + "http://app:8080/register/org_election/", + "http://app:8080/register/org_contact/", + "http://app:8080/register/authorizing_official/", + "http://app:8080/register/current_sites/", + "http://app:8080/register/dotgov_domain/", + "http://app:8080/register/purpose/", + "http://app:8080/register/your_contact/", + "http://app:8080/register/other_contacts/", + "http://app:8080/register/security_email/", + "http://app:8080/register/anything_else/", + "http://app:8080/register/requirements/", + "http://app:8080/register/review/" ] } diff --git a/src/registrar/config/settings.py b/src/registrar/config/settings.py index eb4eea848..86f96952a 100644 --- a/src/registrar/config/settings.py +++ b/src/registrar/config/settings.py @@ -119,6 +119,9 @@ MIDDLEWARE = [ "django.middleware.clickjacking.XFrameOptionsMiddleware", # django-csp: enable use of Content-Security-Policy header "csp.middleware.CSPMiddleware", + # DELETE ME before finishing, no login + # "registrar.tests.common.MockUserLogin" + ] # application object used by Django’s built-in servers (e.g. `runserver`) diff --git a/src/registrar/forms/application_wizard.py b/src/registrar/forms/application_wizard.py index 16f8666ab..79430e8e5 100644 --- a/src/registrar/forms/application_wizard.py +++ b/src/registrar/forms/application_wizard.py @@ -7,6 +7,7 @@ from django import forms from django.contrib.auth.mixins import LoginRequiredMixin from formtools.wizard.views import NamedUrlSessionWizardView # type: ignore +from registrar.models import DomainApplication logger = logging.getLogger(__name__) @@ -19,7 +20,7 @@ class RegistrarForm(forms.Form): super(RegistrarForm, self).__init__(*args, **kwargs) -class OrganizationForm(RegistrarForm): +class OrganizationTypeForm(RegistrarForm): organization_type = forms.ChoiceField( required=True, choices=[ @@ -51,11 +52,7 @@ class OrganizationForm(RegistrarForm): ) federal_type = forms.ChoiceField( required=False, - choices=[ - ("Executive", "Executive"), - ("Judicial", "Judicial"), - ("Legislative", "Legislative"), - ], + choices=DomainApplication.BRANCH_CHOICES, widget=forms.RadioSelect, ) is_election_board = forms.ChoiceField( @@ -71,27 +68,23 @@ class OrganizationForm(RegistrarForm): class OrganizationFederalForm(RegistrarForm): federal_type = forms.ChoiceField( required=False, - choices=[ - ("Executive", "Executive"), - ("Judicial", "Judicial"), - ("Legislative", "Legislative"), - ], + choices=DomainApplication.BRANCH_CHOICES, widget=forms.RadioSelect, ) class OrganizationElectionForm(RegistrarForm): - is_election_board = forms.ChoiceField( - required=False, - choices=[ - ("Yes", "Yes"), - ("No", "No"), - ], - widget=forms.RadioSelect(), + is_election_board = forms.BooleanField( + widget=forms.RadioSelect( + choices=[ + (True, "Yes"), + (False, "No"), + ], + ) ) -class OrgContactForm(RegistrarForm): +class OrganizationContactForm(RegistrarForm): organization_name = forms.CharField(label="Organization Name") address_line1 = forms.CharField(label="Address line 1") address_line2 = forms.CharField( @@ -163,12 +156,12 @@ class OrgContactForm(RegistrarForm): class AuthorizingOfficialForm(RegistrarForm): - given_name = forms.CharField(label="First name/given name") + first_name = forms.CharField(label="First name/given name") middle_name = forms.CharField( required=False, label="Middle name (optional)", ) - family_name = forms.CharField(label="Last name/family name") + last_name = forms.CharField(label="Last name/family name") title = forms.CharField(label="Title or role in your organization") email = forms.EmailField(label="Email") phone = forms.CharField(label="Phone") @@ -196,24 +189,24 @@ class PurposeForm(RegistrarForm): class YourContactForm(RegistrarForm): - given_name = forms.CharField(label="First name/given name") + first_name = forms.CharField(label="First name/given name") middle_name = forms.CharField( required=False, label="Middle name (optional)", ) - family_name = forms.CharField(label="Last name/family name") + last_name = forms.CharField(label="Last name/family name") title = forms.CharField(label="Title or role in your organization") email = forms.EmailField(label="Email") phone = forms.CharField(label="Phone") class OtherContactsForm(RegistrarForm): - given_name = forms.CharField(label="First name/given name") + first_name = forms.CharField(label="First name/given name") middle_name = forms.CharField( required=False, label="Middle name (optional)", ) - family_name = forms.CharField(label="Last name/family name") + last_name = forms.CharField(label="Last name/family name") title = forms.CharField(label="Title or role in your organization") email = forms.EmailField(label="Email") phone = forms.CharField(label="Phone") @@ -238,6 +231,8 @@ class RequirementsForm(RegistrarForm): ) +# Empty class for the review page which gets included as part of the form, but does not +# have any form fields itself class ReviewForm(RegistrarForm): pass @@ -245,10 +240,10 @@ class ReviewForm(RegistrarForm): # List of forms in our wizard. Each entry is a tuple of a name and a form # subclass FORMS = [ - ("organization", OrganizationForm), + ("organization_type", OrganizationTypeForm), ("organization_federal", OrganizationFederalForm), ("organization_election", OrganizationElectionForm), - ("org_contact", OrgContactForm), + ("organization_contact", OrganizationContactForm), ("authorizing_official", AuthorizingOfficialForm), ("current_sites", CurrentSitesForm), ("dotgov_domain", DotGovDomainForm), @@ -264,10 +259,10 @@ FORMS = [ # Dict to match up the right template with the right step. Keys here must # match the first elements of the tuples in FORMS TEMPLATES = { - "organization": "application_organization.html", + "organization_type": "application_org_type.html", "organization_federal": "application_org_federal.html", "organization_election": "application_org_election.html", - "org_contact": "application_org_contact.html", + "organization_contact": "application_org_contact.html", "authorizing_official": "application_authorizing_official.html", "current_sites": "application_current_sites.html", "dotgov_domain": "application_dotgov_domain.html", @@ -283,10 +278,10 @@ TEMPLATES = { # We need to pass our page titles as context to the templates, indexed # by the step names TITLES = { - "organization": "Type of organization", + "organization_type": "Type of organization", "organization_federal": "Type of organization — Federal", "organization_election": "Type of organization — Election board", - "org_contact": "Organization name and mailing address", + "organization_contact": "Organization name and mailing address", "authorizing_official": "Authorizing official", "current_sites": "Organization website", "dotgov_domain": ".gov domain", diff --git a/src/registrar/templates/application_authorizing_official.html b/src/registrar/templates/application_authorizing_official.html index 711d1bc00..70eb9d617 100644 --- a/src/registrar/templates/application_authorizing_official.html +++ b/src/registrar/templates/application_authorizing_official.html @@ -28,14 +28,14 @@ Who is the authorizing official for your organization - {{ wizard.form.given_name|add_label_class:"usa-label" }} - {{ wizard.form.given_name|add_class:"usa-input"}} + {{ wizard.form.first_name|add_label_class:"usa-label" }} + {{ wizard.form.first_name|add_class:"usa-input"}} {{ wizard.form.middle_name|add_label_class:"usa-label" }} {{ wizard.form.middle_name|add_class:"usa-input"}} - {{ wizard.form.family_name|add_label_class:"usa-label" }} - {{ wizard.form.family_name|add_class:"usa-input"}} + {{ wizard.form.last_name|add_label_class:"usa-label" }} + {{ wizard.form.last_name|add_class:"usa-input"}} {{ wizard.form.title|add_label_class:"usa-label" }} {{ wizard.form.title|add_class:"usa-input"}} diff --git a/src/registrar/templates/application_org_election.html b/src/registrar/templates/application_org_election.html index 6d8d2187b..20401c3b9 100644 --- a/src/registrar/templates/application_org_election.html +++ b/src/registrar/templates/application_org_election.html @@ -13,8 +13,20 @@

Is your organization an election office?

{% radio_buttons_by_value wizard.form.is_election_board as choices %} - {% include "includes/radio_button.html" with choice=choices.Yes%} - {% include "includes/radio_button.html" with choice=choices.No%} + + + + + + + + + + + + + {% include "includes/radio_button.html" with choice=choices|get_item:True %} + {% include "includes/radio_button.html" with choice=choices|get_item:False %} {{ block.super }} diff --git a/src/registrar/templates/application_organization.html b/src/registrar/templates/application_org_type.html similarity index 100% rename from src/registrar/templates/application_organization.html rename to src/registrar/templates/application_org_type.html diff --git a/src/registrar/templates/application_other_contacts.html b/src/registrar/templates/application_other_contacts.html index 74929b92e..d40d4e1fd 100644 --- a/src/registrar/templates/application_other_contacts.html +++ b/src/registrar/templates/application_other_contacts.html @@ -16,14 +16,14 @@

Contact 2

- {{ wizard.form.given_name|add_label_class:"usa-label" }} - {{ wizard.form.given_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} + {{ wizard.form.first_name|add_label_class:"usa-label" }} + {{ wizard.form.first_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {{ wizard.form.middle_name|add_label_class:"usa-label" }} {{ wizard.form.middle_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} - {{ wizard.form.family_name|add_label_class:"usa-label" }} - {{ wizard.form.family_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} + {{ wizard.form.last_name|add_label_class:"usa-label" }} + {{ wizard.form.last_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {{ wizard.form.title|add_label_class:"usa-label" }} {{ wizard.form.title|add_class:"usa-input"|attr:"aria-describedby:instructions" }} diff --git a/src/registrar/templates/application_your_contact.html b/src/registrar/templates/application_your_contact.html index a04af6278..696f9b309 100644 --- a/src/registrar/templates/application_your_contact.html +++ b/src/registrar/templates/application_your_contact.html @@ -23,14 +23,14 @@ Your contact information - {{ wizard.form.given_name|add_label_class:"usa-label" }} - {{ wizard.form.given_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} + {{ wizard.form.first_name|add_label_class:"usa-label" }} + {{ wizard.form.first_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {{ wizard.form.middle_name|add_label_class:"usa-label" }} {{ wizard.form.middle_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} - {{ wizard.form.family_name|add_label_class:"usa-label" }} - {{ wizard.form.family_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} + {{ wizard.form.last_name|add_label_class:"usa-label" }} + {{ wizard.form.last_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {{ wizard.form.title|add_label_class:"usa-label" }} {{ wizard.form.title|add_class:"usa-input"|attr:"aria-describedby:instructions" }}