added application_intro.html as well as logic that inserts the message on new requests

This commit is contained in:
David Kennedy 2023-12-26 18:13:36 -05:00
parent 90c12031e8
commit 3387c49508
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
2 changed files with 47 additions and 8 deletions

View file

@ -0,0 +1,31 @@
{% extends 'base.html' %}
{% load static form_helpers url_helpers %}
{% block content %}
<div class="grid-container">
<div class="grid-row grid-gap">
<form class="usa-form usa-form--large" method="post" novalidate>
{% csrf_token %}
<p>You're about to start your .gov domain request. You don't have to complete the process in one session. You can save what you enter and come back to it when you're ready.</p>
<p>We'll use this information you provide to verify your organization's eligibility for a .gov domain. We'll also verify that the domain you request meets our guidelines.</p>
<p>If you have all the information you need, completing your domain request might take around 15 minutes. <a href="{% public_site_url 'contact/' %}"
target="_blank" rel="noopener noreferrer" class="usa-link">Contact us</a> if you need help with your request.</p>
{% block form_buttons %}
<div class="stepnav">
<button
type="submit"
name="submit_button"
value="intro_acknowledge"
class="usa-button"
>Continue</button>
</div>
{% endblock %}
</form>
</div>
</div>
{% endblock %}

View file

@ -209,15 +209,15 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
# if accessing this class directly, redirect to the first step
# in other words, if `ApplicationWizard` is called as view
# directly by some redirect or url handler, we'll send users
# to the first step in the processes; subclasses will NOT
# be redirected. The purpose of this is to allow code to
# either to an acknowledgement page or to the first step in
# the processes (if an edit rather than a new request); subclasses
# will NOT be redirected. The purpose of this is to allow code to
# send users "to the application wizard" without needing to
# know which view is first in the list of steps.
if self.__class__ == ApplicationWizard:
# if starting a new application, clear the storage
if request.path_info == self.NEW_URL_NAME:
del self.storage
return render(request, "application_intro.html")
else:
return self.goto(self.steps.first)
self.steps.current = current_url
@ -373,12 +373,20 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
def post(self, request, *args, **kwargs) -> HttpResponse:
"""This method handles POST requests."""
# which button did the user press?
button: str = request.POST.get("submit_button", "")
# if user has acknowledged the intro message
if button == "intro_acknowledge":
if request.path_info == self.NEW_URL_NAME:
del self.storage
return self.goto(self.steps.first)
# if accessing this class directly, redirect to the first step
if self.__class__ == ApplicationWizard:
return self.goto(self.steps.first)
# which button did the user press?
button: str = request.POST.get("submit_button", "")
forms = self.get_forms(use_post=True)
if self.is_valid(forms):