Merge with master.

This commit is contained in:
Nicholas Staples
2016-02-29 14:59:15 +00:00
60 changed files with 881 additions and 510 deletions

View File

@@ -0,0 +1,30 @@
{% macro checkbox(
field,
hint=False,
help_link=None,
help_link_text=None,
width='2-3',
suffix=None
) %}
<label class="form-checkbox" for="{{ field.name }}">
{{ field.label }}
{% if hint %}
<span class="form-hint">
{{ hint }}
</span>
{% endif %}
{% if field.errors %}
<span class="error-message">
{{ field.errors[0] }}
</span>
{% endif %}
{{ field(**{
'class': 'form-control form-control-{} textbox-highlight-textbox'.format(width) if highlight_tags else 'form-control form-control-{} {}'.format(width, 'textbox-right-aligned' if suffix else ''),
'data-module': 'highlight-tags' if highlight_tags else ''})}}
{% if help_link and help_link_text %}
<p class="textbox-help-link">
<a href='{{ help_link }}'>{{ help_link_text }}</a>
</p>
{% endif %}
</label>
{% endmacro %}

View File

@@ -9,29 +9,27 @@
</h3>
{% endif %}
<div class="email-message">
{% if from_name and from_address %}
<div class="email-message-from">
<div class="grid-row">
<div class="column-one-eighth">
<span class="form-hint">From</span>
</div>
<div class="column-seven-eighths">
{{ from_name }} &lt;{{ from_address }}&gt;
</div>
</div>
</div>
{% endif %}
{% if subject %}
<div class="email-message-subject">
<div class="grid-row">
<div class="column-one-eighth">
<span class="form-hint">Subject</span>
</div>
<div class="column-seven-eighths">
{{ subject }}
</div>
</div>
</div>
{% if from_name or subject %}
<table class="email-message-meta">
<tbody>
{% if from_name and from_address %}
<tr>
<th>From</th>
<td>
{{ from_name }} &lt;{{ from_address }}&gt;
</td>
</tr>
{% endif %}
{% if subject %}
<tr class="email-message-meta">
<th>Subject</th>
<td>
{{ subject }}
</td>
</div>
{% endif %}
</tbody>
</table>
{% endif %}
<div class="email-message-body">
{{ body|nl2br }}

View File

@@ -5,11 +5,11 @@
</legend>
<div class='yes-no-fields inline'>
<label class='block-label'>
<input type='radio' name='{{ name }}' {% if current_value == True %}checked{% endif %} />
<input type='radio' name='{{ name }}' value='yes' {% if current_value == True %}checked{% endif %} />
Yes
</label>
<label class='block-label'>
<input type='radio' name='{{ name }}' {% if current_value == False %}checked{% endif %} />
<input type='radio' name='{{ name }}' value='no' {% if current_value == False %}checked{% endif %} />
No
</label>
</div>

View File

@@ -4,8 +4,9 @@
</h2>
{% if current_user.has_permissions(session.get('service_id', ''), ['send_messages']) %}
<ul>
<li><a href="{{ url_for('.choose_sms_template', service_id=service_id) }}">Send text messages</a></li>
<li><a href="{{ url_for('.send_email', service_id=service_id) }}">Send emails</a></li>
<li><a href="{{ url_for('.choose_template', service_id=service_id, template_type='sms') }}">Send text messages</a></li>
<li><a href="{{ url_for('.choose_template', service_id=service_id, template_type='email') }}">Send emails</a></li>
<li><a href="{{ url_for('.letters_stub', service_id=service_id) }}">Send letters</a></li>
</ul>
{% endif %}
{% if current_user.has_permissions(session.get('service_id', ''), ['manage_service']) %}

View File

@@ -1,42 +0,0 @@
{% extends "withoutnav_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/sms-message.html" import sms_message %}
{% from "components/email-message.html" import email_message %}
{% block page_title %}
Preview your service name GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">
Preview your service name
</h1>
<div class="grid-row">
<div class="column-two-thirds">
{{ sms_message(
"{}: we received your payment, thank you".format(service_name),
name="Text message",
recipient='Sent from 40604'
) }}
</div>
</div>
<div class="grid-row">
<div class='column-two-thirds'>
{{ email_message(
subject="We received your payment, thank you",
body="Dear Alice Smith,\n\nThank you for…",
from_name=service_name,
from_address=from_address,
name="Email",
) }}
</div>
</div>
<form method="post">
{{page_footer('Looks good', back_link=url_for(".add_service"))}}
</form>
{% endblock %}

View File

@@ -16,16 +16,29 @@
</h1>
<p>
Be specific. Remember that there might be other people in your
organisation using GOV.UK Notify.
Be specific to your service. Remember that there might be
other people in your organisation using GOV.UK Notify.
</p>
<p>
Users will see this:
</p>
<ul class="list-bullet bottom-gutter">
<li>
at the start of every text message, eg Vehicle tax: we received your
payment, thank you
</li>
<li>
as your email sender name
</li>
</ul>
<form autocomplete="off" method="post">
{{ textbox(form.name, hint="You can change this later") }}
{{ page_footer('Continue') }}
{{ page_footer('Add service') }}
</form>

View File

@@ -1,18 +0,0 @@
{% extends "withnav_template.html" %}
{% block page_title %}
Send email GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Send email</h1>
<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>
{% endblock %}

View File

@@ -1,4 +1,5 @@
{% extends "withnav_template.html" %}
{% from "components/email-message.html" import email_message %}
{% from "components/sms-message.html" import sms_message %}
{% from "components/table.html" import list_table, field %}
{% from "components/placeholder.html" import placeholder %}
@@ -6,7 +7,7 @@
{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
Check and confirm GOV.UK Notify
{{ "Check and confirm" if upload_result.valid else page_heading }} GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
@@ -25,24 +26,31 @@
{% endif %}
<h1 class="heading-large">
{{ "Check and confirm" if upload_result.valid else "Send text messages" }}
{{ "Check and confirm" if upload_result.valid else page_heading }}
</h1>
<div class="grid-row">
<div class="column-two-thirds">
{% if template.missing_data or template.additional_data %}
{{ sms_message(template.formatted_as_markup)}}
{% else %}
{{ sms_message(template.replaced)}}
{% endif %}
{% if 'email' == template.template_type %}
{{ email_message(
template.subject,
template.replaced if upload_result.valid else template.formatted_as_markup,
from_address='{}@notifications.service.gov.uk'.format(service.email_from),
from_name=service.name
)}}
{% elif 'sms' == template.template_type %}
<div class="grid-row">
<div class="column-two-thirds">
{{ sms_message(
template.replaced if upload_result.valid else template.formatted_as_markup
)}}
</div>
</div>
</div>
{% endif %}
{% if upload_result.valid %}
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="submit" class="button" value="{{ "Send {} text message{}".format(upload_result.rows|count, '' if upload_result.rows|count == 1 else 's') }}" />
<a href="{{url_for('.send_sms', service_id=service_id, template_id=template.id)}}" class="page-footer-back-link">Back</a>
<a href="{{url_for('.send_messages', service_id=service_id, template_id=template.id)}}" class="page-footer-back-link">Back</a>
</form>
{% else %}
{{file_upload(form.file, button_text='Upload a CSV file')}}
@@ -53,13 +61,13 @@
caption=original_file_name,
field_headings=column_headers
) %}
{% if item.phone|valid_phone_number %}
{% if item.to or ''|valid_phone_number %}
{% call field() %}
{{ item.phone }}
{{ item.to }}
{% endcall %}
{% else %}
{% call field(status='missing') %}
{{ item.phone }}
{{ item.to }}
{% endcall %}
{% endif %}
{% for column in template.placeholders %}

View File

@@ -1,15 +1,16 @@
{% extends "withnav_template.html" %}
{% from "components/email-message.html" import email_message %}
{% from "components/sms-message.html" import sms_message %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/textbox.html" import textbox %}
{% block page_title %}
Send text messages GOV.UK Notify
{{ page_heading }} GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Send text messages</h1>
<h1 class="heading-large">{{ page_heading }}</h1>
<form method="POST" enctype="multipart/form-data">
@@ -26,12 +27,20 @@
<div class="grid-row">
{% for template in templates %}
<div class="column-two-thirds">
{{ sms_message(template.formatted_as_markup, name=template.name) }}
{% if 'email' == template_type %}
{{ email_message(
template.subject,
template.formatted_as_markup,
name=template.name
) }}
{% elif 'sms' == template_type %}
{{ sms_message(template.formatted_as_markup, name=template.name) }}
{% endif %}
</div>
<div class="column-one-third">
<div class="sms-message-use-links">
<a href="{{ url_for(".send_sms", service_id=service_id, template_id=template.id) }}">Add recipients</a>
<a href="{{ url_for(".send_sms_to_self", service_id=service_id, template_id=template.id) }}">Send yourself a test</a>
<a href="{{ url_for(".send_messages", service_id=service_id, template_id=template.id) }}">Add recipients</a>
<a href="{{ url_for(".send_message_to_self", service_id=service_id, template_id=template.id) }}">Send yourself a test</a>
<a href="{{ url_for(".edit_service_template", service_id=service_id, template_id=template.id) }}">Edit template</a>
</div>
</div>
@@ -40,7 +49,7 @@
{% endif %}
<p>
<a href="{{ url_for('.add_service_template', service_id=service_id) }}" class="button">Add a new template</a>
<a href="{{ url_for('.add_service_template', service_id=service_id, template_type=template_type) }}" class="button">Add a new template</a>
</p>
</form>

View File

@@ -161,7 +161,7 @@
<h2 class="heading-medium">API endpoint</h2>
<p>
https://www.notify.works/api/endpoint
https://api.notify.works
</p>
<p>

View File

@@ -0,0 +1,39 @@
{% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
{{ h1 }} GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Edit email template</h1>
<form method="post">
<div class="grid-row">
<div class="column-two-thirds">
{{ textbox(form.name, width='1-1') }}
{{ textbox(form.subject, width='1-1') }}
</div>
<div class="column-two-thirds">
{{ textbox(form.template_content, highlight_tags=True, width='1-1') }}
</div>
<div class="column-one-third">
<label for='template_content' class='edit-template-placeholder-hint'>
Add placeholders using double brackets, eg Your thing
is due on ((date))
</label>
</div>
</div>
{{ 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('.choose_template', template_type=template_type, service_id=service_id),
back_link_text='Cancel'
) }}
</form>
{% endblock %}

View File

@@ -8,15 +8,13 @@
{% block maincolumn_content %}
<h1 class="heading-large">{{ h1 }}</h1>
<h1 class="heading-large">Edit text message template</h1>
<form method="post">
<div class="grid-row">
<div class="column-two-thirds">
{{ textbox(form.name, width='1-1') }}
</div>
</div>
<div class="grid-row">
<div class="column-two-thirds">
{{ textbox(form.template_content, highlight_tags=True, width='1-1') }}
</div>
@@ -31,7 +29,7 @@
'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('.choose_sms_template', service_id=service_id),
back_link=url_for('.choose_template', service_id=service_id, template_type=template_type),
back_link_text='Cancel'
) }}
</form>

View File

@@ -28,6 +28,7 @@ Manage users GOV.UK Notify
<legend class='heading-small'>
Permissions
</legend>
<span class="form-hint">All team members can see message history</span>
{{ yes_no('send_messages', 'Send messages', user.permission_send_messages) }}
{{ yes_no('manage_service', 'Manage service', user.permission_manage_service) }}
{{ yes_no('manage_api_keys', 'Manage API keys', user.permission_manage_api_keys) }}

View File

@@ -14,13 +14,22 @@
{{ uploaded_file_name }}
</h1>
<div class="grid-row">
<div class="column-two-thirds">
{{ sms_message(
template.formatted_as_markup,
)}}
{% if 'sms' == template.template_type %}
<div class="grid-row">
<div class="column-two-thirds">
{{ sms_message(
template,
)}}
</div>
</div>
</div>
{% elif 'email' == template.template_type %}
{{ email_message(
template.subject,
template,
from_address='{}@notifications.service.gov.uk'.format(service.email_from),
from_name=service.name
)}}
{% endif %}
<p class='heading-small'>
Started {{ uploaded_file_time|format_datetime }}

View File

@@ -0,0 +1,17 @@
{% extends "withnav_template.html" %}
{% block page_title %}
Send letters GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">
Send letters
</h1>
<p>
This page is where you would go to send letters.
</p>
{% endblock %}

View File

@@ -26,13 +26,13 @@ Manage users GOV.UK Notify
users, caption='Active', **table_options
) %}
{% call field() %}
{{ current_user.name }}
{{ item.name }}
{% endcall %}
{{ boolean_field(item.permission_send_messages) }}
{{ boolean_field(item.permission_manage_service) }}
{{ boolean_field(item.permission_manage_api_keys) }}
{% call field(align='right') %}
<a href="{{ url_for('.edit_user', service_id=service_id, user_id=0)}}">Change</a>
<a href="{{ url_for('.edit_user', service_id=service_id, user_id=item.id)}}">Change</a>
{% endcall %}
{% endcall %}
@@ -41,7 +41,7 @@ Manage users GOV.UK Notify
invited_users, caption='Invited', **table_options
) %}
{% call field() %}
{{ item.email_localpart }}
{{ item.email_address }}
{% endcall %}
{{ boolean_field(item.permission_send_messages) }}
{{ boolean_field(item.permission_manage_service) }}

View File

@@ -1,17 +0,0 @@
{% extends "withnav_template.html" %}
{% block page_title %}
Send email GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Send email</h1>
<p>This page will be where we construct email messages</p>
<p>
<a class="button" href="check-email" role="button">Continue</a>
</p>
{% endblock %}

View File

@@ -1,34 +0,0 @@
{% extends "withnav_template.html" %}
{% from "components/sms-message.html" import sms_message %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/file-upload.html" import file_upload %}
{% from "components/table.html" import list_table, field %}
{% block page_title %}
Send text messages GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Add recipients</h1>
<div class="grid-row">
<div class="column-two-thirds">
{{ sms_message(template.formatted_as_markup) }}
{{ banner(
'You can upload real data, but well only send to your mobile number until you <a href="{}">request to go live</a>'|safe,
'info'
)}}
</div>
</div>
{{file_upload(form.file, button_text='Upload a CSV file')}}
<p>
<a href="{{ url_for('.get_example_csv', service_id=service_id, template_id=template.id) }}">Download an example CSV file</a>
</p>
{% endblock %}

View File

@@ -0,0 +1,54 @@
{% extends "withnav_template.html" %}
{% from "components/sms-message.html" import sms_message %}
{% from "components/email-message.html" import email_message %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/file-upload.html" import file_upload %}
{% from "components/table.html" import list_table, field %}
{% block page_title %}
Send text messages GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Add recipients</h1>
{% if 'sms' == template.template_type %}
<div class="grid-row">
<div class="column-two-thirds">
{{ sms_message(template.formatted_as_markup) }}
</div>
</div>
{% elif 'email' == template.template_type %}
{{ email_message(
template.subject,
template.formatted_as_markup,
from_address='{}@notifications.service.gov.uk'.format(service.email_from),
from_name=service.name
) }}
{% endif %}
<div class="grid-row">
<div class="column-two-thirds">
<p>
Add recipients by uploading a .csv file with
{{ template.placeholders|length + 1 }}
{% if template.placeholders %}
columns:
{% else %}
column:
{% endif %}
</p>
<p class="bottom-gutter-2-3">
<span class='placeholder'>to</span>
{{ template.placeholders_as_markup|join(" ") }}
</p>
<p>
<a href="{{ url_for('.get_example_csv', service_id=service_id, template_id=template.id) }}">Download an example</a>
</p>
</div>
</div>
{{file_upload(form.file, button_text='Upload your CSV file')}}
{% endblock %}

View File

@@ -35,8 +35,8 @@
</li>
</ol>
""".format(
url_for(".add_service_template", service_id=service_id),
url_for(".choose_sms_template", service_id=service_id)
url_for(".add_service_template", service_id=service_id, template_type="sms"),
url_for(".choose_template", service_id=service_id, template_type="sms")
)|safe,
subhead='Get started',
type="tip"
@@ -46,7 +46,7 @@
"""
<a href='{}'>Send yourself a text message</a>
""".format(
url_for(".choose_sms_template", service_id=service_id)
url_for(".choose_template", service_id=service_id, template_type="sms")
)|safe,
subhead='Next step',
type="tip"

View File

@@ -1,5 +1,6 @@
{% extends "withoutnav_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/checkbox.html" import checkbox %}
{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
@@ -22,6 +23,7 @@
help_link=url_for('.verification_code_not_received'),
help_link_text='I havent received a text message'
) }}
{{ checkbox(form.remember_me) }}
{{ page_footer(
"Continue"
) }}