Merge with master.

This commit is contained in:
Nicholas Staples
2016-01-19 09:49:01 +00:00
48 changed files with 686 additions and 327 deletions

View File

@@ -56,7 +56,7 @@
Service name
</div>
<a href="#">Switch to A N Other service</a>
<a href="#">Add a new service to Notify</a>
<a href="{{ url_for('.add_service') }}">Add a new service to GOV.UK Notify</a>
</div>
</div>
<div class="column-half management-navigation-account">
@@ -68,16 +68,22 @@
{% endif %}
<main id="content" role="main" class="page-container">
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="error-summary">
<ul>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<ul class="banner-dangerous">
{% for category, message in messages %}
<li class="flash-message">
{{ message }}
{% if 'delete' == category %}
<form method='post'>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="submit" class="button" name="delete" value="Yes, delete this template" />
</form>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endif %}
{% endwith %}
{% block fullwidth_content %}{% endblock %}
</main>

View File

@@ -0,0 +1,5 @@
{% macro api_key(key) %}
<div data-module="api-key" data-key="{{ key }}">
<span class="api-key-key">{{ key }}</span>
</div>
{% endmacro %}

View File

@@ -0,0 +1,19 @@
{% macro email_message(subject, body, name=None, edit_link=None) %}
{% if name %}
<h3 class="email-message-name">
{% if edit_link %}
<a href="{{ edit_link }}">{{ name }}</a>
{% else %}
{{ name }}
{% endif %}
</h3>
{% endif %}
<div class="email-message">
<div class="email-message-subject">
{{ subject|placeholders }}
</div>
<div class="email-message-body">
{{ body|nl2br|placeholders }}
</div>
</div>
{% endmacro %}

View File

@@ -1,11 +1,23 @@
{% macro page_footer(button_text=None, back_link=False, back_link_text="Back", destructive=False) %}
{% macro page_footer(
button_text=None,
destructive=False,
back_link=False,
back_link_text="Back",
delete_link=False,
delete_link_text="delete"
) %}
<div class="page-footer">
{% if button_text %}
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="submit" class="button{% if destructive %}-destructive{% endif %}" value="{{ button_text }}" />
{% endif %}
{% if delete_link %}
<span class="page-footer-delete-link">
or <a href="{{ delete_link }}">{{ delete_link_text }}</a>
</span>
{% endif %}
{% if back_link %}
<a class="page-footer-back-link" role="button" href="{{ back_link }}">{{ back_link_text }}</a>
<a class="page-footer-back-link" href="{{ back_link }}">{{ back_link_text }}</a>
{% endif %}
</div>
{% endmacro %}

View File

@@ -1,4 +1,13 @@
{% macro sms_message(body, recipient) %}
{% macro sms_message(body, recipient=None, name=None, edit_link=None) %}
{% if name %}
<h3 class="sms-message-name">
{% if edit_link %}
<a href="{{ edit_link }}">{{ name }}</a>
{% else %}
{{ name }}
{% endif %}
</h3>
{% endif %}
<div class="sms-message">
<div class="sms-message-wrapper">
{{ body|placeholders }}

View File

@@ -3,8 +3,12 @@
{% block fullwidth_content %}
<div class="grid-row">
<div class="column-two-thirds">
<h1>404</h1>
<p>Sorry, that page doesn't exist.</p>
<h1 class="heading-xlarge">
Page could not be found
</h1>
<p>
Check you've entered the correct web address.
</p>
</div>
</div>
{% endblock %}

View File

@@ -3,8 +3,10 @@
{% block fullwidth_content %}
<div class="grid-row">
<div class="column-two-thirds">
<h1>500</h1>
<p>Sorry, something went wrong on our system.</p>
<h1 class="heading-xlarge">
Sorry, we're experiencing technical difficulties
</h1>
<p>Try again later.</p>
</div>
</div>
{% endblock %}

View File

@@ -1,17 +1,18 @@
<nav class="navigation">
<ul>
<li><a href="{{ url_for('.service_dashboard', service_id=123) }}">Dashboard</a></li>
<li><a href="{{ url_for('.service_dashboard', service_id=service_id) }}">Dashboard</a></li>
</ul>
<ul>
<li><a href="{{ url_for('.send_sms', service_id=123) }}">Send text messages</a></li>
<li><a href="{{ url_for('.send_email', service_id=123) }}">Send emails</a></li>
<li><a href="{{ url_for('.view_jobs', service_id=123) }}">Activity</a></li>
<li><a href="{{ url_for('.send_sms', 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('.view_jobs', service_id=service_id) }}">Activity</a></li>
<li><a href="{{ url_for('.manage_templates', service_id=service_id) }}">Templates</a></li>
</ul>
<ul>
<li><a href="{{ url_for('.apikeys', service_id=123) }}">API keys and documentation</a></li>
<li><a href="{{ url_for('.api_keys', service_id=service_id) }}">API keys and documentation</a></li>
</ul>
<ul>
<li><a href="{{ url_for('.manage_users', service_id=123) }}">Manage users</a></li>
<li><a href="{{ url_for('.service_settings', service_id=123) }}">Service settings</a></li>
<li><a href="{{ url_for('.manage_users', service_id=service_id) }}">Manage users</a></li>
<li><a href="{{ url_for('.service_settings', service_id=service_id) }}">Service settings</a></li>
</ul>
</nav>

View File

@@ -1,5 +1,6 @@
{% extends "admin_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
GOV.UK Notify | Set up service
@@ -8,24 +9,34 @@ GOV.UK Notify | Set up service
{% block fullwidth_content %}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">Set up notifications for your service</h1>
<div class="column-two-thirds">
<p>Users will see your service name:</p>
<ul class="list-bullet">
<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>
<h1 class="heading-xlarge">
{{ heading }}
</h1>
<form autocomplete="off" method="post">
{{ textbox(form.name) }}
<p>
Users will see your service name:
</p>
<p>
<button class="button" href="dashboard" role="button">Continue</button>
</p>
</form>
</div>
</div>
<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) }}
{{ page_footer(
'Continue'
) }}
</form>
</div>
</div>
{% endblock %}

View File

@@ -1,15 +1,52 @@
{% extends "withnav_template.html" %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/api-key.html" import api_key %}
{% block page_title %}
GOV.UK Notify | API keys and documentation
GOV.UK Notify | API keys and documentation
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-xlarge">API keys and documentation</h1>
<div class="grid-row">
<div class="column-two-thirds">
<p>Here's where developers can access information about the API and access keys</p>
<h1 class="heading-xlarge">
API keys and documentation
</h1>
<h2 class="heading-medium">
How to integrate GOV.UK Notify into your service
</h2>
<p>
blah blah blah this is where we tell you how the API works
</p>
<h2 class="heading-medium">Repositories</h2>
<p>
<a href="https://github.com/alphagov/notifications-api">GOV.UK Notify API</a>
</p>
<p>
<a href="https://github.com/alphagov/notify-api-client">GOV.UK Notify Python client</a>
</p>
<h2 class="heading-medium">API key for [service name]</h2>
{{ api_key('d30512af92e1386d63b90e5973b49a10') }}
<h2 class="heading-medium">API endpoint</h2>
<p>
https://www.notify.works/api/endpoint
</p>
</div>
</div>
{{ page_footer(
back_link=url_for('.service_dashboard', service_id=service_id),

View File

@@ -59,8 +59,6 @@
back_link = url_for(".send_sms", service_id=service_id)
)}}
<input type='hidden' name='recipients' value='{{filename}}'>
</form>
{% endif %}
{% endblock %}

View File

@@ -1,4 +1,4 @@
{% extends "withnav_template.html" %}
{% extends "admin_template.html" %}
{% from "components/browse-list.html" import browse_list %}
{% block page_title %}

View File

@@ -14,9 +14,10 @@ GOV.UK Notify | Edit template
{{ textbox(form.template_name) }}
{{ textbox(form.template_body, highlight_tags=True) }}
{{ page_footer(
'Save and continue',
back_link=url_for('.service_dashboard', service_id=service_id),
back_link_text='Back to manage templates'
'Save',
delete_link=url_for('.delete_template', service_id=service_id, template_id=template_id) if template_id or None,
back_link=url_for('.manage_templates', service_id=service_id),
back_link_text='Back to templates'
) }}
</form>

View File

@@ -1,4 +1,7 @@
{% extends "withnav_template.html" %}
{% from "components/sms-message.html" import sms_message %}
{% from "components/email-message.html" import email_message %}
{% from "components/browse-list.html" import browse_list %}
{% block page_title %}
GOV.UK Notify | Manage templates
@@ -6,18 +9,32 @@ GOV.UK Notify | Manage templates
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">Manage templates</h1>
<h1 class="heading-xlarge">Templates</h1>
<p>Here's where you can view templates, choose to add one, or edit/delete one.</p>
<p>
<a href="{{ url_for('.add_template', service_id=service_id) }}">Create new template</a>
<p>
<a href="{{ url_for('.edit_template', service_id=service_id, template_id=1) }}">Here is my first template</a>
</p>
<p>
<a class="button" href="{{ url_for('.add_template', service_id=service_id) }}" role="button">Add a new message template</a>
</p>
{% for template in templates %}
{% if template.type == 'sms' %}
{{ sms_message(
template.body,
name=template.name,
edit_link=url_for('.edit_template', service_id=service_id, template_id=loop.index)
) }}
{% elif template.type == 'email' %}
{{ email_message(
template.subject,
template.body,
name=template.name,
edit_link=url_for('.edit_template', service_id=service_id, template_id=loop.index)
) }}
{% endif %}
{% endfor %}
</div>
</div>
{% endblock %}

View File

@@ -4,45 +4,42 @@
{% from "components/textbox.html" import textbox %}
{% block page_title %}
GOV.UK Notify | Send text messages
GOV.UK Notify | Send text messages
{% endblock %}
{% block maincolumn_content %}
<form method="POST" enctype="multipart/form-data">
<form method="POST" enctype="multipart/form-data">
<h1 class="heading-xlarge">Send text messages</h1>
<h1 class="heading-xlarge">Send text messages</h1>
<h2 class="heading-medium">1. Choose text message template</h2>
{% for template in message_templates %}
<div class="template-picker-option">
<div class="template-picker-option-radio">
<label class="block-label" for="template-{{loop.index}}">
{{ template.name }}
<input type="radio" name="template" id="template-{{loop.index}}" value="{{ template.name }}" />
</label>
</div>
{{ sms_message(template.body) }}
</div>
{% endfor %}
<fieldset class='form-group'>
<legend class="heading-medium">1. Choose text message template</legend>
{% for template in message_templates %}
<label class="block-label" for="template-{{loop.index}}">
{{ template.name }}
<input type="radio" name="template" id="template-{{loop.index}}" value="{{ template.name }}" />
</label>
{% endfor %}
</fieldset>
<p>
or <a href="{{ url_for(".add_template", service_id=service_id) }}">create a new template</a>
</p>
<p>
or <a href="{{ url_for(".add_template", service_id=service_id) }}">create a new template</a>
</p>
<h2 class="heading-medium">2. Add recipients</h2>
<h2 class="heading-medium">2. Add recipients</h2>
<p>
Upload a CSV file to add your recipients details.
</p>
<p>
You can also <a href="#">download an example CSV</a>.
</p>
<p>
{{textbox(form.file)}}
</p>
<p>
Upload a CSV file to add your recipients details.
</p>
<p>
You can also <a href="#">download an example CSV</a>.
</p>
<p>
{{textbox(form.file)}}
</p>
{{ page_footer("Continue") }}
{{ page_footer("Continue") }}
</form>
</form>
{% endblock %}

View File

@@ -7,6 +7,7 @@
{% from "components/sms-message.html" import sms_message %}
{% from "components/table.html" import mapping_table, list_table, row, field %}
{% from "components/textbox.html" import textbox %}
{% from "components/api-key.html" import api_key %}
{% block page_title %}
Styleguide GOV.UK Notify
@@ -152,4 +153,8 @@
{{ textbox(form.password) }}
{{ textbox(form.message, highlight_tags=True) }}
<h2 class="heading-large">API key</h2>
{{ api_key('d30512af92e1386d63b90e5973b49a10') }}
{% endblock %}