mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 03:58:39 +02:00
Cleanup js after merge
This commit is contained in:
parent
cda7316a71
commit
9cb3ecebf4
2 changed files with 24 additions and 3 deletions
|
@ -629,7 +629,18 @@ export function initRejectedEmail() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSuborganizationSelection() {
|
|
||||||
|
/**
|
||||||
|
* A function that handles the suborganzation and requested suborganization fields and buttons.
|
||||||
|
* - Fieldwise: Hooks to the sub_organization, suborganization_city, and suborganization_state_territory fields.
|
||||||
|
* On change, this function checks if any of these fields are not empty:
|
||||||
|
* sub_organization, suborganization_city, and suborganization_state_territory.
|
||||||
|
* If they aren't, then we show the "clear" button. If they are, then we hide it because we don't need it.
|
||||||
|
*
|
||||||
|
* - Buttonwise: Hooks to the #clear-requested-suborganization button.
|
||||||
|
* On click, this will clear the input value of sub_organization, suborganization_city, and suborganization_state_territory.
|
||||||
|
*/
|
||||||
|
function handleSuborgFieldsAndButtons() {
|
||||||
const requestedSuborganizationField = document.getElementById("id_requested_suborganization");
|
const requestedSuborganizationField = document.getElementById("id_requested_suborganization");
|
||||||
const suborganizationCity = document.getElementById("id_suborganization_city");
|
const suborganizationCity = document.getElementById("id_suborganization_city");
|
||||||
const suborganizationStateTerritory = document.getElementById("id_suborganization_state_territory");
|
const suborganizationStateTerritory = document.getElementById("id_suborganization_state_territory");
|
||||||
|
@ -672,6 +683,6 @@ export function initDynamicDomainRequestFields(){
|
||||||
const domainRequestPage = document.getElementById("domainrequest_form");
|
const domainRequestPage = document.getElementById("domainrequest_form");
|
||||||
if (domainRequestPage) {
|
if (domainRequestPage) {
|
||||||
handlePortfolioSelection();
|
handlePortfolioSelection();
|
||||||
handleSuborganizationSelection();
|
handleSuborgFieldsAndButtons();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -471,6 +471,16 @@ export function handlePortfolioSelection(
|
||||||
if (suborganizationCity) showElement(suborganizationCity);
|
if (suborganizationCity) showElement(suborganizationCity);
|
||||||
if (suborganizationStateTerritory) showElement(suborganizationStateTerritory);
|
if (suborganizationStateTerritory) showElement(suborganizationStateTerritory);
|
||||||
|
|
||||||
|
// Handle rejectSuborganizationButtonFieldset (display of the clear requested suborg button).
|
||||||
|
// Basically, this button should only be visible when we have data for suborg, city, and state_territory.
|
||||||
|
// The function handleSuborgFieldsAndButtons() in domain-request-form.js handles doing this same logic
|
||||||
|
// but on field input for city, state_territory, and the suborg field.
|
||||||
|
// If it doesn't exist, don't do anything.
|
||||||
|
if (!rejectSuborganizationButtonFieldset){
|
||||||
|
console.warn("updateSuborganizationFieldsDisplay() => Could not update rejectSuborganizationButtonFieldset")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Initially show / hide the clear button only if there is data to clear
|
// Initially show / hide the clear button only if there is data to clear
|
||||||
let requestedSuborganizationField = document.getElementById("id_requested_suborganization");
|
let requestedSuborganizationField = document.getElementById("id_requested_suborganization");
|
||||||
let suborganizationCity = document.getElementById("id_suborganization_city");
|
let suborganizationCity = document.getElementById("id_suborganization_city");
|
||||||
|
@ -489,7 +499,7 @@ export function handlePortfolioSelection(
|
||||||
if (requestedSuborganizationField) hideElement(requestedSuborganizationField);
|
if (requestedSuborganizationField) hideElement(requestedSuborganizationField);
|
||||||
if (suborganizationCity) hideElement(suborganizationCity);
|
if (suborganizationCity) hideElement(suborganizationCity);
|
||||||
if (suborganizationStateTerritory) hideElement(suborganizationStateTerritory);
|
if (suborganizationStateTerritory) hideElement(suborganizationStateTerritory);
|
||||||
hideElement(rejectSuborganizationButtonFieldset);
|
if (rejectSuborganizationButtonFieldset) hideElement(rejectSuborganizationButtonFieldset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue