mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 11:16:07 +02:00
cleanup
This commit is contained in:
parent
bc8789bc1b
commit
ee71ba4c48
4 changed files with 13 additions and 194 deletions
|
@ -22,8 +22,7 @@ var SUCCESS = "success";
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const hideElement = (element) => {
|
const hideElement = (element) => {
|
||||||
if (element && !element.classList.contains("display-none"))
|
element.classList.add('display-none');
|
||||||
element.classList.add('display-none');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,8 +30,7 @@ const hideElement = (element) => {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const showElement = (element) => {
|
const showElement = (element) => {
|
||||||
if (element && element.classList.contains("display-none"))
|
element.classList.remove('display-none');
|
||||||
element.classList.remove('display-none');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,21 +27,21 @@ class RequestingEntityForm(RegistrarForm):
|
||||||
All of these fields are not required by default, but as we use javascript to conditionally show
|
All of these fields are not required by default, but as we use javascript to conditionally show
|
||||||
and hide some of these, they then become required in certain circumstances."""
|
and hide some of these, they then become required in certain circumstances."""
|
||||||
|
|
||||||
# Add a hidden field to store if the user is requesting a new suborganization
|
# Add a hidden field to store if the user is requesting a new suborganization.
|
||||||
|
# This hidden boolean is used for our javascript to communicate to us and to it.
|
||||||
|
# If true, the suborganization form will auto select a js value "Other".
|
||||||
|
# If this selection is made on the form (tracked by js), then it will toggle the form value of this.
|
||||||
|
# In other words, this essentially tracks if the suborganization field == "Other".
|
||||||
|
# "Other" is just an imaginary value that is otherwise invalid.
|
||||||
|
# Note the logic in `def clean` and line 2744 in get-gov.js
|
||||||
is_requesting_new_suborganization = forms.BooleanField(required=False, widget=forms.HiddenInput())
|
is_requesting_new_suborganization = forms.BooleanField(required=False, widget=forms.HiddenInput())
|
||||||
|
|
||||||
sub_organization = forms.ModelChoiceField(
|
sub_organization = forms.ModelChoiceField(
|
||||||
label="Suborganization name",
|
label="Suborganization name",
|
||||||
# not required because this field won't be filled out unless
|
|
||||||
# it is a federal agency. Use clean to check programatically
|
|
||||||
# if it has been filled in when required.
|
|
||||||
required=False,
|
required=False,
|
||||||
queryset=Suborganization.objects.none(),
|
queryset=Suborganization.objects.none(),
|
||||||
empty_label="--Select--",
|
empty_label="--Select--",
|
||||||
)
|
)
|
||||||
|
|
||||||
# We are using the current sub_organization naming convention here.
|
|
||||||
# We may want to refactor this to suborganization eventually.
|
|
||||||
requested_suborganization = forms.CharField(
|
requested_suborganization = forms.CharField(
|
||||||
label="Requested suborganization",
|
label="Requested suborganization",
|
||||||
required=False,
|
required=False,
|
||||||
|
@ -147,7 +147,10 @@ class RequestingEntityYesNoForm(BaseYesNoForm):
|
||||||
@property
|
@property
|
||||||
def form_is_checked(self):
|
def form_is_checked(self):
|
||||||
"""
|
"""
|
||||||
Determines the initial checked state of the form based on the domain_request's attributes.
|
Determines if the requesting entity is a suborganization, or a portfolio.
|
||||||
|
For suborganizations, users have the ability to request a new one if the
|
||||||
|
desired suborg doesn't exist. We expose additional fields that denote this,
|
||||||
|
like `requested_suborganization`. So we also check on those.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.domain_request.requesting_entity_is_suborganization():
|
if self.domain_request.requesting_entity_is_suborganization():
|
||||||
|
|
|
@ -1,180 +0,0 @@
|
||||||
# Generated by Django 4.2.10 on 2024-10-24 16:30
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
(
|
|
||||||
"registrar",
|
|
||||||
"0134_rename_portfolio_additional_permissions_portfolioinvitation_additional_permissions_and_more",
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="domaininformation",
|
|
||||||
name="requested_suborganization",
|
|
||||||
field=models.CharField(blank=True, null=True),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="domaininformation",
|
|
||||||
name="suborganization_city",
|
|
||||||
field=models.CharField(blank=True, null=True),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="domaininformation",
|
|
||||||
name="suborganization_state_territory",
|
|
||||||
field=models.CharField(
|
|
||||||
blank=True,
|
|
||||||
choices=[
|
|
||||||
("AL", "Alabama (AL)"),
|
|
||||||
("AK", "Alaska (AK)"),
|
|
||||||
("AS", "American Samoa (AS)"),
|
|
||||||
("AZ", "Arizona (AZ)"),
|
|
||||||
("AR", "Arkansas (AR)"),
|
|
||||||
("CA", "California (CA)"),
|
|
||||||
("CO", "Colorado (CO)"),
|
|
||||||
("CT", "Connecticut (CT)"),
|
|
||||||
("DE", "Delaware (DE)"),
|
|
||||||
("DC", "District of Columbia (DC)"),
|
|
||||||
("FL", "Florida (FL)"),
|
|
||||||
("GA", "Georgia (GA)"),
|
|
||||||
("GU", "Guam (GU)"),
|
|
||||||
("HI", "Hawaii (HI)"),
|
|
||||||
("ID", "Idaho (ID)"),
|
|
||||||
("IL", "Illinois (IL)"),
|
|
||||||
("IN", "Indiana (IN)"),
|
|
||||||
("IA", "Iowa (IA)"),
|
|
||||||
("KS", "Kansas (KS)"),
|
|
||||||
("KY", "Kentucky (KY)"),
|
|
||||||
("LA", "Louisiana (LA)"),
|
|
||||||
("ME", "Maine (ME)"),
|
|
||||||
("MD", "Maryland (MD)"),
|
|
||||||
("MA", "Massachusetts (MA)"),
|
|
||||||
("MI", "Michigan (MI)"),
|
|
||||||
("MN", "Minnesota (MN)"),
|
|
||||||
("MS", "Mississippi (MS)"),
|
|
||||||
("MO", "Missouri (MO)"),
|
|
||||||
("MT", "Montana (MT)"),
|
|
||||||
("NE", "Nebraska (NE)"),
|
|
||||||
("NV", "Nevada (NV)"),
|
|
||||||
("NH", "New Hampshire (NH)"),
|
|
||||||
("NJ", "New Jersey (NJ)"),
|
|
||||||
("NM", "New Mexico (NM)"),
|
|
||||||
("NY", "New York (NY)"),
|
|
||||||
("NC", "North Carolina (NC)"),
|
|
||||||
("ND", "North Dakota (ND)"),
|
|
||||||
("MP", "Northern Mariana Islands (MP)"),
|
|
||||||
("OH", "Ohio (OH)"),
|
|
||||||
("OK", "Oklahoma (OK)"),
|
|
||||||
("OR", "Oregon (OR)"),
|
|
||||||
("PA", "Pennsylvania (PA)"),
|
|
||||||
("PR", "Puerto Rico (PR)"),
|
|
||||||
("RI", "Rhode Island (RI)"),
|
|
||||||
("SC", "South Carolina (SC)"),
|
|
||||||
("SD", "South Dakota (SD)"),
|
|
||||||
("TN", "Tennessee (TN)"),
|
|
||||||
("TX", "Texas (TX)"),
|
|
||||||
("UM", "United States Minor Outlying Islands (UM)"),
|
|
||||||
("UT", "Utah (UT)"),
|
|
||||||
("VT", "Vermont (VT)"),
|
|
||||||
("VI", "Virgin Islands (VI)"),
|
|
||||||
("VA", "Virginia (VA)"),
|
|
||||||
("WA", "Washington (WA)"),
|
|
||||||
("WV", "West Virginia (WV)"),
|
|
||||||
("WI", "Wisconsin (WI)"),
|
|
||||||
("WY", "Wyoming (WY)"),
|
|
||||||
("AA", "Armed Forces Americas (AA)"),
|
|
||||||
("AE", "Armed Forces Africa, Canada, Europe, Middle East (AE)"),
|
|
||||||
("AP", "Armed Forces Pacific (AP)"),
|
|
||||||
],
|
|
||||||
max_length=2,
|
|
||||||
null=True,
|
|
||||||
verbose_name="state, territory, or military post",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="domainrequest",
|
|
||||||
name="requested_suborganization",
|
|
||||||
field=models.CharField(blank=True, null=True),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="domainrequest",
|
|
||||||
name="suborganization_city",
|
|
||||||
field=models.CharField(blank=True, null=True),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="domainrequest",
|
|
||||||
name="suborganization_state_territory",
|
|
||||||
field=models.CharField(
|
|
||||||
blank=True,
|
|
||||||
choices=[
|
|
||||||
("AL", "Alabama (AL)"),
|
|
||||||
("AK", "Alaska (AK)"),
|
|
||||||
("AS", "American Samoa (AS)"),
|
|
||||||
("AZ", "Arizona (AZ)"),
|
|
||||||
("AR", "Arkansas (AR)"),
|
|
||||||
("CA", "California (CA)"),
|
|
||||||
("CO", "Colorado (CO)"),
|
|
||||||
("CT", "Connecticut (CT)"),
|
|
||||||
("DE", "Delaware (DE)"),
|
|
||||||
("DC", "District of Columbia (DC)"),
|
|
||||||
("FL", "Florida (FL)"),
|
|
||||||
("GA", "Georgia (GA)"),
|
|
||||||
("GU", "Guam (GU)"),
|
|
||||||
("HI", "Hawaii (HI)"),
|
|
||||||
("ID", "Idaho (ID)"),
|
|
||||||
("IL", "Illinois (IL)"),
|
|
||||||
("IN", "Indiana (IN)"),
|
|
||||||
("IA", "Iowa (IA)"),
|
|
||||||
("KS", "Kansas (KS)"),
|
|
||||||
("KY", "Kentucky (KY)"),
|
|
||||||
("LA", "Louisiana (LA)"),
|
|
||||||
("ME", "Maine (ME)"),
|
|
||||||
("MD", "Maryland (MD)"),
|
|
||||||
("MA", "Massachusetts (MA)"),
|
|
||||||
("MI", "Michigan (MI)"),
|
|
||||||
("MN", "Minnesota (MN)"),
|
|
||||||
("MS", "Mississippi (MS)"),
|
|
||||||
("MO", "Missouri (MO)"),
|
|
||||||
("MT", "Montana (MT)"),
|
|
||||||
("NE", "Nebraska (NE)"),
|
|
||||||
("NV", "Nevada (NV)"),
|
|
||||||
("NH", "New Hampshire (NH)"),
|
|
||||||
("NJ", "New Jersey (NJ)"),
|
|
||||||
("NM", "New Mexico (NM)"),
|
|
||||||
("NY", "New York (NY)"),
|
|
||||||
("NC", "North Carolina (NC)"),
|
|
||||||
("ND", "North Dakota (ND)"),
|
|
||||||
("MP", "Northern Mariana Islands (MP)"),
|
|
||||||
("OH", "Ohio (OH)"),
|
|
||||||
("OK", "Oklahoma (OK)"),
|
|
||||||
("OR", "Oregon (OR)"),
|
|
||||||
("PA", "Pennsylvania (PA)"),
|
|
||||||
("PR", "Puerto Rico (PR)"),
|
|
||||||
("RI", "Rhode Island (RI)"),
|
|
||||||
("SC", "South Carolina (SC)"),
|
|
||||||
("SD", "South Dakota (SD)"),
|
|
||||||
("TN", "Tennessee (TN)"),
|
|
||||||
("TX", "Texas (TX)"),
|
|
||||||
("UM", "United States Minor Outlying Islands (UM)"),
|
|
||||||
("UT", "Utah (UT)"),
|
|
||||||
("VT", "Vermont (VT)"),
|
|
||||||
("VI", "Virgin Islands (VI)"),
|
|
||||||
("VA", "Virginia (VA)"),
|
|
||||||
("WA", "Washington (WA)"),
|
|
||||||
("WV", "West Virginia (WV)"),
|
|
||||||
("WI", "Wisconsin (WI)"),
|
|
||||||
("WY", "Wyoming (WY)"),
|
|
||||||
("AA", "Armed Forces Americas (AA)"),
|
|
||||||
("AE", "Armed Forces Africa, Canada, Europe, Middle East (AE)"),
|
|
||||||
("AP", "Armed Forces Pacific (AP)"),
|
|
||||||
],
|
|
||||||
max_length=2,
|
|
||||||
null=True,
|
|
||||||
verbose_name="state, territory, or military post",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -600,8 +600,6 @@ class RequestingEntity(DomainRequestWizard):
|
||||||
sub_organization = cleaned_data.get("sub_organization")
|
sub_organization = cleaned_data.get("sub_organization")
|
||||||
requested_suborganization = cleaned_data.get("requested_suborganization")
|
requested_suborganization = cleaned_data.get("requested_suborganization")
|
||||||
|
|
||||||
# If no suborganization presently exists but the user filled out
|
|
||||||
# org information then create a suborg automatically.
|
|
||||||
if requesting_entity_is_suborganization and (sub_organization or requested_suborganization):
|
if requesting_entity_is_suborganization and (sub_organization or requested_suborganization):
|
||||||
# Cleanup the organization name field, as this isn't for suborganizations.
|
# Cleanup the organization name field, as this isn't for suborganizations.
|
||||||
self.domain_request.organization_name = None
|
self.domain_request.organization_name = None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue