From 0eeee88f1c79b426049cfc40d69a2ce9b2c2715d Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Thu, 2 Jan 2025 11:40:17 -0500 Subject: [PATCH 1/3] hide 'other' for portfolios without suborganizations --- src/registrar/assets/src/js/getgov/requesting-entity.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/registrar/assets/src/js/getgov/requesting-entity.js b/src/registrar/assets/src/js/getgov/requesting-entity.js index 4e7cf8276..2f8c842a7 100644 --- a/src/registrar/assets/src/js/getgov/requesting-entity.js +++ b/src/registrar/assets/src/js/getgov/requesting-entity.js @@ -26,7 +26,12 @@ export function handleRequestingEntityFieldset() { function toggleSuborganization(radio=null) { if (radio != null) requestingSuborganization = radio?.checked && radio.value === "True"; requestingSuborganization ? showElement(suborgContainer) : hideElement(suborgContainer); - requestingNewSuborganization.value = requestingSuborganization && select.value === "other" ? "True" : "False"; + if (select.options.length == 2) { // --Select-- and other are the only options + hideElement(selectParent); // Hide the select drop down and indicate requesting new suborg + requestingNewSuborganization.value = "True"; + } else { + requestingNewSuborganization.value = requestingSuborganization && select.value === "other" ? "True" : "False"; + } requestingNewSuborganization.value === "True" ? showElement(suborgDetailsContainer) : hideElement(suborgDetailsContainer); } From ce94775879543897bd924da6b5d9122c221605a5 Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Thu, 2 Jan 2025 20:34:34 -0500 Subject: [PATCH 2/3] minor changes to content --- src/registrar/assets/src/js/getgov/requesting-entity.js | 2 ++ src/registrar/forms/domain_request_wizard.py | 3 ++- .../templates/domain_request_requesting_entity.html | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/registrar/assets/src/js/getgov/requesting-entity.js b/src/registrar/assets/src/js/getgov/requesting-entity.js index 2f8c842a7..3bcdcd35c 100644 --- a/src/registrar/assets/src/js/getgov/requesting-entity.js +++ b/src/registrar/assets/src/js/getgov/requesting-entity.js @@ -13,6 +13,7 @@ export function handleRequestingEntityFieldset() { const selectParent = select?.parentElement; const suborgContainer = document.getElementById("suborganization-container"); const suborgDetailsContainer = document.getElementById("suborganization-container__details"); + const suborgAddtlInstruction = document.getElementById("suborganization-addtl-instruction"); const subOrgCreateNewOption = document.getElementById("option-to-add-suborg")?.value; // Make sure all crucial page elements exist before proceeding. // This more or less ensures that we are on the Requesting Entity page, and not elsewhere. @@ -28,6 +29,7 @@ export function handleRequestingEntityFieldset() { requestingSuborganization ? showElement(suborgContainer) : hideElement(suborgContainer); if (select.options.length == 2) { // --Select-- and other are the only options hideElement(selectParent); // Hide the select drop down and indicate requesting new suborg + hideElement(suborgAddtlInstruction); // Hide additional instruction related to the list requestingNewSuborganization.value = "True"; } else { requestingNewSuborganization.value = requestingSuborganization && select.value === "other" ? "True" : "False"; diff --git a/src/registrar/forms/domain_request_wizard.py b/src/registrar/forms/domain_request_wizard.py index 289b3da0b..130a61e90 100644 --- a/src/registrar/forms/domain_request_wizard.py +++ b/src/registrar/forms/domain_request_wizard.py @@ -144,9 +144,10 @@ class RequestingEntityYesNoForm(BaseYesNoForm): """Extend the initialization of the form from RegistrarForm __init__""" super().__init__(*args, **kwargs) if self.domain_request.portfolio: + choose_text = "(choose from list)" if self.domain_request.portfolio.portfolio_suborganizations.exists() else "" self.form_choices = ( (False, self.domain_request.portfolio), - (True, "A suborganization (choose from list)"), + (True, f"A suborganization {choose_text}"), ) self.fields[self.field_name] = self.get_typed_choice_field() diff --git a/src/registrar/templates/domain_request_requesting_entity.html b/src/registrar/templates/domain_request_requesting_entity.html index 9ed83f2d0..d889a8f44 100644 --- a/src/registrar/templates/domain_request_requesting_entity.html +++ b/src/registrar/templates/domain_request_requesting_entity.html @@ -38,8 +38,9 @@

Add suborganization information

- This information will be published in .gov’s public data. If you don’t see your suborganization in the list, - select “other.” + This information will be published in .gov’s public data. + If you don’t see your suborganization in the list, + select “other.”

{% with attr_required=True %} {% input_with_errors forms.1.sub_organization %} From 560a07f67335ccbeca1b1ffb8d83c98159d5fb13 Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Thu, 2 Jan 2025 20:38:11 -0500 Subject: [PATCH 3/3] lint --- src/registrar/forms/domain_request_wizard.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/registrar/forms/domain_request_wizard.py b/src/registrar/forms/domain_request_wizard.py index 130a61e90..38ddc2851 100644 --- a/src/registrar/forms/domain_request_wizard.py +++ b/src/registrar/forms/domain_request_wizard.py @@ -144,7 +144,9 @@ class RequestingEntityYesNoForm(BaseYesNoForm): """Extend the initialization of the form from RegistrarForm __init__""" super().__init__(*args, **kwargs) if self.domain_request.portfolio: - choose_text = "(choose from list)" if self.domain_request.portfolio.portfolio_suborganizations.exists() else "" + choose_text = ( + "(choose from list)" if self.domain_request.portfolio.portfolio_suborganizations.exists() else "" + ) self.form_choices = ( (False, self.domain_request.portfolio), (True, f"A suborganization {choose_text}"),