mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 13:39:41 -04:00
Add latest content
From: https://docs.google.com/document/d/1aykf1MjJH5y21Bz1ht6WJncb9cKu0fsPlac3-bkMPe8/edit
This commit is contained in:
@@ -177,6 +177,10 @@ class ForgivingIntegerField(StringField):
|
||||
|
||||
POSTGRES_MAX_INT = 2147483647
|
||||
|
||||
def __init__(self, label=None, things='items', **kwargs):
|
||||
self.things = things
|
||||
super().__init__(label, **kwargs)
|
||||
|
||||
def process_formdata(self, valuelist):
|
||||
|
||||
if valuelist:
|
||||
@@ -199,9 +203,12 @@ class ForgivingIntegerField(StringField):
|
||||
error = None
|
||||
try:
|
||||
if int(self.data) > self.POSTGRES_MAX_INT:
|
||||
error = 'Must be less than {:,.0f}'.format(self.POSTGRES_MAX_INT)
|
||||
error = 'Number of {} must be {:,.0f} or less'.format(
|
||||
self.things,
|
||||
self.POSTGRES_MAX_INT,
|
||||
)
|
||||
except ValueError:
|
||||
error = 'Must be a whole number'
|
||||
error = 'Number of {} must be in the correct format'.format(self.things)
|
||||
|
||||
if error:
|
||||
raise ValidationError(error)
|
||||
@@ -649,12 +656,15 @@ class EstimateUsageForm(StripWhitespaceForm):
|
||||
|
||||
volume_email = ForgivingIntegerField(
|
||||
'How many emails do you expect to send in the next year?',
|
||||
things='emails',
|
||||
)
|
||||
volume_sms = ForgivingIntegerField(
|
||||
'How many text messages do you expect to send in the next year?',
|
||||
things='text messages',
|
||||
)
|
||||
volume_letter = ForgivingIntegerField(
|
||||
'How many letters do you expect to send in the next year?',
|
||||
things='letters',
|
||||
)
|
||||
consent_to_research = RadioField(
|
||||
'Can we contact you when we’re doing user research?',
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Estimate usage
|
||||
Tell us how many messages you expect to send
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
@@ -15,18 +15,17 @@
|
||||
{% if not form.at_least_one_volume_filled %}
|
||||
{% call banner_wrapper(type='dangerous') %}
|
||||
<h1 class='banner-title'>
|
||||
no things supplied
|
||||
Enter the number of messages you expect to send in the next year
|
||||
</h1>
|
||||
<p>Tell us some things</p>
|
||||
{% endcall %}
|
||||
{% else %}
|
||||
<h1 class="heading-large">Estimate usage</h1>
|
||||
<h1 class="heading-large">Tell us how many messages you expect to send</h1>
|
||||
{% endif %}
|
||||
{% call form_wrapper() %}
|
||||
<div class="form-group">
|
||||
{{ textbox(form.volume_email, width='1-2', hint='For example, 1,000,000') }}
|
||||
{{ textbox(form.volume_sms, width='1-2', hint='For example, 500,000') }}
|
||||
{{ textbox(form.volume_letter, width='1-2', hint='For example, 5,000') }}
|
||||
{{ textbox(form.volume_email, width='1-2', hint='For example, 50,000') }}
|
||||
{{ textbox(form.volume_sms, width='1-2', hint='For example, 50,000') }}
|
||||
{{ textbox(form.volume_letter, width='1-2', hint='For example, 50,000') }}
|
||||
</div>
|
||||
{{ radios(form.consent_to_research, hint='You don’t have to take part and you can unsubscribe at any time') }}
|
||||
{{ page_footer('Continue') }}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
{% call task_list_wrapper() %}
|
||||
{{ task_list_item(
|
||||
current_service.has_estimated_usage,
|
||||
'Estimate usage',
|
||||
'Tell us how many messages you expect to send',
|
||||
url_for('main.estimate_usage', service_id=current_service.id),
|
||||
) }}
|
||||
{{ task_list_item(
|
||||
|
||||
Reference in New Issue
Block a user