Skip to content

Commit 364179c

Browse files
Initial commit
0 parents  commit 364179c

18 files changed

+4002
-0
lines changed

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Node.js ignores
2+
node_modules/
3+
4+
# Prototype ignores - per-user
5+
.tmp/
6+
.env
7+
migrate.log
8+
usage-data-config.json
9+
10+
# General ignores
11+
.DS_Store
12+
.idea

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
audit=false

HOW-TO-GUIDES.MD

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
You can find all the tutorials and guides for using the GOVUK Prototype kit here
2+
https://prototype-kit.service.gov.uk/docs/tutorials-and-guides
3+
4+
5+
Commonly used guides
6+
7+
How to create pages from templates
8+
https://prototype-kit.service.gov.uk/docs/make-first-prototype/create-pages-from-templates
9+
10+
How to use components from the Design System
11+
https://prototype-kit.service.gov.uk/docs/make-first-prototype/use-components
12+
13+
How to Pass data from page to page
14+
https://prototype-kit.service.gov.uk/docs/pass-data
15+
16+
How to use layouts
17+
https://prototype-kit.service.gov.uk/docs/how-to-use-layouts
18+
19+
How to install and use plugins
20+
https://prototype-kit.service.gov.uk/docs/install-and-use-plugins
21+
22+
How to change the content within a page based on a user's answers
23+
https://prototype-kit.service.gov.uk/docs/conditional-content
24+
25+
How to show the user’s answers on the ‘Check answers’ page
26+
https://prototype-kit.service.gov.uk/docs/make-first-prototype/show-users-answers

LICENCE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (C) 2014 Crown Copyright (Government Digital Service)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9+
of the Software, and to permit persons to whom the Software is furnished to do
10+
so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Use this template to create new prototypes in DWP. This template is updated with every major version release of the GOVUK prototype kit.
2+
3+
Support
4+
5+
If you've got a question, idea or suggestion about the GOVUK protoype kit, get in touch with the GOV.UK Prototype team.
6+
7+
The GOV.UK Prototype team provides support to people who use the Prototype Kit and work in government.
8+
9+
We cannot give general advice to the public. We do not have access to information about you held by government departments.
10+
11+
For other enquiries, use the contact form on GOV.UK.
12+
13+
Slack
14+
15+
Use the #govuk-prototype-kit channel on cross-government Slack.
16+
17+
Email
18+
19+
Email the GOV.UK Prototype team at govuk-prototype-kit-support@digital.cabinet-office.gov.uk.

app/assets/javascripts/application.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//
2+
// For guidance on how to add JavaScript see:
3+
// https://prototype-kit.service.gov.uk/docs/adding-css-javascript-and-images
4+
//
5+
6+
window.GOVUKPrototypeKit.documentReady(() => {
7+
// Add JavaScript here
8+
})

app/assets/sass/application.scss

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//
2+
// For guidance on how to add CSS and SCSS see:
3+
// https://prototype-kit.service.gov.uk/docs/adding-css-javascript-and-images
4+
//
5+
6+
// Add extra styles here

app/config.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"serviceName": "Service name goes here"
3+
}

app/data/session-data-defaults.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
3+
// Insert values here
4+
5+
}

app/filters.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//
2+
// For guidance on how to create filters see:
3+
// https://prototype-kit.service.gov.uk/docs/filters
4+
//
5+
6+
const govukPrototypeKit = require('govuk-prototype-kit')
7+
const addFilter = govukPrototypeKit.views.addFilter
8+
9+
// Add your filters here

app/routes.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//
2+
// For guidance on how to create routes see:
3+
// https://prototype-kit.service.gov.uk/docs/create-routes
4+
//
5+
6+
const govukPrototypeKit = require('govuk-prototype-kit')
7+
const router = govukPrototypeKit.requests.setupRouter()
8+
9+
// Find an address plugin
10+
const findAddressPlugin = require("find-an-address-plugin");
11+
12+
findAddressPlugin(router);
13+
14+
// Logging session data
15+
// This code shows in the terminal what session data has been saved.
16+
router.use((req, res, next) => {
17+
const log = {
18+
method: req.method,
19+
url: req.originalUrl,
20+
data: req.session.data
21+
}
22+
console.log(JSON.stringify(log, null, 2))
23+
24+
next()
25+
})
26+
27+
// This code shows in the terminal what page you are on and what the previous page was.
28+
router.use('/', (req, res, next) => {
29+
res.locals.currentURL = req.originalUrl; //current screen
30+
res.locals.prevURL = req.get('Referrer'); // previous screen
31+
32+
console.log('folder : ' + res.locals.folder + ', subfolder : ' + res.locals.subfolder );
33+
34+
next();
35+
});
36+
37+
// Routing for the example journey.
38+
router.post('/country-answer', function(request, response) {
39+
40+
var country = request.session.data['country']
41+
if (country == "England"){
42+
response.redirect("example/complete")
43+
} else {
44+
response.redirect("example/ineligible")
45+
}
46+
})
47+
48+
49+
// Add your routes here

app/views/example/complete.html

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{% extends "layouts/main.html" %}
2+
3+
{% block pageTitle %}
4+
Confirmation page template – {{ serviceName }} – GOV.UK Prototype Kit
5+
{% endblock %}
6+
7+
{% block content %}
8+
9+
<div class="govuk-grid-row">
10+
<div class="govuk-grid-column-two-thirds">
11+
12+
{{ govukPanel({
13+
titleText: "Application complete",
14+
html: "Your reference number<br><strong>HDJ2123F</strong>"
15+
}) }}
16+
17+
<p>
18+
We have sent you a confirmation email.
19+
</p>
20+
21+
<h2 class="govuk-heading-m">
22+
What happens next
23+
</h2>
24+
25+
<p>
26+
We've sent your application to Hackney Electoral Register Office.
27+
</p>
28+
29+
<p>
30+
They will contact you either to confirm your registration, or to ask for more information.
31+
</p>
32+
<p>
33+
<a href="#">
34+
What did you think of this service?
35+
</a> (takes 30 seconds)
36+
</p>
37+
38+
39+
</div>
40+
</div>
41+
42+
{% endblock %}

app/views/example/ineligible.html

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% extends "layouts/main.html" %}
2+
3+
{% block pageTitle %}
4+
GOV.UK page template – {{ serviceName }} – GOV.UK Prototype Kit
5+
{% endblock %}
6+
7+
{% block content %}
8+
9+
10+
{% endblock %}
+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{% extends "layouts/main.html" %}
2+
3+
{% block pageTitle %}
4+
GOV.UK page template – {{ serviceName }} – GOV.UK Prototype Kit
5+
{% endblock %}
6+
7+
{% block content %}
8+
9+
{% from "govuk/components/back-link/macro.njk" import govukBackLink %}
10+
{% from "govuk/components/radios/macro.njk" import govukRadios %}
11+
{% from "govuk/components/button/macro.njk" import govukButton %}
12+
13+
{% block beforeContent %}
14+
15+
{% endblock %}
16+
17+
18+
<div class="govuk-grid-row">
19+
<div class="govuk-grid-column-two-thirds">
20+
<form class="form" action="/country-answer" method="post">
21+
22+
{{ govukRadios({
23+
name: "country",
24+
value: data['country'],
25+
fieldset: {
26+
legend: {
27+
text: "Where do you live?",
28+
isPageHeading: true,
29+
classes: "govuk-fieldset__legend--l"
30+
}
31+
},
32+
items: [
33+
{
34+
value: "England",
35+
text: "England"
36+
},
37+
{
38+
value: "Scotland",
39+
text: "Scotland"
40+
},
41+
{
42+
value: "Wales",
43+
text: "Wales"
44+
},
45+
{
46+
value: "Northern Ireland",
47+
text: "Northern Ireland"
48+
}
49+
]
50+
}) }}
51+
52+
{{ govukButton({
53+
text: "Continue"
54+
}) }}
55+
56+
</form>
57+
</div>
58+
</div>
59+
{% endblock %}
60+

app/views/index.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{% extends "layouts/main.html" %}
2+
3+
{% set pageName="Home" %}
4+
5+
{% block content %}
6+
7+
<div class="govuk-grid-row">
8+
<div class="govuk-grid-column-two-thirds">
9+
10+
{% include "govuk-prototype-kit/includes/homepage-top.njk" %}
11+
12+
<h1 class="govuk-heading-xl">
13+
{{ serviceName }}
14+
</h1>
15+
16+
17+
{{ govukButton({
18+
text: "Continue",
19+
href: "example/where-do-you-live"
20+
}) }}
21+
{% include "govuk-prototype-kit/includes/homepage-bottom.njk" %}
22+
</div>
23+
</div>
24+
25+
{% endblock %}

app/views/layouts/main.html

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{#
2+
For guidance on how to use layouts see:
3+
https://prototype-kit.service.gov.uk/docs/how-to-use-layouts
4+
#}
5+
6+
{% extends "govuk-prototype-kit/layouts/govuk-branded.njk" %}

0 commit comments

Comments
 (0)