mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 03:06:01 +02:00
resolve merge conflicts
This commit is contained in:
commit
cfaba2d587
5 changed files with 56 additions and 29 deletions
|
@ -292,7 +292,18 @@ export function initFormsetsForms() {
|
|||
// For the other contacts form, we need to update the fieldset headers based on what's visible vs hidden,
|
||||
// since the form on the backend employs Django's DELETE widget.
|
||||
let totalShownForms = document.querySelectorAll(`.repeatable-form:not([style*="display: none"])`).length;
|
||||
newForm.innerHTML = newForm.innerHTML.replace(formLabelRegex, `${formLabel} ${totalShownForms + 1}`);
|
||||
let newFormCount = totalShownForms + 1;
|
||||
// update the header
|
||||
let header = newForm.querySelector('legend h3');
|
||||
header.textContent = `${formLabel} ${newFormCount}`;
|
||||
header.id = `org-contact-${newFormCount}`;
|
||||
// update accessibility elements on the delete buttons
|
||||
let deleteDescription = newForm.querySelector('.delete-button-description');
|
||||
deleteDescription.textContent = 'Delete new contact';
|
||||
deleteDescription.id = `org-contact-${newFormCount}__name`;
|
||||
let deleteButton = newForm.querySelector('button');
|
||||
deleteButton.setAttribute("aria-labelledby", header.id);
|
||||
deleteButton.setAttribute("aria-describedby", deleteDescription.id);
|
||||
} else {
|
||||
// Nameservers form is cloned from index 2 which has the word optional on init, does not have the word optional
|
||||
// if indices 0 or 1 have been deleted
|
||||
|
|
|
@ -315,7 +315,7 @@ class DomainRequestFixture:
|
|||
cls._create_domain_requests(users)
|
||||
|
||||
@classmethod
|
||||
def _create_domain_requests(cls, users): # noqa: C901
|
||||
def _create_domain_requests(cls, users, total_requests=None): # noqa: C901
|
||||
"""Creates DomainRequests given a list of users."""
|
||||
total_domain_requests_to_make = len(users) # 100000
|
||||
|
||||
|
@ -323,27 +323,33 @@ class DomainRequestFixture:
|
|||
# number of entries.
|
||||
# (Prevents re-adding more entries to an already populated database,
|
||||
# which happens when restarting Docker src)
|
||||
domain_requests_already_made = DomainRequest.objects.count()
|
||||
total_existing_requests = DomainRequest.objects.count()
|
||||
|
||||
domain_requests_to_create = []
|
||||
if domain_requests_already_made < total_domain_requests_to_make:
|
||||
for user in users:
|
||||
for request_data in cls.DOMAINREQUESTS:
|
||||
# Prepare DomainRequest objects
|
||||
try:
|
||||
domain_request = DomainRequest(
|
||||
creator=user,
|
||||
organization_name=request_data["organization_name"],
|
||||
)
|
||||
cls._set_non_foreign_key_fields(domain_request, request_data)
|
||||
cls._set_foreign_key_fields(domain_request, request_data, user)
|
||||
domain_requests_to_create.append(domain_request)
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
if total_requests and total_requests <= total_existing_requests:
|
||||
total_domain_requests_to_make = total_requests - total_existing_requests
|
||||
if total_domain_requests_to_make >= 0:
|
||||
DomainRequest.objects.filter(
|
||||
id__in=list(DomainRequest.objects.values_list("pk", flat=True)[:total_domain_requests_to_make])
|
||||
).delete()
|
||||
if total_domain_requests_to_make == 0:
|
||||
return
|
||||
|
||||
num_additional_requests_to_make = (
|
||||
total_domain_requests_to_make - domain_requests_already_made - len(domain_requests_to_create)
|
||||
)
|
||||
for user in users:
|
||||
for request_data in cls.DOMAINREQUESTS:
|
||||
# Prepare DomainRequest objects
|
||||
try:
|
||||
domain_request = DomainRequest(
|
||||
creator=user,
|
||||
organization_name=request_data["organization_name"],
|
||||
)
|
||||
cls._set_non_foreign_key_fields(domain_request, request_data)
|
||||
cls._set_foreign_key_fields(domain_request, request_data, user)
|
||||
domain_requests_to_create.append(domain_request)
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
|
||||
num_additional_requests_to_make = total_domain_requests_to_make - len(domain_requests_to_create)
|
||||
if num_additional_requests_to_make > 0:
|
||||
for _ in range(num_additional_requests_to_make):
|
||||
random_user = random.choice(users) # nosec
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
|
||||
<fieldset class="usa-fieldset margin-top-1 dotgov-domain-form" id="form-container">
|
||||
<legend>
|
||||
<h2>Alternative domains (optional)</h2>
|
||||
<h2 id="alternative-domains-title">Alternative domains (optional)</h2>
|
||||
</legend>
|
||||
|
||||
<p id="alt_domain_instructions" class="margin-top-05">Are there other domains you’d like if we can’t give
|
||||
|
@ -79,19 +79,23 @@
|
|||
{% endfor %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
|
||||
<button type="button" value="save" class="usa-button usa-button--unstyled usa-button--with-icon" id="add-form">
|
||||
|
||||
<div class="usa-sr-only" id="alternative-domains__add-another-alternative">Add another alternative domain</div>
|
||||
<button aria-labelledby="alternative-domains-title" aria-describedby="alternative-domains__add-another-alternative" type="button" value="save" class="usa-button usa-button--unstyled usa-button--with-icon" id="add-form">
|
||||
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
||||
<use xlink:href="{%static 'img/sprite.svg'%}#add_circle"></use>
|
||||
</svg><span class="margin-left-05">Add another alternative</span>
|
||||
</button>
|
||||
|
||||
<div class="margin-bottom-3">
|
||||
<div class="usa-sr-only" id="alternative-domains__check-availability">Check domain availability</div>
|
||||
<button
|
||||
id="validate-alt-domains-availability"
|
||||
type="button"
|
||||
class="usa-button usa-button--outline"
|
||||
validate-for="{{ forms.1.requested_domain.auto_id }}"
|
||||
aria-labelledby="alternative-domains-title"
|
||||
aria-describedby="alternative-domains__check-availability"
|
||||
>Check availability</button>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -31,10 +31,14 @@
|
|||
<fieldset class="usa-fieldset repeatable-form padding-y-1">
|
||||
|
||||
<legend class="float-left-tablet">
|
||||
<h3 class="margin-top-05">Organization contact {{ forloop.counter }}</h2>
|
||||
<h3 class="margin-top-05" id="org-contact-{{ forloop.counter }}">Organization contact {{ forloop.counter }}</h2>
|
||||
</legend>
|
||||
|
||||
<button type="button" class="usa-button usa-button--unstyled display-block float-right-tablet delete-record margin-top-1 text-secondary line-height-sans-5 usa-button--with-icon">
|
||||
{% if form.first_name or form.last_name %}
|
||||
<span class="usa-sr-only delete-button-description" id="org-contact-{{ forloop.counter }}__name">Delete {{form.first_name.value }} {{ form.last_name.value }}</span>
|
||||
{% else %}
|
||||
<span class="usa-sr-only" id="org-contact-{{ forloop.counter }}__name">Delete new contact</span>
|
||||
{% endif %}
|
||||
<button aria-labelledby="org-contact-{{ forloop.counter }}" aria-describedby="org-contact-{{ forloop.counter }}__name" type="button" class="usa-button usa-button--unstyled display-block float-right-tablet delete-record margin-top-1 text-secondary line-height-sans-5 usa-button--with-icon">
|
||||
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
||||
<use xlink:href="{%static 'img/sprite.svg'%}#delete"></use>
|
||||
</svg>Delete
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
{% if form.errors %}
|
||||
<div id="form-errors">
|
||||
{% for error in form.non_field_errors %}
|
||||
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2" role="alert">
|
||||
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2" role="alert" tabindex="0">
|
||||
<div class="usa-alert__body">
|
||||
{{ error|escape }}
|
||||
<span class="usa-sr-only">Error:</span>
|
||||
{{ error|escape }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% for field in form %}
|
||||
{% for error in field.errors %}
|
||||
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2">
|
||||
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2" tabindex="0">
|
||||
<div class="usa-alert__body">
|
||||
<span class="usa-sr-only">Error:</span>
|
||||
{{ error|escape }}
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue