- {{ govukWarningText({
- text: "This will clear all of the data entered in this session",
- iconFallbackText: "Warning"
- }) }}
-
-
- {{ govukButton({
- text: "Clear the data",
- href: "/prototype-admin/clear-data"
- }) }}
-
-
-
-{% endblock %}
diff --git a/server.js b/server.js
index 1eb52695dc..17226fa63c 100644
--- a/server.js
+++ b/server.js
@@ -227,9 +227,9 @@ if (useAutoStoreData === 'true') {
}
// Clear all data in session if you open /prototype-admin/clear-data
-app.get('/prototype-admin/clear-data', function (req, res) {
+app.post('/prototype-admin/clear-data', function (req, res) {
req.session.data = {}
- res.render('prototype-admin/clear-data')
+ res.render('prototype-admin/clear-data-success')
})
// Redirect root to /docs when in promo mode.
From fb5464f0657c1ad94183db371d67b8df4c413f8e Mon Sep 17 00:00:00 2001
From: Oliver Byford
Date: Mon, 8 Oct 2018 16:49:49 +0100
Subject: [PATCH 009/112] Use consistent page titles
---
lib/prototype-admin/clear-data-success.html | 2 +-
lib/prototype-admin/clear-data.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/prototype-admin/clear-data-success.html b/lib/prototype-admin/clear-data-success.html
index 14750f8484..cc80f50364 100644
--- a/lib/prototype-admin/clear-data-success.html
+++ b/lib/prototype-admin/clear-data-success.html
@@ -1,7 +1,7 @@
{% extends "layout.html" %}
{% block pageTitle %}
- Clear data
+ Data cleared - GOV.UK Prototype Kit
{% endblock %}
{% block content %}
diff --git a/lib/prototype-admin/clear-data.html b/lib/prototype-admin/clear-data.html
index 10d56395ee..005fa65f3c 100644
--- a/lib/prototype-admin/clear-data.html
+++ b/lib/prototype-admin/clear-data.html
@@ -2,7 +2,7 @@
{% extends "layout.html" %}
{% block pageTitle %}
- Clear data? | GOV.UK Prototype Kit
+ Clear data? - GOV.UK Prototype Kit
{% endblock %}
{% block beforeContent %}
From 396c582dc8833cf57596a05149b23caa7da3ec0e Mon Sep 17 00:00:00 2001
From: Oliver Byford
Date: Mon, 8 Oct 2018 16:52:46 +0100
Subject: [PATCH 010/112] Document in changelog
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a4c79a7368..f3dca20df8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
Bug fixes:
- [#605 Set stylesheet media to "all" to allow print styles](https://github.com/alphagov/govuk-prototype-kit/pull/605)
+- [#608 Clearing session data now uses a POST request rather than a destructive GET request](https://github.com/alphagov/govuk-prototype-kit/pull/608)
# 8.1.0
From 736e420f396a58a6aa9e050a36d68bb399e2d69d Mon Sep 17 00:00:00 2001
From: igloosi
Date: Thu, 11 Oct 2018 10:32:41 +0100
Subject: [PATCH 011/112] Update GOV.UK Frontend dependency
Update to v2.2.0
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 172b3ba939..a6f9f5926e 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,7 @@
"express-session": "^1.13.0",
"express-writer": "0.0.4",
"govuk-elements-sass": "^3.1.3",
- "govuk-frontend": "^2.1.0",
+ "govuk-frontend": "^2.2.0",
"govuk_frontend_toolkit": "^7.5.0",
"govuk_template_jinja": "^0.24.1",
"gulp": "^3.9.1",
From ed4b6a5816e646d8381e13427c8632f4c91a133a Mon Sep 17 00:00:00 2001
From: igloosi
Date: Thu, 11 Oct 2018 10:36:43 +0100
Subject: [PATCH 012/112] Import character-count component
Make it available in the app views
---
app/views/layout.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/views/layout.html b/app/views/layout.html
index f04a84127b..59b25cca85 100644
--- a/app/views/layout.html
+++ b/app/views/layout.html
@@ -3,6 +3,7 @@
{% from "back-link/macro.njk" import govukBackLink %}
{% from "breadcrumbs/macro.njk" import govukBreadcrumbs %}
{% from "button/macro.njk" import govukButton %}
+{% from "character-count/macro.njk" import govukCharacterCount %}
{% from "checkboxes/macro.njk" import govukCheckboxes %}
{% from "date-input/macro.njk" import govukDateInput %}
{% from "details/macro.njk" import govukDetails %}
From 4362c7e701f3982586037f20097a2cf3376fdb76 Mon Sep 17 00:00:00 2001
From: igloosi
Date: Thu, 11 Oct 2018 10:41:20 +0100
Subject: [PATCH 013/112] Document in CHANGELOG
---
CHANGELOG.md | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f3dca20df8..c187211c92 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,15 @@
# Unreleased
+New Features:
+
+- [#609 Update GOV.UK Frontend to v2.2.0](https://github.com/alphagov/govuk-prototype-kit/pull/609)
+
+Also includes a new character-count component
+
Bug fixes:
- [#605 Set stylesheet media to "all" to allow print styles](https://github.com/alphagov/govuk-prototype-kit/pull/605)
+
- [#608 Clearing session data now uses a POST request rather than a destructive GET request](https://github.com/alphagov/govuk-prototype-kit/pull/608)
# 8.1.0
From 5ec6251ad55832f722b1fb4f2cf5c158629c7326 Mon Sep 17 00:00:00 2001
From: igloosi
Date: Thu, 11 Oct 2018 10:45:46 +0100
Subject: [PATCH 014/112] Release 8.2.0
---
CHANGELOG.md | 2 +-
VERSION.txt | 2 +-
package.json | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c187211c92..1d8d99c30e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-# Unreleased
+# 8.2.0
New Features:
diff --git a/VERSION.txt b/VERSION.txt
index 8104cabd36..fbb9ea12de 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-8.1.0
+8.2.0
diff --git a/package.json b/package.json
index a6f9f5926e..92174c0b54 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "express-prototype",
"description": "GOVUK prototyping app in Express",
- "version": "8.1.0",
+ "version": "8.2.0",
"private": true,
"engines": {
"node": "^8.9.1"
From b639cc7bda54495d85daf6fcd2ea23ceb31168dc Mon Sep 17 00:00:00 2001
From: igloosi
Date: Tue, 16 Oct 2018 10:56:11 +0100
Subject: [PATCH 015/112] Heroku review app config
Required config to enable review apps on Heroku
---
app.json | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 app.json
diff --git a/app.json b/app.json
new file mode 100644
index 0000000000..a85e811f33
--- /dev/null
+++ b/app.json
@@ -0,0 +1,21 @@
+{
+ "name": "govuk-prototype-kit",
+ "scripts": {},
+ "env": {
+ "USE_AUTH": {
+ "required": true
+ }
+ },
+ "formation": {
+ "web": {
+ "quantity": 1
+ }
+ },
+ "addons": [],
+ "buildpacks": [
+ {
+ "url": "heroku/nodejs"
+ }
+ ]
+ }
+
\ No newline at end of file
From 31e4cdf54730875a8a1a1684774a12342e356f2e Mon Sep 17 00:00:00 2001
From: Deniz Genc
Date: Fri, 26 Oct 2018 15:26:45 +0100
Subject: [PATCH 016/112] Fixed path for page templates in
tutorials-and-examples
The site referred to docs/views/examples, which was incorrect.
---
docs/views/tutorials-and-examples.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/views/tutorials-and-examples.html b/docs/views/tutorials-and-examples.html
index 9ba5c5bf73..10c515beab 100644
--- a/docs/views/tutorials-and-examples.html
+++ b/docs/views/tutorials-and-examples.html
@@ -122,7 +122,7 @@
Page templates
Use these as the basis for your prototypes. We recommend making copies of the files rather than directly editing them.
- You can find them in your prototype folder, in /docs/views/examples
+ You can find them in your prototype folder, in /docs/views/templates
From a54a9d8f3556f1ba6fa2f41426fbd1abae0442c8 Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Thu, 2 Aug 2018 09:41:43 +0100
Subject: [PATCH 017/112] Add first draft of Notify integration guidance
Adapted from: https://gist.github.com/quis/1136d255a5cdc47f4b72bc5bf234cf97
---
docs/documentation/using-notify.md | 48 ++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 docs/documentation/using-notify.md
diff --git a/docs/documentation/using-notify.md b/docs/documentation/using-notify.md
new file mode 100644
index 0000000000..77147c2169
--- /dev/null
+++ b/docs/documentation/using-notify.md
@@ -0,0 +1,48 @@
+To set it locally, run this command in your Terminal, in the root
+folder of your prototype:
+```shell
+ echo NOTIFYAPIKEY=xxxxxxx >> .env
+````
+(where xxxxxxx is a key you’ve created in Notify). This creates a file
+named `.env` which contains your API key.
+
+To set it on Heroku, go to the settings page on your app, click
+‘reveal config vars’ and enter NOTIFYAPIKEY and the value of the key
+in the two boxes.
+
+Add this code to the top of routes.js:
+```javascript
+var NotifyClient = require('notifications-node-client').NotifyClient,
+ notify = new NotifyClient(process.env.NOTIFYAPIKEY);
+```
+
+`process.env.NOTIFYAPIKEY` is a special kind of variable that Node
+pulls from the environment your prototype is running in.
+
+***
+
+Make a page to collect the phone number or email address. This page
+needs a textbox called 'email', to match req.body.email below, eg
+
+
+You can change it to something else, eg `phoneNumber`, but you need to
+change it in the code below as well.
+
+This code goes at the bottom of routes.js:
+
+```javascript
+router.post('/page-with-email-or-phone-input', function (req, res) {
+
+ notify.sendEmail(
+ // this long string is the template ID, get it from Notify
+ '24a8b897-2de9-4a9f-a2db-b6ef682f799a',
+ req.body.email,
+ {}
+ );
+
+ // This URL can wherever you want to send people to after the
+ // emailhas been sent
+ res.redirect('/confirmation-page');
+
+});
+```
From 8102a2d3916db43dd03de001cd46040774736b01 Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Fri, 28 Sep 2018 10:47:31 +0100
Subject: [PATCH 018/112] Rewrite instructions to add more context
The previous instructions were a very bare-bones draft which assumed a
lot of context.
This commit attempts to rewrite them for someone without knowledge of
what Notify is, or how an API works.
Hopefully this is enough so that someone who is confident using the
prototype kit can integrate their prototype with Notify.
---
docs/documentation/using-notify.md | 130 ++++++++++++++++++++++++-----
1 file changed, 109 insertions(+), 21 deletions(-)
diff --git a/docs/documentation/using-notify.md b/docs/documentation/using-notify.md
index 77147c2169..313b408dfe 100644
--- a/docs/documentation/using-notify.md
+++ b/docs/documentation/using-notify.md
@@ -1,16 +1,68 @@
-To set it locally, run this command in your Terminal, in the root
-folder of your prototype:
+# Using GOV.UK Notify to prototype emails and text messages
+
+You can use GOV.UK Notify to send text messages or emails when users
+interact with your prototype. For example you could send users a
+confirmation email sent at the end of a journey.
+
+## Sign up for a GOV.UK Notify account
+
+If you have a government email address you can sign up for an account at
+https://www.gov.uk/notify
+
+You need an account before you can use GOV.UK Notify to send text
+messages or emails.
+
+## Getting an API key
+
+An API key is like a password that lets your prototype talk to Notify.
+Your prototype sends this key every time it asks Notify to do something.
+
+To get a key:
+- sign into GOV.UK Notify
+- go to the ‘API integration’ page
+- click ‘API keys’
+- click the ‘Create an API’ button
+- choose the ‘Team and whitelist’ option
+- copy the key to your clipboard
+
+### Saving your key on your computer
+
+This will let your prototype talk to Notify while it’s running on your
+computer.
+
+To save the key on your computer, run this command in your Terminal, in
+the root folder of your prototype (where xxxxxxx is a key you’ve copied
+from Notify):
```shell
echo NOTIFYAPIKEY=xxxxxxx >> .env
````
-(where xxxxxxx is a key you’ve created in Notify). This creates a file
-named `.env` which contains your API key.
+This adds the API key to the end of your `.env` file. Your prototype
+will load the key from your `.env` file.
+
+### Saving the key on Heroku
+
+This will let your prototype talk to Notify while it’s running on
+Heroku.
+
+To save the key on Heroku, go to the settings page of your app, click
+‘Reveal config vars’ and fill in the two textboxes like this (where
+xxxxxxx is the key you’ve copied from Notify):
+
+KEY | VALUE
+---------------|----------
+`NOTIFYAPIKEY` | `xxxxxxx`
-To set it on Heroku, go to the settings page on your app, click
-‘reveal config vars’ and enter NOTIFYAPIKEY and the value of the key
-in the two boxes.
+### Keeping your key safe
+
+It’s really important that you keep your key secret. If you put it in
+the `.env` file it’s safe – that file isn’t published on Github. If you
+do accidentally publish your key somewhere you must sign into Notify and
+revoke it.
+
+## Add the Notify code to your prototype
Add this code to the top of routes.js:
+
```javascript
var NotifyClient = require('notifications-node-client').NotifyClient,
notify = new NotifyClient(process.env.NOTIFYAPIKEY);
@@ -19,30 +71,66 @@ var NotifyClient = require('notifications-node-client').NotifyClient,
`process.env.NOTIFYAPIKEY` is a special kind of variable that Node
pulls from the environment your prototype is running in.
-***
+## Sending your first email
+
+Make a page with a form to collect the user’s email address. For
+example:
+```
+{% from "input/macro.njk" import govukInput %}
+
+
+```
+
+Save this page as `email-address-page.html`.
-This code goes at the bottom of routes.js:
+Then add this code at the bottom of routes.js:
```javascript
-router.post('/page-with-email-or-phone-input', function (req, res) {
+// The URL here needs to match the URL of the page that the user is on
+// when they type in their email address
+router.post('/email-address-page', function (req, res) {
notify.sendEmail(
- // this long string is the template ID, get it from Notify
- '24a8b897-2de9-4a9f-a2db-b6ef682f799a',
- req.body.email,
- {}
+ // this long string is the template ID, copy it from the template
+ // page in GOV.UK Notify. It’s not a secret so it’s fine to put it
+ // in your code.
+ 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
+ // `emailAddress` here needs to match the name of the form field in
+ // your HTML page
+ req.body.emailAddress
);
- // This URL can wherever you want to send people to after the
- // emailhas been sent
+ // This is the URL the users will be redirected to once the email
+ // has been sent
res.redirect('/confirmation-page');
});
```
+
+### Testing it out
+
+Now when you type your email address into the page and press the green
+button you should get an email. You should also be able to see the email
+you’ve sent on the GOV.UK Notify dashboard.
+
+Because your account is in trial mode you’ll only be able to send emails
+to yourself. If you’re doing user research you can add the participants
+email addresses to the ‘whitelist’ in GOV.UK Notify. This will let you
+send them emails too. You’ll need to collect their email addresses and
+get consent to use them before doing your research.
+
+## More things you can do with GOV.UK Notify
+
+The complete documentation for using the GOV.UK Notify API is here: https://github.com/alphagov/notifications-node-client#govuk-notify-nodejs-client
From 7900a7afc1513c45856511cff965c19a3df87c17 Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Thu, 4 Oct 2018 09:51:40 +0100
Subject: [PATCH 019/112] Remove duplicate send/sent
---
docs/documentation/using-notify.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/documentation/using-notify.md b/docs/documentation/using-notify.md
index 313b408dfe..652fbc80c9 100644
--- a/docs/documentation/using-notify.md
+++ b/docs/documentation/using-notify.md
@@ -2,7 +2,7 @@
You can use GOV.UK Notify to send text messages or emails when users
interact with your prototype. For example you could send users a
-confirmation email sent at the end of a journey.
+confirmation email at the end of a journey.
## Sign up for a GOV.UK Notify account
From f0a0601e9724ef81508b8074d6bceaac519a9a27 Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Thu, 4 Oct 2018 10:01:28 +0100
Subject: [PATCH 020/112] Remove use of shell redirection to save key
---
docs/documentation/using-notify.md | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/docs/documentation/using-notify.md b/docs/documentation/using-notify.md
index 652fbc80c9..d40ea0523d 100644
--- a/docs/documentation/using-notify.md
+++ b/docs/documentation/using-notify.md
@@ -30,14 +30,15 @@ To get a key:
This will let your prototype talk to Notify while it’s running on your
computer.
-To save the key on your computer, run this command in your Terminal, in
-the root folder of your prototype (where xxxxxxx is a key you’ve copied
-from Notify):
+To save the key on your computer, add this line to the end of the `.env`
+file in your prototype (where `xxxxxxx` is the key you’ve copied from
+Notify):
```shell
- echo NOTIFYAPIKEY=xxxxxxx >> .env
+ NOTIFYAPIKEY=xxxxxxx
````
-This adds the API key to the end of your `.env` file. Your prototype
-will load the key from your `.env` file.
+Your prototype will load the key from your `.env` file. If you don’t
+have a `.env` file then run your prototype (with the `npm start`
+command) and it will create one for you.
### Saving the key on Heroku
From c5d8516adb796bc5739c72543ff69688f5d8875e Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Thu, 4 Oct 2018 10:01:51 +0100
Subject: [PATCH 021/112] Capitalise GitHub
---
docs/documentation/using-notify.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/documentation/using-notify.md b/docs/documentation/using-notify.md
index d40ea0523d..080e62ada2 100644
--- a/docs/documentation/using-notify.md
+++ b/docs/documentation/using-notify.md
@@ -56,7 +56,7 @@ KEY | VALUE
### Keeping your key safe
It’s really important that you keep your key secret. If you put it in
-the `.env` file it’s safe – that file isn’t published on Github. If you
+the `.env` file it’s safe – that file isn’t published on GitHub. If you
do accidentally publish your key somewhere you must sign into Notify and
revoke it.
From eac9a31d366c970ad7eef2a8bd2e78ddb731d065 Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Thu, 4 Oct 2018 10:02:22 +0100
Subject: [PATCH 022/112] Remove unneeded explanation of variable
---
docs/documentation/using-notify.md | 3 ---
1 file changed, 3 deletions(-)
diff --git a/docs/documentation/using-notify.md b/docs/documentation/using-notify.md
index 080e62ada2..099a7733d4 100644
--- a/docs/documentation/using-notify.md
+++ b/docs/documentation/using-notify.md
@@ -69,9 +69,6 @@ var NotifyClient = require('notifications-node-client').NotifyClient,
notify = new NotifyClient(process.env.NOTIFYAPIKEY);
```
-`process.env.NOTIFYAPIKEY` is a special kind of variable that Node
-pulls from the environment your prototype is running in.
-
## Sending your first email
Make a page with a form to collect the user’s email address. For
From 531f95d98ca226da98df24638c79d86e1eed72f3 Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Thu, 4 Oct 2018 10:10:12 +0100
Subject: [PATCH 023/112] Use HTML not macro for form example
---
docs/documentation/using-notify.md | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/docs/documentation/using-notify.md b/docs/documentation/using-notify.md
index 099a7733d4..2f261fbcc5 100644
--- a/docs/documentation/using-notify.md
+++ b/docs/documentation/using-notify.md
@@ -74,21 +74,27 @@ var NotifyClient = require('notifications-node-client').NotifyClient,
Make a page with a form to collect the user’s email address. For
example:
```
-{% from "input/macro.njk" import govukInput %}
+{% extends "layout.html" %}
-