diff --git a/app/assets/images/tutorial-overview.png b/app/assets/images/tutorial-overview.png new file mode 100644 index 00000000..02ae2f83 Binary files /dev/null and b/app/assets/images/tutorial-overview.png differ diff --git a/app/assets/images/tutorial-radios.png b/app/assets/images/tutorial-radios.png new file mode 100644 index 00000000..b131c009 Binary files /dev/null and b/app/assets/images/tutorial-radios.png differ diff --git a/app/assets/images/tutorial-textarea.png b/app/assets/images/tutorial-textarea.png new file mode 100644 index 00000000..6ad58834 Binary files /dev/null and b/app/assets/images/tutorial-textarea.png differ diff --git a/app/config.js b/app/config.js index 297480ca..cfff0f6b 100644 --- a/app/config.js +++ b/app/config.js @@ -3,7 +3,6 @@ module.exports = { // Service name serviceName: 'Prototype kit', - // Port to run nodemon on locally port: 2000, diff --git a/app/views/base/check-your-answers.html b/app/views/base/check-your-answers.html new file mode 100755 index 00000000..608f72e7 --- /dev/null +++ b/app/views/base/check-your-answers.html @@ -0,0 +1,162 @@ +{% extends 'layout.html' %} + +{% set mainClasses = "nhsuk-main-wrapper--s" %} + +{% block pageTitle %} + Check your answers template - NHS.UK prototype kit +{% endblock %} + +{% block beforeContent %} + {{ backLink({ + "href": "/templates/start-page", + "text": "Back" + }) }} +{% endblock %} + +{% block content %} +
+
+ +

+ Check your answers before sending your application +

+ +

+ Personal details +

+ + {{ summaryList({ + rows: [ + { + key: { + text: "NHS number" + }, + value: { + text: "485 777 3456" + }, + actions: { + items: [ + { + href: "#", + text: "Change", + visuallyHiddenText: "NHS number" + } + ] + } + }, + { + key: { + text: "Name" + }, + value: { + text: "Kevin Francis" + }, + actions: { + items: [ + { + href: "#", + text: "Change", + visuallyHiddenText: "name" + } + ] + } + }, + { + key: { + text: "Date of birth" + }, + value: { + html: "15 March 1984" + }, + actions: { + items: [ + { + href: "#", + text: "Change", + visuallyHiddenText: "date of birth" + } + ] + } + }, + { + key: { + text: "Home address" + }, + value: { + html: '8 Bridgewater Place
Leeds
LS11 5BZ' + }, + actions: { + items: [ + { + href: "#", + text: "Change", + visuallyHiddenText: "home address" + } + ] + } + } + ] + }) }} + +

+ Medical details +

+ + {{ summaryList({ + rows: [ + { + key: { + text: "Allergies" + }, + value: { + text: "No allergies" + }, + actions: { + items: [ + { + href: "#", + text: "Change", + visuallyHiddenText: "allergies" + } + ] + } + }, + { + key: { + text: "Conditions" + }, + value: { + html: "Asthma
Disabilities, including physical and learning disabilities" + }, + actions: { + items: [ + { + href: "#", + text: "Change", + visuallyHiddenText: "conditions" + } + ] + } + } + ] + }) }} + +

+ Now send your application +

+ +

+ By submitting this notification you are confirming that, to the best of your knowledge, the details you are providing are correct. +

+ +

+ Your details with be sent to Rose Medical Practice to begin your registration. +

+ + + Accept and send registration + + +
+
+{% endblock %} diff --git a/app/views/base/confirmation-page.html b/app/views/base/confirmation-page.html new file mode 100755 index 00000000..7533080e --- /dev/null +++ b/app/views/base/confirmation-page.html @@ -0,0 +1,39 @@ +{% extends 'layout.html' %} + +{% block pageTitle %} + Confirmation page template - NHS.UK prototype kit +{% endblock %} + +{% block content %} +
+
+ +
+ +
+ +

+ Application complete +

+ +

+ Your reference number +
+ HDJ2123F +

+ +
+ +
+ +

We have sent you a confirmation email.

+ +

What happens next

+ +

Tell the user what happens next.

+ +

Go back to page templates.

+ +
+
+{% endblock %} diff --git a/app/views/base/content-page.html b/app/views/base/content-page.html new file mode 100755 index 00000000..4591186c --- /dev/null +++ b/app/views/base/content-page.html @@ -0,0 +1,32 @@ +{% extends 'layout.html' %} + +{% block pageTitle %} + Content page template - NHS.UK prototype kit +{% endblock %} + +{% block beforeContent %} + {{ breadcrumb({ + href: "/", + text: "Home" + }) }} +{% endblock %} + +{% block content %} +
+ +
+ +

+ Page heading goes here +

+ +

+ Visit the + NHS digital service manual + for guidance and code examples. +

+ +
+ +
+{% endblock %} diff --git a/app/views/base/question-page.html b/app/views/base/question-page.html new file mode 100755 index 00000000..cbe79cde --- /dev/null +++ b/app/views/base/question-page.html @@ -0,0 +1,56 @@ +{% extends 'layout.html' %} + +{% set mainClasses = "nhsuk-main-wrapper--s" %} + +{% block pageTitle %} + Question page +{% endblock %} + +{% block beforeContent %} + {{ backLink({ + "href": "/templates/start-page", + "text": "Back" + }) }} +{% endblock %} + +{% block content %} +
+
+ +
+ + {{ radios({ + "idPrefix": "example", + "name": "example", + "fieldset": { + "legend": { + "text": "Heading or question goes here", + "classes": "nhsuk-fieldset__legend--l", + "isPageHeading": true + } + }, + "items": [ + { + "value": "yes", + "text": "Yes" + }, + { + "value": "no", + "text": "No" + } + ] + }) }} + + {{ button({ + "text": "Continue", + "id": "btn_submit" + }) }} + +

(See the NHS digital service manual for examples.)

+ +
+ +
+
+ +{% endblock %} diff --git a/app/views/base/start-page.html b/app/views/base/start-page.html new file mode 100755 index 00000000..60125460 --- /dev/null +++ b/app/views/base/start-page.html @@ -0,0 +1,44 @@ +{% extends 'layout.html' %} + +{% block pageTitle %} + Start page template - NHS.UK prototype kit +{% endblock %} + +{% block beforeContent %} +{{ breadcrumb({ + href: "/", + text: "Home" +}) }} +{% endblock %} + +{% block content %} +
+
+ +

+ Service name goes here +

+ +

Use this service to:

+ + + +

Registering takes around 5 minutes.

+ + +

Before you start

+ +

You can only use this service if you live in the UK.

+ + + Start now + + +
+ +
+{% endblock %} diff --git a/app/views/how-tos/build-basic-prototype/_BASE.njk b/app/views/how-tos/build-basic-prototype/_BASE.njk new file mode 100644 index 00000000..00734653 --- /dev/null +++ b/app/views/how-tos/build-basic-prototype/_BASE.njk @@ -0,0 +1,50 @@ +{% extends 'layout.html' %} +{% set sectionName = "Make a basic prototype" %} +{# list of URLS, titles and questions for reference - existing NHS templates are hardcoded but these are tokenised for ease of change #} + +{% set exampleServiceName = "Order a test to check if you have magical powers" %} +{% set exampleServiceURL = "magical-powers" %} +{% set exampleStart = { url: "start-page" } %} +{% set exampleRadios = { "url" : "magical-powers", "title" : "Have you felt symptoms of magical powers in the last 30 days?", "legend" : "magical-powers", "summary" : "Symptoms of magical powers" } %} +{% set exampleTextArea = { "url" : "details", "title" : "Tell us your symptoms of magical powers", legend: "details", "summary" : "Details of the symptoms" } %} +{% set exampleCheckAnswers = { url: "check-your-answers", title : "Check your answers" } %} +{% set exampleConfirmation = { url: "confirmation-page" } %} +{% set exampleIneligible = { url: "ineligible" } %} + +{% block pageTitle %} + {{ pageTitle | default("Add title with 'pageTitle'")}} - {{sectionName}} - NHS.UK prototype kit +{% endblock %} + +{% block beforeContent %} + {% include "how-tos/includes/breadcrumb.html" %} +{% endblock %} + +{% block content %} +
+ +
+ +{% if not noCaption %}{{sectionName}}{% endif %} +

+ {{ pageTitle | default("Add title with 'pageTitle'")}} +

+ +{% block makePrototype %} + +

Add text in makePrototype block

+{% endblock %} + +{{ pagination({ + previousUrl: prev.link if prev , + previousPage: prev.title if prev , + nextUrl: next.link if next , + nextPage: next.title if next +}) }} + + + {% include "how-tos/includes/back-button.html" %} + +
+ +
+{% endblock %} diff --git a/app/views/how-tos/build-basic-prototype/branching.html b/app/views/how-tos/build-basic-prototype/branching.html new file mode 100644 index 00000000..f9f5c850 --- /dev/null +++ b/app/views/how-tos/build-basic-prototype/branching.html @@ -0,0 +1,142 @@ +{% set pageTitle = "Show different pages depending on user input (branching)" %} +{% set next = { "title" : "Link your index page to your start page" , "link" : +"link-index-page-start-page" } %} {% set prev = { "title" : "Let the user change +their answers" , "link" : "let-user-change-answers" } %} {% extends +'how-tos/build-basic-prototype/_BASE.njk' %} {% block makePrototype %} + +

+ Our first question asks the user if they have had symptoms of magical powers + in the last 30 days. We’re going to send them to an ‘ineligible’ page if + answer anything other than yes. Sending users to different pages based on + their input is called branching. +

+

+ To do this, we’re going to need an + {{exampleIneligible.url}}.html page, and + some logic to decide when to send users there. +

+

+ This kind of logic goes in a file called + app/routes.js, which is written in + JavaScript. Routes tell the kit what to do when the user goes to specific + pages. +

+

+ The route takes the answer the user gave to the first question and either + sends them to the next question or the ineligible page, depending on their + answer. +

+

Create an ineligible page

+
    +
  1. +

    + Make an + {{exampleIneligible.url}}.html page + by copying content.html from + docs/views/templates to + app/views. +

    +
  2. +
  3. +

    + Update the content to tell the user why they’re ineligible and what they + can do next. +

    +
  4. +
+

+ To check it works, + go to http://localhost:3000/{{exampleIneligible.url}}. +

+

Create a route

+

+ We’re going to write some logic to process the user’s answer to question 1. If + the user has had magical symptoms in the last 30 days, we’ll send them to + question 2. If they answer with anything else, we’ll send them to the + ineligible page. +

+

+ Currently, the {{exampleRadios.url}} page + sends the user directly to question 2. Instead, we’re going to send them to a + special URL where we can run some code to check their answer. +

+
    +
  1. +

    + In {{exampleRadios.url}}.html change + the form action to + /{{exampleRadios.url}}-answer. +

    +
  2. +
  3. +

    Open /app/routes.js.

    +
  4. +
  5. +

    + Insert new JavaScript into line 5, before + module.exports = router. +

    +
  6. +
+
// Run this code when a form is submitted to '{{exampleRadios.url}}-answer'
+router.post('/{{exampleRadios.url}}-answer', function (req, res) {
+
+// Make a variable and give it the value from '{{exampleRadios.legend}}'
+var magicPowers = req.session.data['{{exampleRadios.legend}}']
+
+// Check whether the variable matches a condition
+if (magicPowers == "yes"){
+// Send user to next page
+res.redirect('/{{exampleTextArea.url}}')
+} else {
+// Send user to ineligible page
+res.redirect('/{{exampleIneligible.url}}')
+}
+
+})
+
+
    +
  1. + Check it works. Selecting ‘Yes’ should send you to the next question. Any + other answer should send you to the ineligible page. +
  2. +
+

If it does not work

+

+ If you do not get a page, check in the terminal to see if the kit has crashed. + This is a common problem if there’s a typo in the JavaScript. If so, the kit + will try to tell you the line number with the issue. +

+

If the kit crashes, you will see something like this on the terminal:

+
/Users/name/projects/{{exampleServiceURL}}-prototype/app/routes.js:12
+});
+^
+SyntaxError: Unexpected token }
+at Object.exports.runInThisContext (vm.js:76:16)
+at Module._compile (module.js:542:28)
+at Object.Module._extensions..js (module.js:579:10)
+at Module.load (module.js:487:32)
+at tryModuleLoad (module.js:446:12)
+at Function.Module._load (module.js:438:3)
+at Module.require (module.js:497:17)
+at require (internal/module.js:20:19)
+at Object.<anonymous> (/Users/[username]/projects/{{exampleServiceURL}}-prototype/server.js:7:14)
+at Module._compile (module.js:570:32)
+[14:11:50] [nodemon] app crashed - waiting for file changes before starting…
+
+

+ The first line of this sample output ends with + /app/routes.js:12. +

+

+ The '12' suggests there’s probably an issue on line 12 or the line before it. + In this case, the issue was a missing bracket. +

+ +{% endblock %} diff --git a/app/views/how-tos/build-basic-prototype/create-pages.html b/app/views/how-tos/build-basic-prototype/create-pages.html new file mode 100644 index 00000000..c4476beb --- /dev/null +++ b/app/views/how-tos/build-basic-prototype/create-pages.html @@ -0,0 +1,118 @@ +{% set pageTitle = "Create pages" %} {% set next = { "title" : "Link your pages +together" , "link" : "link-pages-together" } %} {% set prev = { "title" : "Open +your prototype in your editor" , "link" : "open-prototype-in-editor" } %} {% +extends 'how-tos/build-basic-prototype/_BASE.njk' %} {% block makePrototype %} + +

Create pages by copying template files that come with the Prototype Kit.

+

Create a start page

+

+ Copy the {{exampleStart.url}}.html file + from docs/views/templates to + app/views. +

+

+ Preview the pages in your prototype by going to + http://localhost:3000/NAME-OF-HTML-FILE in your web browser. For + example, + go to http://localhost:3000/{{exampleStart.url}} + to preview {{exampleStart.url}}.html. +

+

Change the service name

+

+ You'll normally edit the HTML to make changes to pages, but the service name + is in a config file. This is so we can change it in one place to update it on + every page in your prototype. +

+
    +
  1. + Open the config.js file in your + app folder. +
  2. +
  3. + Change serviceName from "Service name + goes here" to "{{exampleServiceName}}". +
  4. +
  5. + Press Cmd+S on Mac or Ctrl+S on Windows to + save your change. +
  6. +
+

+ You must save every time you make a change to a file. In most code editors, a + dot appears in the tab for any file that has unsaved changes. +

+

+ Normally your changes will automatically show in the browser without + refreshing. But for this config change, you need to refresh the page. You + should see your service name change on the Start page. +

+

Question pages

+

+ Make 2 copies of the + question-page.html file from + docs/views/templates to + app/views. +

+

Rename the 2 file copies to:

+ +

Go to the following URLs to check your pages:

+ +

+ In the {{exampleRadios.url}}.html file, + change the text inside the <h1> tag + from "Heading or question goes here" to "{{exampleRadios.title}}". +

+

+ In the {{exampleTextArea.url}}.html file, + change the text inside the <h1> tag + to "{{exampleTextArea.title}}". +

+

'Check answers' page

+

+ Copy the + {{exampleCheckAnswers.url}}.html file + from docs/views/templates to + app/views. +

+

+ Go to + http://localhost:3000/{{exampleCheckAnswers.url}} + to check. +

+ +

Confirmation page

+

+ Copy the + {{exampleConfirmation.url}}.html file + from docs/views/templates to + app/views. +

+

+ Go to + http://localhost:3000/{{exampleConfirmation.url}} + to check. +

+ +{% endblock %} diff --git a/app/views/how-tos/build-basic-prototype/index.html b/app/views/how-tos/build-basic-prototype/index.html new file mode 100644 index 00000000..2478a6ae --- /dev/null +++ b/app/views/how-tos/build-basic-prototype/index.html @@ -0,0 +1,58 @@ +{% set noCaption = true %} +{% set pageTitle = "Build a basic prototype using the NHS.UK prototype kit" %} + +{% extends 'how-tos/build-basic-prototype/_BASE.njk' %} + +{% block makePrototype %} + +

+This tutorial shows you how to prototype a fictional '{{exampleServiceName}}' service that will: +

+ +

+It will take about an hour to finish this tutorial, after you install the Prototype Kit. +

+ +

+Our prototype will look a bit like this: +

+ + +
+ +

The first page has the title 'Start page' with the button 'Start now'. This is linked to a second page with the title 'Question 1' and a 'Continue' button. This forks to 2 different pages. 1 is titled 'Ineligible'. 2 is titled Question 2. Question 2 is linked to a page titled 'Check answers'. This links to page 6, titled 'Complete'.

+
Diagram of 6 pages connected together.
+
+ + +

+Before you start +

+ +

+Before you start, you must install and run the NHS.UK prototype kit. +

+ +

+You'll also need a code editor. These two are popular, well established and fairly accessible: +

+ + + + + + Start now + + +{% endblock %} diff --git a/app/views/how-tos/build-basic-prototype/let-user-change-answers.html b/app/views/how-tos/build-basic-prototype/let-user-change-answers.html new file mode 100644 index 00000000..905d4a4d --- /dev/null +++ b/app/views/how-tos/build-basic-prototype/let-user-change-answers.html @@ -0,0 +1,112 @@ +{% set pageTitle = "Let the user change their answers" %} {% set next = { +"title" : "Show different pages depending on user input" , "link" : "branching" +} %} {% set prev = { "title" : "Show the user’s answers on your ‘Check answers’ +page" , "link" : "show-users-answers" } %} {% extends +'how-tos/build-basic-prototype/_BASE.njk' %} {% block makePrototype %} + +

+ Make the Change links on the ‘{{exampleCheckAnswers.title}}’ + page work by adding the right links. +

+
    +
  1. + In the <a> tag under + {{ data['how-many-balls'] }}, change + the href attribute from # to + /{{exampleRadios.url}} +
  2. +
  3. + In the <a> tag under + {{ data['most-impressive-trick'] }}, + change the href attribute from # to + /{{exampleTextArea.url}} +
  4. +
+

+ If you select a Change link, you’ll go back to the right + question page, but your answer will not appear yet. +

+

+ Show the user’s answer in question 1 +

+

+ Radios and checkboxes have a + checked option to set whether they are + selected (checked) or not when the page loads. +

+

+ Open the {{exampleRadios.url}}.html file + in your app/views folder. +

+

+ For each of the items, we’ll add a + checked value, like this: +

+
{
+  value: "yes",
+  text: "Yes",
+  checked: checked("magical-powers", "yes")
+},
+{
+  value: "no",
+  text: "No",
+  checked: checked("magical-powers", "no")
+  },
+  {
+  value: "not sure",
+  text: "I'm not sure",
+  checked: checked("magical-powers", "not sure")
+  },
+
+

+ In each case make sure the spelling is exactly the same as the + value. +

+

+ Go to http://localhost:3000/{{exampleRadios.url}} + and check the journey works by selecting an answer, continuing to the next + page, then going back. +

+

+ Show the user’s answer in question 2 +

+

+ Text inputs and textareas have a value to + set what text appears in them when the page loads. +

+

+ Open the + {{exampleTextArea.url}}.html file in your + app/views folder. +

+

+ Add + value: data['{{exampleRadios.legend}}'] + like this: +

+ +
{{
+   textarea({
+    name: "example",
+    id: "example",
+    label: {
+      text: "Tell us your symptoms of magical powers",
+      classes: "nhsuk-label--l",
+      isPageHeading: true
+    },
+    value: data['details']
+  }) 
+
+  }}
+ +

+ Go to http://localhost:3000/{{exampleTextArea.url}} + and check it works by filling in an answer, continuing to the next page, going + back, then refreshing your browser. +

+ +{% endblock %} diff --git a/app/views/how-tos/build-basic-prototype/link-index-page-start-page.html b/app/views/how-tos/build-basic-prototype/link-index-page-start-page.html new file mode 100644 index 00000000..6c0a6157 --- /dev/null +++ b/app/views/how-tos/build-basic-prototype/link-index-page-start-page.html @@ -0,0 +1,28 @@ +{% set pageTitle = "Link your index page to your start page" %} {% set prev = { +"title" : "Show different pages depending on user input" , "link" : "branching" +} %} {% extends 'how-tos/build-basic-prototype/_BASE.njk' %} {% block +makePrototype %} + +

+ You can route users from your service's index page to your start page. The + index page is the page that loads when users + go to http://localhost:3000. +

+
    +
  1. + Open the index.html file in your + app/views folder. +
  2. +
  3. + Add an <a> tag that links to + /{{exampleStart.url}}. +
  4. +
+

+ You can now find out + how to publish your prototype online, so you can share it with your team or do user research. +

+ +{% endblock %} diff --git a/app/views/how-tos/build-basic-prototype/link-pages-together.html b/app/views/how-tos/build-basic-prototype/link-pages-together.html new file mode 100644 index 00000000..00e56ead --- /dev/null +++ b/app/views/how-tos/build-basic-prototype/link-pages-together.html @@ -0,0 +1,109 @@ +{% set pageTitle = "Link your pages together" %} {% set next = { "title" : "Use +components from the Design System" , "link" : "use-components" } %} {% set prev += { "title" : "Create pages" , "link" : "create-pages" } %} {% extends +'how-tos/build-basic-prototype/_BASE.njk' %} {% block makePrototype %} + +
+

To take users from one page to another, you can use either:

+ + +
    +
  1. + Open start.html in your + app/views folder. +
  2. +
  3. + Find the <a> tag with 'Start + now' inside. +
  4. +
  5. + Change the value of the + href attribute from + # to + /{{exampleRadios.url}}. +
  6. +
+

+ Go to http://localhost:3000/{{exampleStart.url}} + and select the Start now button to check the link works. +

+

+ Links normally appear as text with underlines. We make + Start now look like a button to make it more obvious to + users. +

+ +
    +
  1. + Open {{exampleRadios.url}}.html in + your app/views folder. +
  2. +
  3. + Find the line + <form class="form" action="/url/of/next/page" + method="post">. +
  4. +
  5. + Change the value of the + action attribute from + /url/of/next/page to + /{{exampleTextArea.url}}. +
  6. +
+

+ Go to http://localhost:3000/{{exampleRadios.url}} + and select Continue to check the button works. +

+

+ This time it's a real HTML button, not a link. Buttons submit form data - + the URL is on the form tag, not the button. +

+ +
    +
  1. + Open {{exampleTextArea.url}}.html in + your app/views folder. +
  2. +
  3. + Find the line + <form class="form" action="/url/of/next/page" + method="post">. +
  4. +
  5. + Change the value of the + action attribute from + /url/of/next/page to + /{{exampleCheckAnswers.url}}. +
  6. +
+

+ Go to http://localhost:3000/{{exampleTextArea.url}} + and select Continue to check the button works. +

+

+ The 'Check answers' page template links to the ‘Confirmation’ page by + default. So you do not need to change the ‘Check answers’ page. +

+ + {% endblock %} +
diff --git a/app/views/how-tos/build-basic-prototype/open-prototype-in-editor.html b/app/views/how-tos/build-basic-prototype/open-prototype-in-editor.html new file mode 100644 index 00000000..cbd83137 --- /dev/null +++ b/app/views/how-tos/build-basic-prototype/open-prototype-in-editor.html @@ -0,0 +1,34 @@ +{% set pageTitle = "Open your prototype in your editor" %} +{% set next = { "title" : "Create pages" , "link" : "create-pages" } %} +{% set prev = { "title" : "Get started" , "link" : "index" } %} + +{% extends 'how-tos/build-basic-prototype/_BASE.njk' %} + +{% block makePrototype %} +

+ In your code editor open your prototype folder. You will see the files and + folders that you can edit in your prototype. +

+

Overview of folders in the Prototype Kit

+

+ /app is for your work. Inside that + folder: +

+ + +{% endblock %} diff --git a/app/views/how-tos/build-basic-prototype/show-users-answers.html b/app/views/how-tos/build-basic-prototype/show-users-answers.html new file mode 100644 index 00000000..f4554afd --- /dev/null +++ b/app/views/how-tos/build-basic-prototype/show-users-answers.html @@ -0,0 +1,186 @@ +{% set pageTitle = "Show the user’s answers on the ‘Check answers’ page" %} {% +set next = { "title" : "Let the user change their answers" , "link" : +"let-user-change-answers" } %} {% set prev = { "title" : "Add a textarea to +question 2" , "link" : "use-components-2" } %} {% extends +'how-tos/build-basic-prototype/_BASE.njk' %} {% block makePrototype %} + +

+ The Prototype Kit stores answers that users enter. This means you can make + more realistic prototypes, for example by showing answers for users to check. +

+

Show the answer to question 1

+
    +
  1. + Open + {{exampleCheckAnswers.url}}.html in + your app/views folder. +
  2. +
  3. + Find the <dt> tag that contains + the text 'NHS number'. +
  4. +
  5. Change 'NHS number' to '{{exampleRadios.summary}}'.
  6. +
  7. + In the <dd> tag on the next line, + change '485 777 3456' to + {{ data['{{exampleRadios.legend}}'] }}. +
  8. +
+

+ This is how we show data a user has entered – '{{exampleRadios.legend}}' is + the name attribute from the + <input> on the question page. +

+

Update the screen reader text – change this

+
<span class="govuk-visually-hidden"> name</span>
+
+

to

+
<span class="govuk-visually-hidden"> {{exampleRadios.summary | lower }}</span>
+
+

+ Screen readers will read this out but it will not appear on the page. Without + this hidden text, screen reader users would just hear “Change” and not know + what it’s for. +

+

Show the answer to question 2

+
    +
  1. + Find the <dt> tag that contains + the text 'Name'. +
  2. +
  3. Change 'Name' to '{{exampleTextArea.summary}}'.
  4. +
  5. + In the <dd> tag on the next line, + change 'Kevin Francis' to + {{ data['{{exampleTextArea.legend}}'] }}. +
  6. +
+

Change

+
<span class="govuk-visually-hidden"> name</span>
+
+

to

+
<span class="govuk-visually-hidden"> {{exampleTextArea.legend | lower}}</span>
+
+

+ Go to http://localhost:3000/{{exampleStart.url}} + and answer the questions to check your answers show up correctly. +

+

+ Delete the remaining example answers +

+

+ On the ‘Check answers’ template page, there are example answers that you do + not need. +

+
    +
  1. + Find and delete the whole + <div> that starts with + <div class="govuk-summary-list__row"> + and contains 'Contact information'. +
  2. +
  3. + Find and delete the whole + <div> that starts with + <div class="govuk-summary-list__row"> + and contains 'Contact details'. +
  4. +
  5. + Delete everything from the line that contains 'Medical details' down to the + line before 'Now send your application'. +
  6. +
+

Your code should now look like this:

+

+
+  {{ '
+
+ +

+ Check your answers before sending your application +

+ +

+ Personal details +

+ + {{ summaryList({ + rows: [ + { + key: { + text: "Magical power symptoms in the last 30 days" + }, + value: { + text: data["magical-powers"] + }, + actions: { + items: [ + { + href: "/magical-powers", + text: "Change", + visuallyHiddenText: "magical power symptoms in the last 30 days" + } + ] + } + }, + { + key: { + text: "Details of symptoms" + }, + value: { + text: data["details"] + }, + actions: { + items: [ + { + href: "/details", + text: "Change", + visuallyHiddenText: "details of symptoms" + } + ] + } + } + ] + }) }} + + +

+ Now send your application +

+ +

+ By submitting this notification you are confirming that, to the best of your knowledge, the details you are providing are correct. +

+ +

+ Your details with be sent to Rose Medical Practice to begin your registration. +

+ + + Accept and send registration + + +
+
' | escape }} + +
+ +{% endblock %} diff --git a/app/views/how-tos/build-basic-prototype/use-components-2.html b/app/views/how-tos/build-basic-prototype/use-components-2.html new file mode 100644 index 00000000..dcdea775 --- /dev/null +++ b/app/views/how-tos/build-basic-prototype/use-components-2.html @@ -0,0 +1,78 @@ +{% set pageTitle = "Add a textarea to question 2" %} {% set next = { "title" : +"Show the user’s answers on your ‘Check answers’ page" , "link" : +"show-users-answers" } %} {% set prev = { "title" : "Use components from the +Design System" , "link" : "use-components" } %} {% extends +'how-tos/build-basic-prototype/_BASE.njk' %} {% block makePrototype %} +
    +
  1. + Go to the + textarea page of the Design System. +
  2. +
  3. + Select the Nunjucks tab, then Copy code. +
  4. +
  5. + Open {{exampleRadios.url}}.html in your + app/views folder. +
  6. +
  7. + Replace the 2 example + <p>...</p> paragraphs with + the code you copied. +
  8. +
  9. + Delete the old <h1> tag with + "{{exampleTextArea.title}}" (again the example code comes with an accessible + heading for the question). +
  10. +
+ +

Customise the example code

+
    +
  1. + Under label, change + text from "Can you provide more + detail?" to "{{exampleTextArea.title}}". +
  2. +
  3. + Change the id and + name to + {{exampleTextArea.legend}}. +
  4. +
  5. We don’t need a hint, so remove it and the comma just before it.
  6. +
  7. + We also want to make the page a title, so in the + label area add + classes: "nhsuk-label--l", and + isPageHeading: true +
  8. +
+ +

Your component code should now look like this:

+ +
{{ textarea({
+name: "{{exampleTextArea.legend}}",
+id: "{{exampleTextArea.legend}}",
+label: {
+  text: "{{exampleTextArea.title}}",
+  classes: "nhsuk-label--l",
+  isPageHeading: true
+}
+}) }}
+

Your page should now look like this:

+
+

+ Web page with the heading "{{exampleTextArea.title}}", a textarea and continue button +

+
+ Screenshot of how your prototype should look. +
+
+ +{% endblock %} diff --git a/app/views/how-tos/build-basic-prototype/use-components.html b/app/views/how-tos/build-basic-prototype/use-components.html new file mode 100644 index 00000000..21384d2b --- /dev/null +++ b/app/views/how-tos/build-basic-prototype/use-components.html @@ -0,0 +1,117 @@ +{% set pageTitle = "Use components from the Design System" %} {% set next = { +"title" : "Add a textarea to question 2" , "link" : "use-components-2" } %} {% +set prev = { "title" : "Link your pages together" , "link" : +"link-pages-together" } %} {% extends 'how-tos/build-basic-prototype/_BASE.njk' +%} {% block makePrototype %} + +

+ You can copy example code from the NHS Design System to add page elements like + radios and text inputs - we call these ‘components’. +

+

HTML and Nunjucks

+

HTML is the language used to create web pages.

+

+ Nunjucks is another language we can run in the Prototype Kit, to make HTML for + us. Short, simple Nunjucks code can create much longer, more complex HTML. +

+

+ In the Design System, components have both Nunjucks and HTML example code. + Either will work in the Prototype Kit. +

+

Add radios to question 1

+
    +
  1. + Go to the + radios component in the Design System. +
  2. +
  3. + Select the Nunjucks tab under the third example, then + Copy code. +
  4. +
  5. + Open {{exampleRadios.url}}.html in your + app/views folder. +
  6. +
  7. + Replace the 2 example + <p>...</p> paragraphs with + the code you copied. +
  8. +
  9. + The example comes with a heading that is connected to the answers for + accessibility, so delete the old + <h1> tag with + "{{exampleRadios.title}}". +
  10. +
+

Customise the example code

+
    +
  1. + Under legend, change + text from "Do you know your NHS + number?" to "{{exampleRadios.title}}". +
  2. +
  3. + Change name to + {{exampleRadios.legend}}. +
  4. +
  5. + Delete the + {% set hint %} code. +
  6. +
  7. + In the hint: { html: area replace + hintHtml and add "For example, things moving when you have strong feelings or hearing + someone’s thoughts.". +
  8. +
+

Your component code should now look like this:

+ +
{{ radios({
+  idPrefix: "{{exampleRadios.legend}}",
+  name: "{{exampleRadios.legend}}",
+  fieldset: {
+    legend: {
+    text: "{{exampleRadios.title}}",
+      classes: "nhsuk-fieldset__legend--l",
+      isPageHeading: true
+    }
+  },
+  hint: {
+    html: "For example, things moving when you have strong feelings or hearing someone’s thoughts."
+  },
+  items: [
+   {
+    value: "yes",
+    text: "Yes"
+    },
+    {
+      value: "no",
+      text: "No"
+    },
+    {
+      value: "not sure",
+      text: "I'm not sure"
+    }
+  ]
+}) }}
+ +

Your page should now look like this:

+
+

+ Web page with the heading "Have you had symptoms of magical power in the last 30 days?", 3 radios and a continue button +

+
+ Screenshot of how your prototype should look. +
+
+ +{% endblock %} diff --git a/app/views/how-tos/index.html b/app/views/how-tos/index.html index cc413a83..d226cbbe 100755 --- a/app/views/how-tos/index.html +++ b/app/views/how-tos/index.html @@ -20,6 +20,40 @@

How to guides

These guides will show you how to use the prototype kit, from creating a simple page to building complex user journeys.

+

Build a basic prototype

+ + +

Learn the basics

{{ backLink({ "href": "/", diff --git a/app/views/install/check-it-works.html b/app/views/install/check-it-works.html index 0c6535c8..2360ef8c 100644 --- a/app/views/install/check-it-works.html +++ b/app/views/install/check-it-works.html @@ -60,9 +60,7 @@

Installation complete

The kit is now installed. Congratulations!

Getting going

-

Start making pages

- {% block pagination %} {% endblock %}