Merge pull request #133 from alphagov/tidy-up-inconsistent-forms

Tidy up inconsistent forms
This commit is contained in:
NIcholas Staples
2016-02-01 17:03:36 +00:00
22 changed files with 300 additions and 297 deletions

View File

@@ -31,9 +31,7 @@ GOV.UK Notify | Set up service
<form autocomplete="off" method="post">
{{ textbox(form.name) }}
{{ page_footer(
'Continue'
) }}
{{ page_footer('Continue') }}
</form>
</div>

View File

@@ -6,13 +6,13 @@ GOV.UK Notify | Send email
{% block maincolumn_content %}
<h1 class="heading-xlarge">Send email</h1>
<h1 class="heading-xlarge">Send email</h1>
<p>This page will be where we check the email messages we're about to send</p>
<p>This page will be where we check the email messages we're about to send</p>
<p>
<a class="button" href="dashboard" role="button">Send email messages</a>
</p>
<p>
<a class="button" href="dashboard" role="button">Send email messages</a>
</p>
{% endblock %}

View File

@@ -5,60 +5,60 @@
{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
GOV.UK Notify | Send text messages
GOV.UK Notify | Send text messages
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-xlarge">Send text messages</h1>
<h1 class="heading-xlarge">Send text messages</h1>
{% if upload_result.rejects %}
<h3 class="heading-small">The following numbers are invalid</h3>
{% for rejected in upload_result.rejects %}
<p>Line {{rejected.line_number}}: {{rejected.phone }}</a>
{% endfor %}
<p><a href="{{url_for('.send_sms', service_id=service_id)}}" class="button">Go back and resolve errors</a></p>
{% if upload_result.rejects %}
<h3 class="heading-small">The following numbers are invalid</h3>
{% for rejected in upload_result.rejects %}
<p>Line {{rejected.line_number}}: {{rejected.phone }}</a>
{% endfor %}
<p><a href="{{url_for('.send_sms', service_id=service_id)}}" class="button">Go back and resolve errors</a></p>
{% else %}
{% else %}
<h2 class="heading-medium">Check and confirm</h2>
<form method="POST" enctype="multipart/form-data">
<h2 class="heading-medium">Check and confirm</h2>
<form method="POST" enctype="multipart/form-data">
{{ page_footer(
button_text = "Send {} text messages".format(upload_result.valid|count),
back_link = url_for(".send_sms", service_id=service_id)
)}}
{{ page_footer(
button_text = "Send {} text messages".format(upload_result.valid|count),
back_link = url_for(".send_sms", service_id=service_id)
)}}
{% if upload_result.valid | count > 6 %}
<h3 class="heading-small">First three message in file</h3>
{% for recipient in upload_result.valid[:3] %}
{{ sms_message(message_template|replace_placeholders(
recipient),
'{}'.format(recipient['phone'])
)}}
{% endfor %}
<h3 class="heading-small">Last three messages in file</h3>
{% for recipient in upload_result.valid[-3:] %}
{{ sms_message(message_template|replace_placeholders(
recipient),
'{}'.format(recipient['phone'])
)}}
{% endfor %}
{% else %}
<h3 class="heading-small">All messages in file</h3>
{% for recipient in upload_result.valid %}
{{ sms_message(message_template|replace_placeholders(
recipient),
'{}'.format(recipient['phone'])
)}}
{% endfor %}
{% endif %}
{% if upload_result.valid | count > 6 %}
<h3 class="heading-small">First three message in file</h3>
{% for recipient in upload_result.valid[:3] %}
{{ sms_message(message_template|replace_placeholders(
recipient),
'{}'.format(recipient['phone'])
)}}
{% endfor %}
<h3 class="heading-small">Last three messages in file</h3>
{% for recipient in upload_result.valid[-3:] %}
{{ sms_message(message_template|replace_placeholders(
recipient),
'{}'.format(recipient['phone'])
)}}
{% endfor %}
{% else %}
<h3 class="heading-small">All messages in file</h3>
{% for recipient in upload_result.valid %}
{{ sms_message(message_template|replace_placeholders(
recipient),
'{}'.format(recipient['phone'])
)}}
{% endfor %}
{% endif %}
{{ page_footer(
button_text = "Send {} text messages".format(upload_result.valid|count),
back_link = url_for(".send_sms", service_id=service_id)
)}}
{{ page_footer(
button_text = "Send {} text messages".format(upload_result.valid|count),
back_link = url_for(".send_sms", service_id=service_id)
)}}
</form>
{% endif %}
</form>
{% endif %}
{% endblock %}

View File

@@ -8,28 +8,28 @@ GOV.UK Notify | Edit template
{% block maincolumn_content %}
<h1 class="heading-xlarge">{{ h1 }}</h1>
<h1 class="heading-xlarge">{{ h1 }}</h1>
<form method="post">
{{ textbox(form.name) }}
<fieldset class="form-group">
<legend class="form-label">
Template type
</legend>
<label class="block-label" for="template_type">
<input type="radio" name="template_type" id="template_type" checked="checked" value="sms" />
Text message
</label>
</fieldset>
{{ textbox(form.template_content, highlight_tags=True) }}
{{ page_footer(
'Save',
delete_link=url_for('.delete_service_template', service_id=service_id, template_id=template_id) if template_id or None,
delete_link_text='delete this template',
back_link=url_for('.manage_service_templates', service_id=service_id),
back_link_text='Back to templates'
) }}
</form>
<form method="post">
{{ textbox(form.name) }}
<fieldset class="form-group">
<legend class="form-label">
Template type
</legend>
<label class="block-label" for="template_type">
<input type="radio" name="template_type" id="template_type" checked="checked" value="sms" />
Text message
</label>
</fieldset>
{{ textbox(form.template_content, highlight_tags=True) }}
{{ page_footer(
'Save',
delete_link=url_for('.delete_service_template', service_id=service_id, template_id=template_id) if template_id or None,
delete_link_text='delete this template',
back_link=url_for('.manage_service_templates', service_id=service_id),
back_link_text='Back to templates'
) }}
</form>
{% endblock %}

View File

@@ -13,13 +13,11 @@ GOV.UK Notify
<h1 class="heading-xlarge">Check your email address</h1>
<p>Check your email address is correct and then resend the confirmation code.</p>
<p>
</p>
<form autocomplete="off" method="post">
{{ textbox(form.email_address) }}
<span class="font-xsmall">Your email address must end in .gov.uk</span>
{{ page_footer('Resend confirmation code') }}
</form>
<form autocomplete="off" method="post">
{{ textbox(form.email_address, hint='Your email address must end in .gov.uk') }}
{{ page_footer('Resend confirmation code') }}
</form>
</div>
</div>

View File

@@ -15,7 +15,7 @@ GOV.UK Notify
<p>If you have forgotten your password, we can send you an email to create a new password.</p>
<form autocomplete="off" method="post">
{{ textbox(form.email_address) }}
{{ textbox(form.email_address) }}
{{ page_footer("Send email") }}
</form>

View File

@@ -10,32 +10,32 @@ GOV.UK Notify | Notifications activity
{% block maincolumn_content %}
<h1 class="heading-large">
{{ uploaded_file_name }}
</h1>
{{ uploaded_file_name }}
</h1>
<p>
<p>
{{ banner(flash_message, with_tick=True) }}
</p>
</p>
<ul class="grid-row job-totals">
<li class="column-one-third">
{{ big_number(
counts.total,
'text message' if 1 == counts.total else 'text messages'
)}}
</li>
<li class="column-one-third">
{{ big_number(
counts.failed,
'failed delivery' if 1 == counts.failed else 'failed deliveries'
)}}
</li>
<li class="column-one-third">
{{ big_number(
cost, 'total cost'
)}}
</li>
</ul>
<ul class="grid-row job-totals">
<li class="column-one-third">
{{ big_number(
counts.total,
'text message' if 1 == counts.total else 'text messages'
)}}
</li>
<li class="column-one-third">
{{ big_number(
counts.failed,
'failed delivery' if 1 == counts.failed else 'failed deliveries'
)}}
</li>
<li class="column-one-third">
{{ big_number(
cost, 'total cost'
)}}
</li>
</ul>
<p>
Sent with template <a href="{{ url_for('.edit_service_template', service_id=service_id, template_id=template_used) }}">{{ template_used }}</a> on {{ uploaded_file_time | format_datetime}}
@@ -61,8 +61,8 @@ GOV.UK Notify | Notifications activity
align='right',
status='error' if item.status == 'Failed' else 'default'
) %}
{{ item.status }}&emsp;{{ item.time }}
{% endcall %}
{{ item.status }}&emsp;{{ item.time }}
{% endcall %}
{% endcall %}
{% endblock %}

View File

@@ -7,28 +7,28 @@ GOV.UK Notify | Notifications activity
{% block maincolumn_content %}
<h1 class="heading-xlarge">Notifications activity</h1>
<h1 class="heading-xlarge">Notifications activity</h1>
{% call(item) list_table(
jobs,
caption="Recent activity",
caption_visible=False,
empty_message='You havent sent any notifications yet',
field_headings=['Job', 'File', 'Time', 'Status']
) %}
{% call field() %}
<a href="{{ url_for('.view_job', service_id=service_id, job_id=item.id) }}">{{ item.id }}</a>
{% endcall %}
{% call field() %}
<a href="{{ url_for('.view_job', service_id=service_id, job_id=item.id) }}">{{ item.original_file_name }}</a>
{% endcall %}
{% call field() %}
{{ item.created_at | format_datetime}}
{% endcall %}
{% call field() %}
{{ item.status }}
{% endcall %}
{% endcall %}
{% call(item) list_table(
jobs,
caption="Recent activity",
caption_visible=False,
empty_message='You havent sent any notifications yet',
field_headings=['Job', 'File', 'Time', 'Status']
) %}
{% call field() %}
<a href="{{ url_for('.view_job', service_id=service_id, job_id=item.id) }}">{{ item.id }}</a>
{% endcall %}
{% call field() %}
<a href="{{ url_for('.view_job', service_id=service_id, job_id=item.id) }}">{{ item.original_file_name }}</a>
{% endcall %}
{% call field() %}
{{ item.created_at | format_datetime}}
{% endcall %}
{% call field() %}
{{ item.status }}
{% endcall %}
{% endcall %}
{% endblock %}

View File

@@ -7,13 +7,13 @@ GOV.UK Notify | Manage users
{% block maincolumn_content %}
<h1 class="heading-xlarge">Manage users</h1>
<h1 class="heading-xlarge">Manage users</h1>
<p>Here's where you can add or remove users of a service.</p>
<p>Here's where you can add or remove users of a service.</p>
{{ page_footer(
back_link = url_for('.service_dashboard', service_id=service_id),
back_link_text = 'Back to dashboard'
) }}
{{ page_footer(
back_link = url_for('.service_dashboard', service_id=service_id),
back_link_text = 'Back to dashboard'
) }}
{% endblock %}

View File

@@ -9,20 +9,24 @@ GOV.UK Notify
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-two-thirds">
{% if user %}
<h1 class="heading-xlarge">Create a new password</h1>
<p> You can now create a new password for your account.</p>
<form method="post" autocomplete="off">
{{ textbox(form.new_password, hint="Your password must have at least 10 characters") }}
{{ page_footer("Continue") }}
</form>
{% else %}
Message about email address does not exist. Some one needs to figure out the words here.
{% endif %}
</div>
<div class="column-two-thirds">
{% if user %}
<h1 class="heading-xlarge">
Create a new password
</h1>
<p>
You can now create a new password for your account.
</p>
<form method="post" autocomplete="off">
{{ textbox(form.new_password, hint="Your password must have at least 10 characters") }}
{{ page_footer("Continue") }}
</form>
{% else %}
<p>
Message about email address does not exist. Some one needs to figure out the words here.
</p>
{% endif %}
</div>
</div>
{% endblock %}

View File

@@ -10,24 +10,24 @@ GOV.UK Notify | Notifications activity
{% block maincolumn_content %}
<h1 class="heading-large">
Text message
</h1>
<h1 class="heading-large">
Text message
</h1>
<div class="grid-row">
<div class="column-two-thirds">
{{ sms_message(message.message, message.phone) }}
</div>
<div class="column-one-third">
{{ banner(
"{} {}".format(message.status, delivered_at)
) }}
</div>
</div>
<div class="grid-row">
<div class="column-two-thirds">
{{ sms_message(message.message, message.phone) }}
</div>
<div class="column-one-third">
{{ banner(
"{} {}".format(message.status, delivered_at)
) }}
</div>
</div>
{{ page_footer(
back_link = url_for('.view_job', service_id=service_id, job_id=job_id),
back_link_text = 'View other messages in this job'
) }}
{{ page_footer(
back_link = url_for('.view_job', service_id=service_id, job_id=job_id),
back_link_text = 'View other messages in this job'
) }}
{% endblock %}

View File

@@ -7,12 +7,12 @@ GOV.UK Notify |
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">GOV.UK Notify</h1>
<div class="column-two-thirds">
<h1 class="heading-xlarge">GOV.UK Notify</h1>
<p>You have been sent an email containing a link to reset your password.</p>
<p>You have been sent an email containing a link to reset your password.</p>
</div>
</div>
</div>
{% endblock %}

View File

@@ -7,29 +7,29 @@ GOV.UK Notify | Create a user account
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">Create an account</h1>
<div class="column-two-thirds">
<h1 class="heading-xlarge">Create an account</h1>
<p>If you've used GOV.UK Notify before, <a href="">sign in to your account</a>.</p>
<p>If you've used GOV.UK Notify before, <a href="">sign in to your account</a>.</p>
<p>
<label class="form-label" for="name-f1">Full name</label>
<input class="form-control-2-3" id="name-f1" type="text">
</p>
<p>
<label class="form-label" for="mobile">Mobile phone number</label>
<input class="form-control-1-4" id="mobile" type="text">
</p>
<p>
<label class="form-label" for="password">Create a password</label>
<input class="form-control-1-4" id="password" type="password"><br>
<span class="font-xsmall">Your password must have at least 10 characters</span></label>
</p>
<p>
<label class="form-label" for="name-f1">Full name</label>
<input class="form-control-2-3" id="name-f1" type="text">
</p>
<p>
<label class="form-label" for="mobile">Mobile phone number</label>
<input class="form-control-1-4" id="mobile" type="text">
</p>
<p>
<label class="form-label" for="password">Create a password</label>
<input class="form-control-1-4" id="password" type="password"><br>
<span class="font-xsmall">Your password must have at least 10 characters</span></label>
</p>
<p>
<a class="button" href="verify-mobile" role="button">Continue</a>
</p>
</div>
<p>
<a class="button" href="verify-mobile" role="button">Continue</a>
</p>
</div>
</div>
{% endblock %}

View File

@@ -9,21 +9,19 @@ GOV.UK Notify | Create an account
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">Create an account</h1>
<div class="column-two-thirds">
<h1 class="heading-xlarge">Create an account</h1>
<p>If you've used GOV.UK Notify before, <a href="{{ url_for('.sign_in') }}">sign in to your account</a>.</p>
<p>If you've used GOV.UK Notify before, <a href="{{ url_for('.sign_in') }}">sign in to your account</a>.</p>
<form autocomplete="off" action="" method="post">
{{ form.hidden_tag() }}
{{ textbox(form.name) }}
{{ textbox(form.email_address, hint="Your email address must end in .gov.uk") }}
{{ textbox(form.mobile_number) }}
{{ textbox(form.password, hint="Your password must have at least 10 characters") }}
{{ page_footer("Continue") }}
</form>
</div>
<form autocomplete="off" action="" method="post">
{{ textbox(form.name) }}
{{ textbox(form.email_address, hint="Your email address must end in .gov.uk") }}
{{ textbox(form.mobile_number) }}
{{ textbox(form.password, hint="Your password must have at least 10 characters") }}
{{ page_footer("Continue") }}
</form>
</div>
</div>
{% endblock %}

View File

@@ -6,12 +6,12 @@ GOV.UK Notify | Send email
{% block maincolumn_content %}
<h1 class="heading-xlarge">Send email</h1>
<h1 class="heading-xlarge">Send email</h1>
<p>This page will be where we construct email messages</p>
<p>This page will be where we construct email messages</p>
<p>
<a class="button" href="check-email" role="button">Continue</a>
</p>
<p>
<a class="button" href="check-email" role="button">Continue</a>
</p>
{% endblock %}

View File

@@ -3,44 +3,44 @@
{% from "components/big-number.html" import big_number %}
{% block page_title %}
GOV.UK Notify | Dashboard
GOV.UK Notify | Dashboard
{% endblock %}
{% block maincolumn_content %}
<ul class="grid-row job-totals">
<li class="column-half">
{{ big_number(
free_text_messages_remaining,
'free text messages remaining'
)}}
</li>
<li class="column-half">
{{ big_number(
'£' + spent_this_month,
'spent this month'
)}}
</li>
</ul>
<ul class="grid-row job-totals">
<li class="column-half">
{{ big_number(
free_text_messages_remaining,
'free text messages remaining'
)}}
</li>
<li class="column-half">
{{ big_number(
'£' + spent_this_month,
'spent this month'
)}}
</li>
</ul>
{% call(item) list_table(
[],
caption="Recent text messages",
empty_message='You havent sent any text messages yet',
empty_message='You havent sent any text messages yet',
field_headings=['Job', 'File', 'Time', 'Status']
) %}
{% call field() %}
<a href="{{ url_for('.view_job', service_id=service_id, job_id=456) }}">{{ item.file }}</a>
{% endcall %}
{% call field() %}
<a href="{{ url_for('.view_job', service_id=service_id, job_id=456) }}">{{ item.job }}</a>
{% endcall %}
{% call field() %}
{{ item.time }}
{% endcall %}
{% call field() %}
{{ item.status }}
{% endcall %}
{% call field() %}
<a href="{{ url_for('.view_job', service_id=service_id, job_id=456) }}">{{ item.file }}</a>
{% endcall %}
{% call field() %}
<a href="{{ url_for('.view_job', service_id=service_id, job_id=456) }}">{{ item.job }}</a>
{% endcall %}
{% call field() %}
{{ item.time }}
{% endcall %}
{% call field() %}
{{ item.status }}
{% endcall %}
{% endcall %}
{% endblock %}

View File

@@ -7,26 +7,26 @@ GOV.UK Notify | Get started
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">GOV.UK Notify</h1>
<div class="column-two-thirds">
<h1 class="heading-xlarge">GOV.UK Notify</h1>
<p>
Use GOV.UK Notify to send notifications by text message, email and letter.
</p>
<p>
We're making it easy to keep your users informed.
</p>
<p>
If you work for a UK government department or agency you can set up a test account now.
</p>
<p>
<a class="button" href="{{ url_for('.register' )}}" role="button">Set up an account</a>
</p>
<p>
If you've used GOV.UK Notify before, <a href="{{ url_for('.sign_in' )}}">sign in to your account</a>.
</p>
<p>
Use GOV.UK Notify to send notifications by text message, email and letter.
</p>
<p>
We're making it easy to keep your users informed.
</p>
<p>
If you work for a UK government department or agency you can set up a test account now.
</p>
<p>
<a class="button" href="{{ url_for('.register' )}}" role="button">Set up an account</a>
</p>
<p>
If you've used GOV.UK Notify before, <a href="{{ url_for('.sign_in' )}}">sign in to your account</a>.
</p>
</div>
</div>
</div>
{% endblock %}

View File

@@ -9,17 +9,17 @@ Sign in
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">Sign in</h1>
<div class="column-two-thirds">
<h1 class="heading-xlarge">Sign in</h1>
<p>If you do not have an account, you can <a href="register">register for one now</a>.</p>
<p>If you do not have an account, you can <a href="register">register for one now</a>.</p>
<form autocomplete="off" method="post">
{{ textbox(form.email_address) }}
{{ textbox(form.password) }}
{{ page_footer("Continue", back_link=url_for('.forgot_password'), back_link_text="Forgotten password?") }}
</form>
</div>
<form autocomplete="off" method="post">
{{ textbox(form.email_address) }}
{{ textbox(form.password) }}
{{ page_footer("Continue", back_link=url_for('.forgot_password'), back_link_text="Forgotten password?") }}
</form>
</div>
</div>
{% endblock %}

View File

@@ -9,18 +9,20 @@ GOV.UK Notify | Text verification
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">Text verification</h1>
<div class="column-two-thirds">
<h1 class="heading-xlarge">Text verification</h1>
<p>We've sent you a text message with a verification code.</p>
<p>We've sent you a text message with a verification code.</p>
<form autocomplete="off" method="post">
{{ textbox(form.sms_code) }}
<span class="font-xsmall"><a href="{{ url_for('.verification_code_not_received') }}">I haven't received a text</a></span>
{{ page_footer("Continue") }}
</form>
</div>
<form autocomplete="off" method="post">
{{ textbox(form.sms_code) }}
{{ page_footer(
"Continue",
back_link=url_for('.verification_code_not_received'),
back_link_text='I havent received a text'
) }}
</form>
</div>
</div>
{% endblock %}

View File

@@ -7,21 +7,21 @@ GOV.UK Notify | Confirm mobile number
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">Confirm your mobile number</h1>
<div class="column-two-thirds">
<h1 class="heading-xlarge">Confirm your mobile number</h1>
<p>We've sent you a confirmation code by text message.</p>
<p>We've sent you a confirmation code by text message.</p>
<p>
<label class="form-label" for="email">Enter confirmation code<br>
<input class="form-control-1-4" id="email" type="text"><br>
<span class="font-xsmall"><a href="{{ url_for('.text-not-received-2') }}">I haven't received a text</a></span>
</p>
<p>
<label class="form-label" for="email">Enter confirmation code<br>
<input class="form-control-1-4" id="email" type="text"><br>
<span class="font-xsmall"><a href="{{ url_for('.text-not-received-2') }}">I haven't received a text</a></span>
</p>
<p>
<a class="button" href="dashboard" role="button">Continue</a>
</p>
</div>
<p>
<a class="button" href="dashboard" role="button">Continue</a>
</p>
</div>
</div>
{% endblock %}

View File

@@ -9,19 +9,23 @@ GOV.UK Notify | Confirm email address and mobile number
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">Activate your account</h1>
<div class="column-two-thirds">
<h1 class="heading-xlarge">Activate your account</h1>
<p>We've sent you confirmation codes by email and text message. You need to enter both codes here.</p>
<p>We've sent you confirmation codes by email and text message. You need to enter both codes here.</p>
<form autocomplete="off" method="post">
{{ textbox(form.email_code) }}
<span class="font-xsmall"><a href="{{ url_for('.check_and_resend_email_code')}}">I haven't received an email</a></span>
{{ textbox(form.sms_code) }}
<span class="font-xsmall"><a href="{{ url_for('.check_and_resend_text_code') }}">I haven't received a text</a></span>
{{ page_footer("Continue") }}
</form>
</div>
<form autocomplete="off" method="post">
{{ textbox(form.email_code) }}
<p>
<a href="{{ url_for('.check_and_resend_email_code')}}">I haven't received an email</a>
</p>
{{ textbox(form.sms_code) }}
<p>
<a href="{{ url_for('.check_and_resend_text_code') }}">I haven't received a text</a></span>
</p>
{{ page_footer("Continue") }}
</form>
</div>
</div>
{% endblock %}

View File

@@ -16,9 +16,8 @@ def test_should_render_new_password_template(app_,
with app_.test_client() as client:
token = generate_token(api_user_active.email_address)
response = client.get(url_for('.new_password', token=token))
print(response.location)
assert response.status_code == 200
assert ' You can now create a new password for your account.' in response.get_data(as_text=True)
assert 'You can now create a new password for your account.' in response.get_data(as_text=True)
@pytest.mark.skipif(True, reason='Password reset no implemented')