mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-27 04:58:42 +02:00
v2 with signed. Referring to PR #414
This commit is contained in:
parent
e3b6aaaf62
commit
2024d1c905
5 changed files with 36 additions and 2 deletions
|
@ -18,6 +18,10 @@
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% block form_messages %}
|
||||||
|
{% include "includes/form_messages.html" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block form_errors %}
|
{% block form_errors %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
to make sense of this loop, consider that
|
to make sense of this loop, consider that
|
||||||
|
|
|
@ -167,9 +167,11 @@
|
||||||
{% if messages %}
|
{% if messages %}
|
||||||
<ul class="messages">
|
<ul class="messages">
|
||||||
{% for message in messages %}
|
{% for message in messages %}
|
||||||
|
{% if 'base' in message.extra_tags %}
|
||||||
<li{% if message.tags %} class="{{ message.tags }}" {% endif %}>
|
<li{% if message.tags %} class="{{ message.tags }}" {% endif %}>
|
||||||
{{ message }}
|
{{ message }}
|
||||||
</li>
|
</li>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -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 %}
|
{% 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 usa-alert--error usa-alert--slim margin-bottom-2">
|
||||||
<div class="usa-alert__body">
|
<div class="usa-alert__body">
|
||||||
{{ error|escape }}
|
{{ error|escape }}
|
||||||
|
@ -16,3 +20,4 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endcomment %}
|
10
src/registrar/templates/includes/form_messages.html
Normal file
10
src/registrar/templates/includes/form_messages.html
Normal 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 %}
|
|
@ -6,6 +6,8 @@ from django.shortcuts import redirect, render
|
||||||
from django.urls import resolve, reverse
|
from django.urls import resolve, reverse
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.views.generic import TemplateView
|
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.forms import application_wizard as forms
|
||||||
from registrar.models import DomainApplication
|
from registrar.models import DomainApplication
|
||||||
|
@ -319,6 +321,16 @@ class ApplicationWizard(LoginRequiredMixin, TemplateView):
|
||||||
self.save(forms)
|
self.save(forms)
|
||||||
else:
|
else:
|
||||||
# unless there are errors
|
# 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 = self.get_context_data()
|
||||||
context["forms"] = forms
|
context["forms"] = forms
|
||||||
return render(request, self.template_name, context)
|
return render(request, self.template_name, context)
|
||||||
|
@ -326,6 +338,7 @@ class ApplicationWizard(LoginRequiredMixin, TemplateView):
|
||||||
# if user opted to save their progress,
|
# if user opted to save their progress,
|
||||||
# return them to the page they were already on
|
# return them to the page they were already on
|
||||||
if button == "save":
|
if button == "save":
|
||||||
|
messages.success(request, "Your progress has been saved!")
|
||||||
return self.goto(self.steps.current)
|
return self.goto(self.steps.current)
|
||||||
# otherwise, proceed as normal
|
# otherwise, proceed as normal
|
||||||
return self.goto_next_step()
|
return self.goto_next_step()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue