mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 19:20:47 +02:00
Merge branch 'main' into nl/3011-fix-request-growth-report-data
This commit is contained in:
commit
cad5496dd7
3 changed files with 15 additions and 4 deletions
|
@ -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.
|
||||
|
@ -26,7 +27,13 @@ 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
|
||||
hideElement(suborgAddtlInstruction); // Hide additional instruction related to the list
|
||||
requestingNewSuborganization.value = "True";
|
||||
} else {
|
||||
requestingNewSuborganization.value = requestingSuborganization && select.value === "other" ? "True" : "False";
|
||||
}
|
||||
requestingNewSuborganization.value === "True" ? showElement(suborgDetailsContainer) : hideElement(suborgDetailsContainer);
|
||||
}
|
||||
|
||||
|
|
|
@ -159,9 +159,12 @@ 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()
|
||||
|
||||
|
|
|
@ -38,8 +38,9 @@
|
|||
<div id="suborganization-container" class="margin-top-4">
|
||||
<h2>Add suborganization information</h2>
|
||||
<p>
|
||||
This information will be published in <a class="usa-link usa-link--always-blue" target="_blank" href="{% public_site_url 'about/data' %}">.gov’s public data</a>. If you don’t see your suborganization in the list,
|
||||
select “other.”
|
||||
This information will be published in <a class="usa-link usa-link--always-blue" target="_blank" href="{% public_site_url 'about/data' %}">.gov’s public data</a>.
|
||||
<span id="suborganization-addtl-instruction"> If you don’t see your suborganization in the list,
|
||||
select “other.”</span>
|
||||
</p>
|
||||
{% with attr_required=True %}
|
||||
{% input_with_errors forms.1.sub_organization %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue