move required fields display in ds data and nameservers

This commit is contained in:
David Kennedy 2025-03-19 07:27:58 -04:00
parent 443abedd74
commit c375656f9d
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
2 changed files with 100 additions and 97 deletions

View file

@ -274,64 +274,66 @@
DS records defined on the domain. DS records defined on the domain.
{% endcomment %} {% endcomment %}
<section class="add-dsdata-form display-none section-outlined"> <div class="add-dsdata-form display-none">
{% include "includes/required_fields.html" %} {% include "includes/required_fields.html" %}
<form class="usa-form usa-form--extra-large" method="post" novalidate> <section class="section-outlined">
<h2>Add DS record</h2> <form class="usa-form usa-form--extra-large" method="post" novalidate>
{% csrf_token %} <h2>Add DS record</h2>
{{ formset.management_form }} {% csrf_token %}
{% for form in formset %} {{ formset.management_form }}
<div class="repeatable-form"> {% for form in formset %}
<div class="grid-row grid-gap-2 flex-end"> <div class="repeatable-form">
<div class="tablet:grid-col-4"> <div class="grid-row grid-gap-2 flex-end">
{% with sublabel_text="Numbers (0-9) only." %} <div class="tablet:grid-col-4">
{% with attr_required=True add_initial_value_attr=True add_group_class="usa-form-group--unstyled-error" %} {% with sublabel_text="Numbers (0-9) only." %}
{% input_with_errors form.key_tag %}
{% endwith %}
{% endwith %}
</div>
<div class="tablet:grid-col-4">
{% with attr_required=True add_initial_value_attr=True add_group_class="usa-form-group--unstyled-error" %}
{% input_with_errors form.algorithm %}
{% endwith %}
</div>
<div class="tablet:grid-col-4">
{% with attr_required=True add_initial_value_attr=True add_group_class="usa-form-group--unstyled-error" %}
{% input_with_errors form.digest_type %}
{% endwith %}
</div>
</div>
<div class="grid-row">
<div class="grid-col">
{% with sublabel_text="Numbers (0-9) and letters (a-f) only. SHA-1: 40 chars, SHA-256: 64 chars." %}
{% with hide_character_count=True %}
{% with attr_required=True add_initial_value_attr=True add_group_class="usa-form-group--unstyled-error" %} {% with attr_required=True add_initial_value_attr=True add_group_class="usa-form-group--unstyled-error" %}
{% input_with_errors form.digest %} {% input_with_errors form.key_tag %}
{% endwith %} {% endwith %}
{% endwith %} {% endwith %}
{% endwith %} </div>
<div class="tablet:grid-col-4">
{% with attr_required=True add_initial_value_attr=True add_group_class="usa-form-group--unstyled-error" %}
{% input_with_errors form.algorithm %}
{% endwith %}
</div>
<div class="tablet:grid-col-4">
{% with attr_required=True add_initial_value_attr=True add_group_class="usa-form-group--unstyled-error" %}
{% input_with_errors form.digest_type %}
{% endwith %}
</div>
</div>
<div class="grid-row">
<div class="grid-col">
{% with sublabel_text="Numbers (0-9) and letters (a-f) only. SHA-1: 40 chars, SHA-256: 64 chars." %}
{% with hide_character_count=True %}
{% with attr_required=True add_initial_value_attr=True add_group_class="usa-form-group--unstyled-error" %}
{% input_with_errors form.digest %}
{% endwith %}
{% endwith %}
{% endwith %}
</div>
</div> </div>
</div> </div>
</div> {% endfor %}
{% endfor %} <div class="margin-top-2">
<div class="margin-top-2"> <button
<button type="button"
type="button" class="usa-button usa-button--outline dsdata-cancel-add-form"
class="usa-button usa-button--outline dsdata-cancel-add-form" name="btn-cancel-click"
name="btn-cancel-click" aria-label="Reset the data in the DS records to the registry state (undo changes)"
aria-label="Reset the data in the DS records to the registry state (undo changes)" >Cancel
>Cancel </button>
</button> <button
<button id="save-ds-data"
id="save-ds-data" type="submit"
type="submit" class="usa-button"
class="usa-button" >Save
>Save </button>
</button> </div>
</div> </form>
</form> </section>
</section> </div>
{% endif %} {% endif %}
<a <a

View file

@ -240,57 +240,58 @@
This section renders Add New Nameservers form which renders when there are no existing This section renders Add New Nameservers form which renders when there are no existing
nameservers defined on the domain. nameservers defined on the domain.
{% endcomment %} {% endcomment %}
<div class="add-nameservers-form display-none">
<section class="add-nameservers-form display-none section-outlined">
{% include "includes/required_fields.html" %} {% include "includes/required_fields.html" %}
<form class="usa-form usa-form--extra-large" method="post" novalidate> <section class="section-outlined">
<h2>Add name servers</h2> <form class="usa-form usa-form--extra-large" method="post" novalidate>
{% csrf_token %} <h2>Add name servers</h2>
{{ formset.management_form }} {% csrf_token %}
{% for form in formset %} {{ formset.management_form }}
{{ form.domain }} {% for form in formset %}
<div class="repeatable-form"> {{ form.domain }}
<div class="grid-row grid-gap-2 flex-end minh-143px"> <div class="repeatable-form">
<div class="tablet:grid-col-6"> <div class="grid-row grid-gap-2 flex-end minh-143px">
{% with sublabel_text="Example: ns"|concat:forloop.counter|concat:".example.com" add_group_class="usa-form-group--unstyled-error margin-top-2" %} <div class="tablet:grid-col-6">
{% if forloop.counter <= 2 %} {% with sublabel_text="Example: ns"|concat:forloop.counter|concat:".example.com" add_group_class="usa-form-group--unstyled-error margin-top-2" %}
{# span_for_text will wrap the copy in s <span>, which we'll use in the JS for this component #} {% if forloop.counter <= 2 %}
{% with attr_required=True add_initial_value_attr=True span_for_text=True %} {# span_for_text will wrap the copy in s <span>, which we'll use in the JS for this component #}
{% input_with_errors form.server %} {% with attr_required=True add_initial_value_attr=True span_for_text=True %}
{% endwith %} {% input_with_errors form.server %}
{% else %}
{% with span_for_text=True add_initial_value_attr=True %}
{% input_with_errors form.server %}
{% endwith %} {% endwith %}
{% endif %} {% else %}
{% endwith %} {% with span_for_text=True add_initial_value_attr=True %}
</div> {% input_with_errors form.server %}
<div class="tablet:grid-col-6"> {% endwith %}
{% with attr_required=True add_initial_value_attr=True label_text=form.ip.label sublabel_text="Example: 86.124.49.54 or 2001:db8::1234:5678" add_aria_label="Name server "|concat:forloop.counter|concat:" "|concat:form.ip.label add_group_class="usa-form-group--unstyled-error margin-top-2" %} {% endif %}
{% input_with_errors form.ip %} {% endwith %}
{% endwith %} </div>
<div class="tablet:grid-col-6">
{% with attr_required=True add_initial_value_attr=True label_text=form.ip.label sublabel_text="Example: 86.124.49.54 or 2001:db8::1234:5678" add_aria_label="Name server "|concat:forloop.counter|concat:" "|concat:form.ip.label add_group_class="usa-form-group--unstyled-error margin-top-2" %}
{% input_with_errors form.ip %}
{% endwith %}
</div>
</div> </div>
</div> </div>
</div> {% endfor %}
{% endfor %}
<div class="margin-top-2"> <div class="margin-top-2">
<button <button
type="button" type="button"
class="usa-button usa-button--outline nameserver-cancel-add-form" class="usa-button usa-button--outline nameserver-cancel-add-form"
name="btn-cancel-click" name="btn-cancel-click"
aria-label="Reset the data in the name server form to the registry state (undo changes)" aria-label="Reset the data in the name server form to the registry state (undo changes)"
>Cancel >Cancel
</button> </button>
<button <button
type="submit" type="submit"
class="usa-button" class="usa-button"
>Save >Save
</button> </button>
</div> </div>
</form> </form>
</section> </section>
</div>
{% endif %} {% endif %}