mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-11 21:48:20 +02:00
cleanup
This commit is contained in:
parent
13e294d0d2
commit
3e8dc74319
2 changed files with 2 additions and 99 deletions
|
@ -279,17 +279,6 @@ function prepareDeleteButtons() {
|
|||
let formNum2 = forms.length;
|
||||
totalForms.setAttribute('value', `${formNum2}`);
|
||||
|
||||
// We need to fix the indicies of every existing form otherwise
|
||||
// the frontend and backend will not match and will error on submit
|
||||
// let formNumberRegex = RegExp(`form-(\\d){1}-`,'g');
|
||||
// let formLabelRegex = RegExp(`DS Data record (\\d){1}`, 'g');
|
||||
// forms.forEach((form, index) => {
|
||||
// form.innerHTML = form.innerHTML.replace(formNumberRegex, `form-${index}-`);
|
||||
// form.innerHTML = form.innerHTML.replace(formLabelRegex, `DS Data Record ${index+1}`);
|
||||
// });
|
||||
|
||||
|
||||
|
||||
let formNumberRegex = RegExp(`form-(\\d){1}-`, 'g');
|
||||
let formLabelRegex = RegExp(`DS Data record (\\d){1}`, 'g');
|
||||
|
||||
|
@ -311,10 +300,6 @@ function prepareDeleteButtons() {
|
|||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,89 +374,10 @@ function prepareDeleteButtons() {
|
|||
|
||||
// Attach click event listener on the delete buttons of the new form
|
||||
prepareDeleteButtons();
|
||||
|
||||
// We need to fix the indicies of every existing form otherwise
|
||||
// the frontend and backend will not match and will error on submit
|
||||
// forms.forEach((form, index) => {
|
||||
// form.innerHTML = form.innerHTML.replace(formNumberRegex, `form-${index}-`);
|
||||
// form.innerHTML = form.innerHTML.replace(formLabelRegex, `DS Data Record ${index+1}`);
|
||||
// });
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
|
||||
// (function prepareCancelButtons() {
|
||||
// const cancelButton = document.querySelector('.btn-cancel');
|
||||
|
||||
// if (cancelButton) {
|
||||
// cancelButton.addEventListener('click', () => {
|
||||
|
||||
// // Option 2: Redirect to another page (e.g., the homepage)
|
||||
|
||||
// localStorage.clear(); // Clear all localStorage data
|
||||
// sessionStorage.clear(); // Clear all sessionStorage data
|
||||
|
||||
// location.reload();
|
||||
// });
|
||||
// }
|
||||
// })();
|
||||
|
||||
|
||||
// /**
|
||||
// * An IIFE that attaches a click handler on form cancel buttons
|
||||
// *
|
||||
// */
|
||||
// (function prepareCancelButtons() {
|
||||
// const cancelButton = document.querySelector('.btn-cancel');
|
||||
|
||||
// const formsetContainer = document.querySelector('#form-container');
|
||||
// const originalFormHTML = document.querySelector('.ds-record').innerHTML;
|
||||
// const numberOfFormsToReset = document.querySelectorAll('.ds-record').length;
|
||||
// const addNewRecordButton = document.querySelector('#add-ds-form');
|
||||
// const submitButton = document.querySelector('button[type="submit"]');
|
||||
|
||||
// if (cancelButton) {
|
||||
// cancelButton.addEventListener('click', () => {
|
||||
// // Reset the form to its initial values
|
||||
// const form = document.querySelector('form');
|
||||
// resetForm(form);
|
||||
// });
|
||||
// }
|
||||
|
||||
// function resetForm(form) {
|
||||
|
||||
// // Remove all existing forms within the container
|
||||
// formsetContainer.innerHTML = '';
|
||||
// for (let i = 0; i < numberOfFormsToReset; i++) {
|
||||
// formsetContainer.innerHTML += originalFormHTML;
|
||||
// }
|
||||
// formsetContainer.innerHTML += addNewRecordButton
|
||||
// formsetContainer.innerHTML += submitButton
|
||||
|
||||
// const dsRecords = form.querySelectorAll('.ds-record');
|
||||
|
||||
// dsRecords.forEach((record) => {
|
||||
// const initialValuesField = record.querySelector('.initial-values');
|
||||
// const formFields = record.querySelectorAll('input, textarea, select');
|
||||
|
||||
// if (initialValuesField) {
|
||||
// const initialValues = JSON.parse(initialValuesField.value);
|
||||
|
||||
// formFields.forEach((field) => {
|
||||
// const fieldName = field.name;
|
||||
// if (fieldName in initialValues) {
|
||||
// field.value = initialValues[fieldName];
|
||||
// } else {
|
||||
// field.value = ''; // Set to empty if no initial value
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// })();
|
||||
|
||||
|
||||
function toggleElements() {
|
||||
let element1 = document.getElementById("enable-dnssec");
|
||||
let element2 = document.getElementById("add-records");
|
||||
|
@ -480,7 +386,7 @@ function toggleElements() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* An IIFE that attaches a click handler to toggle the DNSSEC warning on the DNSSEC landing page
|
||||
*
|
||||
*/
|
||||
(function toggleDNSSECWarning() {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
{% for form in formset %}
|
||||
<fieldset class="ds-record">
|
||||
|
||||
<legend class="sr-only">Key Data record {{forloop.counter}}</legend>
|
||||
<legend class="sr-only">DS Data record {{forloop.counter}}</legend>
|
||||
|
||||
<h2 class="margin-top-0">DS Data record {{forloop.counter}}</h2>
|
||||
|
||||
|
@ -70,9 +70,6 @@
|
|||
|
||||
<div class="grid-row margin-top-2">
|
||||
<div class="grid-col">
|
||||
{% comment %} {% with add_group_class="float-right-tablet" %}
|
||||
{% input_with_errors form.delete %}
|
||||
{% endwith %} {% endcomment %}
|
||||
<button type="button" class="usa-button usa-button--unstyled display-block float-right-tablet delete-record">
|
||||
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
||||
<use xlink:href="{%static 'img/sprite.svg'%}#delete"></use>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue