Merge branch 'main' into sspj/other-contacts-second-page

This commit is contained in:
Seamus Johnston 2023-02-27 14:00:26 -06:00 committed by GitHub
commit 11bac7627f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 80 additions and 7 deletions

View file

@ -105,7 +105,7 @@ $letter-space--xs: .0125em;
color: color('violet-70v'); //USWDS default
}
}
.register-form-step .usa-form-group:first-of-type,
.register-form-step .usa-label:first-of-type {
margin-top: units(1);
}

View file

@ -18,6 +18,10 @@
</a>
{% endif %}
{% block form_messages %}
{% include "includes/form_messages.html" %}
{% endblock %}
{% block form_errors %}
{% comment %}
to make sense of this loop, consider that

View file

@ -2,7 +2,7 @@
{% load field_helpers %}
{% block form_instructions %}
<h2 class="margin-bottom-5">
<h2 class="margin-bottom-05">
Which federal branch is your organization in?
</h2>
{% endblock %}
@ -12,4 +12,4 @@
{% with add_class="usa-radio__input--tile" %}
{% input_with_errors forms.0.federal_type %}
{% endwith %}
{% endblock %}
{% endblock %}

View file

@ -2,7 +2,7 @@
{% load static field_helpers %}
{% block form_instructions %}
<p>Wed like to contact other employees with administrative or technical responsibilities in your organization. For example, they could be involved in managing your organization or its technical infrastructure. This information will help us assess your eligibility and understand the purpose of the .gov domain. These contacts should be in addition to you and your authorizing official. They should be employees of your organization.</p>
<p>Wed like to contact other employees in your organization about your domain request. For example, they could be involved in managing your organization or its technical infrastructure. <strong>This information will help us assess your eligibility for a .gov domain.</strong> These contacts should be in addition to you and your authorizing official. They should be employees of your organization.</p>
<p>Well email these contacts to let them know that you made this request.</p>
{% endblock %}
@ -14,7 +14,7 @@
{% for form in forms.0.forms %}
<fieldset class="usa-fieldset">
<legend>
<h2>Administrative or technical contact {{ forloop.counter }}</h2>
<h2>Organization contact {{ forloop.counter }}</h2>
</legend>
{% input_with_errors form.first_name %}

View file

@ -167,9 +167,11 @@
{% if messages %}
<ul class="messages">
{% for message in messages %}
{% if 'base' in message.extra_tags %}
<li{% if message.tags %} class="{{ message.tags }}" {% endif %}>
{{ message }}
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}

View file

@ -1,5 +1,9 @@
{% comment %}
Commenting the code below to turn off the error because
we are showing the caution dialog instead. But saving in
case we want to revert this.
{% if form.errors %}
{% for error in form.non_field_errors %}
{% for error in form.non_field_errors %}
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2">
<div class="usa-alert__body">
{{ error|escape }}
@ -15,4 +19,5 @@
</div>
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
{% endcomment %}

View file

@ -0,0 +1,10 @@
{% if messages %}
{% for message in messages %}
<div class="usa-alert usa-alert--{{ message.tags }} usa-alert--slim margin-bottom-2">
<div class="usa-alert__body">
{{ message }}
</div>
</div>
{% endfor %}
{% endif %}

View file

@ -6,6 +6,8 @@ from django.shortcuts import redirect, render
from django.urls import resolve, reverse
from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView
from django.contrib import messages
from django.utils.safestring import mark_safe
from registrar.forms import application_wizard as forms
from registrar.models import DomainApplication
@ -324,6 +326,18 @@ class ApplicationWizard(LoginRequiredMixin, TemplateView):
self.save(forms)
else:
# unless there are errors
# no sec because this use of mark_safe does not introduce a cross-site
# scripting vulnerability because there is no untrusted content inside.
# It is only being used to pass a specific HTML entity into a template.
messages.warning(
request,
mark_safe( # nosec
"<b>We could not save all the fields.</b><br/> The highlighted "
+ "fields below <b>could not be saved</b> because they have "
+ "missing or invalid data. All other information on this page "
+ "has been saved."
),
)
context = self.get_context_data()
context["forms"] = forms
return render(request, self.template_name, context)
@ -331,6 +345,7 @@ class ApplicationWizard(LoginRequiredMixin, TemplateView):
# if user opted to save their progress,
# return them to the page they were already on
if button == "save":
messages.success(request, "Your progress has been saved!")
return self.goto(self.steps.current)
# otherwise, proceed as normal
return self.goto_next_step()