Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
zandercymatics committed Oct 30, 2024
1 parent bc8789b commit ee71ba4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 194 deletions.
6 changes: 2 additions & 4 deletions src/registrar/assets/js/get-gov.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ var SUCCESS = "success";
*
*/
const hideElement = (element) => {
if (element && !element.classList.contains("display-none"))
element.classList.add('display-none');
element.classList.add('display-none');
};

/**
* Show element
*
*/
const showElement = (element) => {
if (element && element.classList.contains("display-none"))
element.classList.remove('display-none');
element.classList.remove('display-none');
};

/**
Expand Down
19 changes: 11 additions & 8 deletions src/registrar/forms/domain_request_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ class RequestingEntityForm(RegistrarForm):
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."""

# 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())

sub_organization = forms.ModelChoiceField(
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,
queryset=Suborganization.objects.none(),
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(
label="Requested suborganization",
required=False,
Expand Down Expand Up @@ -147,7 +147,10 @@ def __init__(self, *args, **kwargs):
@property
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():
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions src/registrar/views/domain_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,6 @@ def save(self, forms: list):
sub_organization = cleaned_data.get("sub_organization")
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):
# Cleanup the organization name field, as this isn't for suborganizations.
self.domain_request.organization_name = None
Expand Down

0 comments on commit ee71ba4

Please sign in to comment.