clean up JS and dnssec template

This commit is contained in:
Rachid Mrad 2023-10-05 16:54:01 -04:00
parent afdc922b13
commit 13e294d0d2
No known key found for this signature in database
GPG key ID: EF38E4CEC4A8F3CF
3 changed files with 20 additions and 89 deletions

View file

@ -472,22 +472,18 @@ function prepareDeleteButtons() {
// })();
function toggleElements() {
let element1 = document.getElementById("enable-dnssec");
let element2 = document.getElementById("add-records");
element1.classList.toggle("display-none");
element2.classList.toggle("display-none");
}
/**
*
*
*/
(function toggleDNSSECWarning() {
document.getElementById("toggler1").addEventListener("click", function () {
var element = document.getElementById("step-1");
var element2 = document.getElementById("step-2");
element.classList.toggle("display-none");
element2.classList.toggle("display-none");
});
document.getElementById("toggler2").addEventListener("click", function () {
var element = document.getElementById("step-1");
var element2 = document.getElementById("step-2");
element.classList.toggle("display-none");
element2.classList.toggle("display-none");
});
document.getElementById("enable_dnssec").addEventListener("click", toggleElements);
document.getElementById("cancel_dnssec").addEventListener("click", toggleElements);
})();

View file

@ -11,7 +11,7 @@
<form class="usa-form usa-form--large" method="post">
{% csrf_token %}
{% if domain.has_dnssec_records %}
{% if has_dnssec_records %}
<div class="usa-alert usa-alert--info usa-alert--slim margin-bottom-3">
<div class="usa-alert__body">
In order to fully disable DNSSEC on your domain, you will need to work with your DNS provider to remove your DNSSEC-related records from your zone.
@ -25,7 +25,7 @@
>Disable DNSSEC</a
>
{% else %}
<div id="step-1">
<div id="enable-dnssec">
<div class="usa-alert usa-alert--info usa-alert--slim margin-bottom-3">
<div class="usa-alert__body">
It is strongly recommended that you do not enable this unless you fully understand DNSSEC and know how to set it up properly. If you make a mistake, it could cause your domain name to stop working.
@ -35,11 +35,11 @@
type="button"
class="usa-button"
name="enable_dnssec"
id="toggler1"
id="enable_dnssec"
>Enable DNSSEC</button>
</div>
<div id="step-2" class="display-none">
<div id="add-records" class="display-none">
<h2> Add DS Records </h2>
<p>In order to enable DNSSEC and add Delegation Signer (DS) records, you must first configure it with your DNS hosting service. Your configuration will determine whether you need to add DS Data or Key Data. Contact your DNS hosting provider if you are unsure which record type to add.</p>
<p>
@ -48,84 +48,21 @@
<button
type="button"
class="usa-button usa-button--unstyled"
name="cancel"
id="toggler2"
name="cancel_dnssec"
id="cancel_dnssec"
>Cancel</button>
</p>
</div>
{% endif %}
</form>
<div
class="usa-modal"
id="example-modal-1"
aria-labelledby="modal-1-heading"
aria-describedby="modal-1-description"
id="toggle-dnssec-alert"
aria-labelledby="Are you sure you want to continue?"
aria-describedby="Your DNSSEC records will be deleted from the registry."
>
{% include 'includes/modal.html' with modal_heading="Are you sure you want to continue?" modal_description="Your DNSSEC records will be deleted from the registry." modal_button=modal_button|safe %}
</div>
{% comment %} <div
class="usa-modal"
id="example-modal-1"
aria-labelledby="modal-1-heading"
aria-describedby="modal-1-description"
>
<div class="usa-modal__content">
<div class="usa-modal__main">
<h2 class="usa-modal__heading" id="modal-1-heading">
Are you sure you want to continue?
</h2>
<div class="usa-prose">
<p id="modal-1-description">
Your DNSSEC records will be deleted from the registry.
</p>
</div>
<div class="usa-modal__footer">
<ul class="usa-button-group">
<li class="usa-button-group__item">
<form method="post">
{% csrf_token %}
<button
type="submit"
class="usa-button"
name="disable_dnssec"
>Disable DNSSEC</button>
</form>
</li>
<li class="usa-button-group__item">
<button
type="button"
class="usa-button usa-button--unstyled padding-105 text-center"
data-close-modal
>
Cancel
</button>
</li>
</ul>
</div>
</div>
<button
type="button"
class="usa-button usa-modal__close"
aria-label="Close this window"
data-close-modal
>
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img">
<use xlink:href="/assets/img/sprite.svg#close"></use>
</svg>
</button>
</div>
</div> {% endcomment %}
{% endblock %} {# domain_content #}

View file

@ -241,9 +241,7 @@ class DomainDNSSECView(DomainPermissionView, FormMixin):
self.domain = self.get_object()
has_dnssec_records = self.domain.dnssecdata is not None
logger.debug(f"clicked_enable_dns {self.clicked_enable_dns}")
# if does_not_have_dnssec_records and self.clicked_enable_dns == False:
# logger.debug(f"clicked_enable_dns {self.clicked_enable_dns}")
# self.domain.dnssec_enabled = False
@ -256,7 +254,7 @@ class DomainDNSSECView(DomainPermissionView, FormMixin):
context['modal_button'] = modal_button
context['has_dnssec_records'] = has_dnssec_records
context['domain'] = self.domain
# context['domain'] = self.domain
return context