Address PR comments

This commit is contained in:
igorkorenfeld 2022-11-16 12:18:02 -05:00
parent 5a3fa018ae
commit 1d6ee255e9
No known key found for this signature in database
GPG key ID: 826947A4B867F659
8 changed files with 69 additions and 59 deletions

View file

@ -4,19 +4,19 @@
"http://app:8080/health/", "http://app:8080/health/",
"http://app:8080/whoami/", "http://app:8080/whoami/",
"http://app:8080/register/", "http://app:8080/register/",
"http://app:8080/register/organization.html", "http://app:8080/register/organization/",
"http://app:8080/register/org_federal.html", "http://app:8080/register/org_federal/",
"http://app:8080/register/org_election.html", "http://app:8080/register/org_election/",
"http://app:8080/register/org_contact.html", "http://app:8080/register/org_contact/",
"http://app:8080/register/authorizing_official.html", "http://app:8080/register/authorizing_official/",
"http://app:8080/register/current_sites.html", "http://app:8080/register/current_sites/",
"http://app:8080/register/dotgov_domain.html", "http://app:8080/register/dotgov_domain/",
"http://app:8080/register/purpose.html", "http://app:8080/register/purpose/",
"http://app:8080/register/your_contact.html", "http://app:8080/register/your_contact/",
"http://app:8080/register/other_contacts.html", "http://app:8080/register/other_contacts/",
"http://app:8080/register/security_email.html", "http://app:8080/register/security_email/",
"http://app:8080/register/anything_else.html", "http://app:8080/register/anything_else/",
"http://app:8080/register/requirements.html", "http://app:8080/register/requirements/",
"http://app:8080/register/review.html" "http://app:8080/register/review/"
] ]
} }

View file

@ -119,6 +119,9 @@ MIDDLEWARE = [
"django.middleware.clickjacking.XFrameOptionsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware",
# django-csp: enable use of Content-Security-Policy header # django-csp: enable use of Content-Security-Policy header
"csp.middleware.CSPMiddleware", "csp.middleware.CSPMiddleware",
# DELETE ME before finishing, no login
# "registrar.tests.common.MockUserLogin"
] ]
# application object used by Djangos built-in servers (e.g. `runserver`) # application object used by Djangos built-in servers (e.g. `runserver`)

View file

@ -7,6 +7,7 @@ from django import forms
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from formtools.wizard.views import NamedUrlSessionWizardView # type: ignore from formtools.wizard.views import NamedUrlSessionWizardView # type: ignore
from registrar.models import DomainApplication
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -19,7 +20,7 @@ class RegistrarForm(forms.Form):
super(RegistrarForm, self).__init__(*args, **kwargs) super(RegistrarForm, self).__init__(*args, **kwargs)
class OrganizationForm(RegistrarForm): class OrganizationTypeForm(RegistrarForm):
organization_type = forms.ChoiceField( organization_type = forms.ChoiceField(
required=True, required=True,
choices=[ choices=[
@ -51,11 +52,7 @@ class OrganizationForm(RegistrarForm):
) )
federal_type = forms.ChoiceField( federal_type = forms.ChoiceField(
required=False, required=False,
choices=[ choices=DomainApplication.BRANCH_CHOICES,
("Executive", "Executive"),
("Judicial", "Judicial"),
("Legislative", "Legislative"),
],
widget=forms.RadioSelect, widget=forms.RadioSelect,
) )
is_election_board = forms.ChoiceField( is_election_board = forms.ChoiceField(
@ -71,27 +68,23 @@ class OrganizationForm(RegistrarForm):
class OrganizationFederalForm(RegistrarForm): class OrganizationFederalForm(RegistrarForm):
federal_type = forms.ChoiceField( federal_type = forms.ChoiceField(
required=False, required=False,
choices=[ choices=DomainApplication.BRANCH_CHOICES,
("Executive", "Executive"),
("Judicial", "Judicial"),
("Legislative", "Legislative"),
],
widget=forms.RadioSelect, widget=forms.RadioSelect,
) )
class OrganizationElectionForm(RegistrarForm): class OrganizationElectionForm(RegistrarForm):
is_election_board = forms.ChoiceField( is_election_board = forms.BooleanField(
required=False, widget=forms.RadioSelect(
choices=[ choices=[
("Yes", "Yes"), (True, "Yes"),
("No", "No"), (False, "No"),
], ],
widget=forms.RadioSelect(), )
) )
class OrgContactForm(RegistrarForm): class OrganizationContactForm(RegistrarForm):
organization_name = forms.CharField(label="Organization Name") organization_name = forms.CharField(label="Organization Name")
address_line1 = forms.CharField(label="Address line 1") address_line1 = forms.CharField(label="Address line 1")
address_line2 = forms.CharField( address_line2 = forms.CharField(
@ -163,12 +156,12 @@ class OrgContactForm(RegistrarForm):
class AuthorizingOfficialForm(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( middle_name = forms.CharField(
required=False, required=False,
label="Middle name (optional)", 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") title = forms.CharField(label="Title or role in your organization")
email = forms.EmailField(label="Email") email = forms.EmailField(label="Email")
phone = forms.CharField(label="Phone") phone = forms.CharField(label="Phone")
@ -196,24 +189,24 @@ class PurposeForm(RegistrarForm):
class YourContactForm(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( middle_name = forms.CharField(
required=False, required=False,
label="Middle name (optional)", 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") title = forms.CharField(label="Title or role in your organization")
email = forms.EmailField(label="Email") email = forms.EmailField(label="Email")
phone = forms.CharField(label="Phone") phone = forms.CharField(label="Phone")
class OtherContactsForm(RegistrarForm): 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( middle_name = forms.CharField(
required=False, required=False,
label="Middle name (optional)", 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") title = forms.CharField(label="Title or role in your organization")
email = forms.EmailField(label="Email") email = forms.EmailField(label="Email")
phone = forms.CharField(label="Phone") 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): class ReviewForm(RegistrarForm):
pass 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 # List of forms in our wizard. Each entry is a tuple of a name and a form
# subclass # subclass
FORMS = [ FORMS = [
("organization", OrganizationForm), ("organization_type", OrganizationTypeForm),
("organization_federal", OrganizationFederalForm), ("organization_federal", OrganizationFederalForm),
("organization_election", OrganizationElectionForm), ("organization_election", OrganizationElectionForm),
("org_contact", OrgContactForm), ("organization_contact", OrganizationContactForm),
("authorizing_official", AuthorizingOfficialForm), ("authorizing_official", AuthorizingOfficialForm),
("current_sites", CurrentSitesForm), ("current_sites", CurrentSitesForm),
("dotgov_domain", DotGovDomainForm), ("dotgov_domain", DotGovDomainForm),
@ -264,10 +259,10 @@ FORMS = [
# Dict to match up the right template with the right step. Keys here must # Dict to match up the right template with the right step. Keys here must
# match the first elements of the tuples in FORMS # match the first elements of the tuples in FORMS
TEMPLATES = { TEMPLATES = {
"organization": "application_organization.html", "organization_type": "application_org_type.html",
"organization_federal": "application_org_federal.html", "organization_federal": "application_org_federal.html",
"organization_election": "application_org_election.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", "authorizing_official": "application_authorizing_official.html",
"current_sites": "application_current_sites.html", "current_sites": "application_current_sites.html",
"dotgov_domain": "application_dotgov_domain.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 # We need to pass our page titles as context to the templates, indexed
# by the step names # by the step names
TITLES = { TITLES = {
"organization": "Type of organization", "organization_type": "Type of organization",
"organization_federal": "Type of organization — Federal", "organization_federal": "Type of organization — Federal",
"organization_election": "Type of organization — Election board", "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", "authorizing_official": "Authorizing official",
"current_sites": "Organization website", "current_sites": "Organization website",
"dotgov_domain": ".gov domain", "dotgov_domain": ".gov domain",

View file

@ -28,14 +28,14 @@
<legend class="usa-sr-only"> <legend class="usa-sr-only">
Who is the authorizing official for your organization Who is the authorizing official for your organization
</legend> </legend>
{{ wizard.form.given_name|add_label_class:"usa-label" }} {{ wizard.form.first_name|add_label_class:"usa-label" }}
{{ wizard.form.given_name|add_class:"usa-input"}} {{ wizard.form.first_name|add_class:"usa-input"}}
{{ wizard.form.middle_name|add_label_class:"usa-label" }} {{ wizard.form.middle_name|add_label_class:"usa-label" }}
{{ wizard.form.middle_name|add_class:"usa-input"}} {{ wizard.form.middle_name|add_class:"usa-input"}}
{{ wizard.form.family_name|add_label_class:"usa-label" }} {{ wizard.form.last_name|add_label_class:"usa-label" }}
{{ wizard.form.family_name|add_class:"usa-input"}} {{ wizard.form.last_name|add_class:"usa-input"}}
{{ wizard.form.title|add_label_class:"usa-label" }} {{ wizard.form.title|add_label_class:"usa-label" }}
{{ wizard.form.title|add_class:"usa-input"}} {{ wizard.form.title|add_class:"usa-input"}}

View file

@ -13,8 +13,20 @@
<h2>Is your organization an election office?</h2> <h2>Is your organization an election office?</h2>
</legend> </legend>
{% radio_buttons_by_value wizard.form.is_election_board as choices %} {% radio_buttons_by_value wizard.form.is_election_board as choices %}
{% include "includes/radio_button.html" with choice=choices.Yes%} <!-- {{ choices.True.data.value }} -->
{% include "includes/radio_button.html" with choice=choices.No%} <!-- {{ choices.False.data.value }} -->
<!-- {{ choices|get_item:True }} -->
<!-- {{ choices|get_item:False }} -->
<!-- {% for radio in wizard.form.is_election_board %} -->
<!-- <div class="usa-radio"> -->
<!-- {{radio.tag}} -->
<!-- <label for="{{radio.id_for_label}}" class="usa-radio__label"> -->
<!-- {{ radio.choice_label }} -->
<!-- </label> -->
<!-- </div> -->
<!-- {% endfor %} -->
{% include "includes/radio_button.html" with choice=choices|get_item:True %}
{% include "includes/radio_button.html" with choice=choices|get_item:False %}
</fieldset> </fieldset>
{{ block.super }} {{ block.super }}

View file

@ -16,14 +16,14 @@
<legend> <legend>
<h2> Contact 2 </h2> <h2> Contact 2 </h2>
</legend> </legend>
{{ wizard.form.given_name|add_label_class:"usa-label" }} {{ wizard.form.first_name|add_label_class:"usa-label" }}
{{ wizard.form.given_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {{ 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_label_class:"usa-label" }}
{{ wizard.form.middle_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {{ wizard.form.middle_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }}
{{ wizard.form.family_name|add_label_class:"usa-label" }} {{ wizard.form.last_name|add_label_class:"usa-label" }}
{{ wizard.form.family_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {{ wizard.form.last_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }}
{{ wizard.form.title|add_label_class:"usa-label" }} {{ wizard.form.title|add_label_class:"usa-label" }}
{{ wizard.form.title|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {{ wizard.form.title|add_class:"usa-input"|attr:"aria-describedby:instructions" }}

View file

@ -23,14 +23,14 @@
<legend class="usa-sr-only"> <legend class="usa-sr-only">
Your contact information Your contact information
</legend> </legend>
{{ wizard.form.given_name|add_label_class:"usa-label" }} {{ wizard.form.first_name|add_label_class:"usa-label" }}
{{ wizard.form.given_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {{ 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_label_class:"usa-label" }}
{{ wizard.form.middle_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {{ wizard.form.middle_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }}
{{ wizard.form.family_name|add_label_class:"usa-label" }} {{ wizard.form.last_name|add_label_class:"usa-label" }}
{{ wizard.form.family_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {{ wizard.form.last_name|add_class:"usa-input"|attr:"aria-describedby:instructions" }}
{{ wizard.form.title|add_label_class:"usa-label" }} {{ wizard.form.title|add_label_class:"usa-label" }}
{{ wizard.form.title|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {{ wizard.form.title|add_class:"usa-input"|attr:"aria-describedby:instructions" }}