Skip to content

Commit

Permalink
Upgrade kit (#11)
Browse files Browse the repository at this point in the history
* adds addtional step for users to run npm install post updating via git

* Replace encrypted GitHub token

This updates the environment variable in the config to enable
deployment via Travis CI.

* change node version from 4 to 6

* Setting up a very simple test suite to check the server and build tasks run across nodejs 4, 5 & 6

* make mocha exit properly

* As npm test runs gulp test, remove this from travis.yml

* Simplify the sanity test check

App doesn't need to listen in the test script as supertest accepts the
app variable and handles the listening and un-listening itself.

This also removes the needs for the after block to stop the server.

* moved devdependencies to fix heroku

* Update govuk-elements-sass to 2.2.0

This release includes the custom radio button and checkbox styles.

https://github.com/alphagov/govuk_elements/blob/master/CHANGELOG.md#220

* Update readme to point to docs app

* Remove console log for the file path

This can be seen when viewing the docs app locally.

* v5.0.0

* Update govuk_frontend_toolkit to 5.0.1

https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit/master
/CHANGELOG.md

# 5.0.1

- Fix role="button" click shim ([PR
#347](alphagov/govuk_frontend_toolkit#347))
- Make font variables lowercase ([PR
#348](alphagov/govuk_frontend_toolkit#348))
- Update selection button documentation ([PR
#350](alphagov/govuk_frontend_toolkit#350))

* Use new font stack reference for unbranded templates

govuk_frontend_toolkit v5.0.1 lowercases the font stack names.

* google analytics

* only add google analytics in promomode

* Move analytics to separate include and use env variable

* Update ‘Back’ link URL

* Bump govuk-elements-sass to 2.2.1

This makes the phase tag in the phase banner $govuk-blue.

As the phase banner is now the same for both alpha and beta banners,
change the phase banner includes to use the recommended class
.phase-banner.

* Set travis to update the latest release branch after deployment

It looks like Travis is deploying the latest-release branch to Heroku.

Let’s move the script that checks for a version tag to after_deploy, in
the hope that it won’t affect the deployment of master to Heroku on a
successful build.

* Fix the "back" link to tutorials and examples

* Bump govuk template to 0.19.2

# 0.19.2

- Increase skiplink colour contrast ([PR
#263](alphagov/govuk_template#263))

# 0.19.1

- Have focus outline appear outside of element rather than covering it
in Safari and Chrome ([PR
#259](alphagov/govuk_template#259))

* Bump standard to current version

And fix reported issues: just spacing.

* Bump toolkit and nunjucks to latest versions

* Remove some unused packages

- consolidate was added to help replace mu2 for mustache rendering
- hogan.js was also in there for mustache rendering

* v5.0.1

- #330 Update GOV.UK toolkit and StandardJS to latest
- #328 Update GOV.UK template to latest
- #324 Fix the example question page’s back link

* use app.locals instead of app.use

* add git step to heroku guide

* Remove full stops from headings

* fix css sourcemaps

* Remove the title attribute

To match the change made to GOV.UK elements: alphagov/govuk_elements#389

* removing links to route.js and update path and file names in branching.html

* Prevent asking users to authenticate twice

This solves the problem with prototypes asking for username/password
twice.

The problem is caused by the ordering in the middleware.

When a user types in the URL for a prototype like
http://govuk-tagging.herokuapp.com they're asked for a
username/password first (via `utils.basicAuth`).

After filling that in they'll be able to "proceed" to the next step,
which redirects them to the `https://` version (via
`utils.forceHttps`).

Because the auth isn't shared between `http` and `https` version, they
are not authenticated anymore and have to enter their username/password
again.

Validated with https://test-prevent-double-auth.herokuapp.com/

* add override service name example

* add comment

* fix docs page

* bump gulp-sass to increase node-sass dependency to enable it to work with node 6 on linux

* add test for docs page

* allow search indexing in promo mode

* v5.1.0

* fix download link

* fix docs links

* Updating gulp-sass to 3.1.0

This is the latest version of gulp-sass.
https://www.npmjs.com/package/gulp-sass

* Bump govuk_frontend_toolkit to 5.1.1

# 5.1.1

- Update the alpha, beta and discovery colours to $govuk-blue to match
the updated phase banner ([PR
#370](alphagov/govuk_frontend_toolkit#370))
- Fix radio button show/hide behaviour when used outside a form ([PR
#375](alphagov/govuk_frontend_toolkit#375))
- Fix a "Stick at top when scrolling" component bug related to scroll
anchoring in Chrome 56+ ([PR
#376](alphagov/govuk_frontend_toolkit#376))
- Minor travis fixes ([PR
#373](alphagov/govuk_frontend_toolkit#373))

# 5.1.0

- Allow custom options when tracking events ([PR
#365](alphagov/govuk_frontend_toolkit#365))

# 5.0.3

- Change HMRC and DEFRA text colours for improved contrast ([PR
#368](alphagov/govuk_frontend_toolkit#368))

* formatting, clarify use of terminal, fix numbering

* Update govuk-elements-sass to 3.0.1

Changelog for GOV.UK elements:
https://github.com/alphagov/govuk_elements/blob/master/CHANGELOG.md

Changelog for the GOV.UK frontend toolkit:
https://github.com/alphagov/govuk_frontend_toolkit/blob/master/CHANGELOG
.md

* Remove DEPRECATED selection-buttons.js

This is no longer required with the radios and checkboxes released in
govuk-elements-sass v3.0.0.

* Update the radio buttons and checkboxes example page

To use the new markup released in GOV.UK elements 3.0.0.

* Replace .block-label with .multiple-choice

Update examples of radio buttons and checkboxes.

Replace ‘.block-label` with `.multiple-choice` as the block-label class
no longer exists.

* Add a .form-section wrapper to examples

Increase the spacing between the radio button and checkbox examples.

* Mention requirement for show-hide-content.js

* Fix radios and checkbox example page

This had nested form elements, which was a mistake. Removing these.

* Add an example of the task list pattern

Add an example of the task list pattern to the docs. Link to it from
the tutorials and examples page.

* Replace em values with gutter variables

Use variables from the govuk_frontend_toolkit’s _measurements.scss file.

Also add a new variable for the spacing to the left of the task list.

* Use the phase tag mixin for the completed status

* Make the "completed" status uppercase

* Rename the task-list to "task-list-page"

* Added config to turn off browser sync

* Add SSH Key for Travis

* Combine scripts and move to a deploy provider

This works in the same way as govuk_elements.

Create a new file - create-release.sh, combining - create release tag
and update release branch, these are deleted.

* Add missing EOF

* To maintain consistency, in this commit I have:
- assigned config.useBrowserSync to a variable
- ran the toLowerCase method on the variable
- change the if statement to reflect the new variable

* add auto data store

* add clear data link to docs app

* only run autodata once, include JS in docs

* use 'data' hash in locals

* use new multiple-choice css, use hyphens in names

* store GET data

* seperate guidance and example pages, added h1s

* refactor checked function

* use list for vehicle features

* fix return to examples link

* refactored docs

* set cookie name and timeout, use crypto

* de-duplicate forceHttps

* Add template pages for content and questions

* Add new template pages to examples index

* v6.0.0

* attempted fix for radio auto stores

* attempted fix for radio auto stores
  • Loading branch information
Paul Michael Smith authored May 2, 2017
1 parent 5ecfeb6 commit 4c64af1
Show file tree
Hide file tree
Showing 82 changed files with 1,825 additions and 556 deletions.
20 changes: 10 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
language: node_js
node_js:
- 4.0
install:
- npm install
script:
- gulp test
- npm test
after_success:
- "./create-release-tag.sh"
- "./update-release-branch.sh"
- 6.0
before_deploy:
- test $TRAVIS_TEST_RESULT = 0
before_install:
- npm install -g mocha
deploy:
provider: heroku
- provider: script # (If version.txt is updated) - create a new tag and push to Github, update the latest-release branch
script: ./create-release.sh
on: master
- provider: heroku
api_key:
secure: h/9/Rcd41XVU4VYYeBoKKvG6uShEoDksCGGZ/2dgeY1f3tYnhGzzgL6TIkvhafwDbKk2Y4o6d/MI05K+s7lorf2uTKpr1To2o52hQqmb4YREPWruZtBqoRo5X4nCeN2oEdW+yJRH3jZDNUmwkPzjytqxkcUUUeDPHfz3+xCtSZk=
app: govuk-prototype-kit
Expand All @@ -20,4 +20,4 @@ notifications:
sudo: false
env:
global:
- secure: DNOsydCMSHOvp1SEQNRHx3SOqaUPA5XZQZ+eOsA/hcc4iXQktMxX004tfsKgUVfvzWdXVFtLscL2TpHad2TjPDvtcmb2vYH3tqgHHhyAK0fJRMp4UNh7z5RnHKsoe0WRAQGtGAqw8ND7a2GWV0/yWoxub66C1WZmSBNxlCH27dw=
- secure: esj3ut+TwKX25QzU1koJyTVIX+x1V55graI65X8LiYXKcOP040VPJ9lIC0HeRs5UViBM0Ur1F93rGdgW2zYVzu5MLZoH7KjpzMcG30x+FDqLChT0JfNcLLtLm/wIhx/OAAmsBxXlvjPp092BeEKd3Jug8d329TxwwK5G5XxAatg=
18 changes: 18 additions & 0 deletions .travis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Travis encrypted files

This directory contains a public/private keypair generated just for this repository.

The public key is a deploy key which has been added to the GitHub repo for push access.

The private key is encrypted using `travis encrypt-file` and then committed to this repo.

The decrypt commands are in `.travis.yml`.

To regenerate a key:

```
ssh-keygen -b 4096 -f .travis/govuk_prototype_kit # Make a new keypair
travis encrypt-file .travis/govuk_prototype_kit # Encrypt the private key
mv govuk_prototype_kit.enc .travis/ # Move the private key to the right place
rm .travis/govuk_prototype_kit # Remove the unencrypted private key
```
Binary file added .travis/govuk_prototype_kit.enc
Binary file not shown.
1 change: 1 addition & 0 deletions .travis/govuk_prototype_kit.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDqbULxuN/WRr4EH3opb5e1K+VSR3ZlJagYS/D1JP7wrRA0drjs3ioR6FcxmHGrv3gAIeRPhwQJpqHC8jHpdNCsXc8IjzRGpB78CdV1LRI8XrBJO4FBHjp+w5uzrKM38fnRyR50R4iuXIUFQUh7JFCGd0URzoCljc/ts3ZWF6XDnSUK0zu/JhPjLuSGDsZxay4eZxR3pkPKEM9zznkn33m1/KzN8g/8JncnPinAucVCGHlZ5d/gggnrgVESob50MDMDy3AZI4fDwltlLVlZG5XLfi5uIou73mG8pDrGISiEz4xvA4aYgaKvng/3SrV5AzEV2O2N43c+1bc2T7E4NTl7H0QDn6lqxN9K2dtOK999J7s0xtmFe8yQZht1EWLWJQ462pCLRz8aGK6THbX4Mb/fOVjKj5OerOr+BJFwRXGr7ielXSLiPscjoLr3Ey7WYb5a7Bp3eiAtK/6BkXTGUcq0J2OMRA4rvdvvlCcL1q0oXORHhLqD87Mf+v0n9pGS4d0z7nlVFHC7i+eIiO+D2AV3/kU3awAcnVE487SYn+tUsPRYjXxQ033mZFAWqmYdzX1bT5fT0iRRcFuO2n0b0olUrlEKY3T+eMszIkE1NQPdZFuhJolk+mgaw70k1W5MPaVFXbXX19uUwqdoUZUvzvfeSQi0pGKNtr7DmAkg/r3PLw== gemmaleigh@gemma-mbp.local
62 changes: 62 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,65 @@
# 6.0.0

New features:
- [#369 Add template pages for content and questions](https://github.com/alphagov/govuk_prototype_kit/pull/369)
- [#340 Auto data session 4](https://github.com/alphagov/govuk_prototype_kit/pull/340)
- [#367 Added config to turn off browser sync](https://github.com/alphagov/govuk_prototype_kit/pull/367)
- [#368 Update Travis deployment to be consistent with other govuk frontend repos](https://github.com/alphagov/govuk_prototype_kit/pull/368)
- [#361 Add an example of the task list pattern](https://github.com/alphagov/govuk_prototype_kit/pull/361)
- [#364 Use GOV.UK elements v3.0.1](https://github.com/alphagov/govuk_prototype_kit/pull/364)
- [#360 Bump govuk_frontend_toolkit to 5.1.1](https://github.com/alphagov/govuk_prototype_kit/pull/360)
- [#352 bump gulp-sass to increase node-sass dependency](https://github.com/alphagov/govuk_prototype_kit/pull/352)

Bug fixes:
- [#356 fix download link](https://github.com/alphagov/govuk_prototype_kit/pull/356)
- [#357 fix docs links](https://github.com/alphagov/govuk_prototype_kit/pull/357)
- [#354 Allow search indexing in promo mode](https://github.com/alphagov/govuk_prototype_kit/pull/354)

# 5.1.0

New features:
- [#335 Add ability to override service name on a page](https://github.com/alphagov/govuk_prototype_kit/pull/335)

Bug fixes:
- [#350 Prevent asking users to authenticate twice](https://github.com/alphagov/govuk_prototype_kit/pull/350)
- [#344 Removing links to route.js / updating example in branching.html](https://github.com/alphagov/govuk_prototype_kit/pull/344)
- [#343 Remove the title attribute from the cookie message](https://github.com/alphagov/govuk_prototype_kit/pull/343)
- [#341 fix css sourcemaps](https://github.com/alphagov/govuk_prototype_kit/pull/341)
- [#337 Add Git step to Heroku guide](https://github.com/alphagov/govuk_prototype_kit/pull/337)
- [#336 Use app.locals instead of app.use](https://github.com/alphagov/govuk_prototype_kit/pull/336)

# 5.0.1

- [#330 Update GOV.UK toolkit and StandardJS to latest](https://github.com/alphagov/govuk_prototype_kit/pull/330)
- [#328 Update GOV.UK template to latest](https://github.com/alphagov/govuk_prototype_kit/pull/328)
- [#324 Fix the example question page’s back link](https://github.com/alphagov/govuk_prototype_kit/pull/324)

# 5.0.0

Breaking changes:

- [#284 Use Gulp instead of Grunt](https://github.com/alphagov/govuk_prototype_kit/pull/284)

Use [Gulp.js](http://gulpjs.com/) rather than [Grunt](http://gruntjs.com/) as a build tool.
It is recommended to [install Gulp globally](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md), do so using:

`npm install --global gulp-cli`

All changes:

The short version:
- [#311 Update govuk-elements-sass to 2.2.0](https://github.com/alphagov/govuk_prototype_kit/pull/311)
- [#308 Change node version from 4 to 6](https://github.com/alphagov/govuk_prototype_kit/pull/308)
- [#299 Basic sanity check test suite](https://github.com/alphagov/govuk_prototype_kit/pull/299)
- [#296 Keep the latest release branch up-to-date](https://github.com/alphagov/govuk_prototype_kit/pull/296)
- Fix broken links for the documentation app

The extended version:
This release includes custom radio buttons and checkbox styles from govuk-elements-sass v2.2.0.
The version of Node that the prototype kit uses has been updated, we recommend using LTS (version 6 or above).
Travis will now run tests against each pull request to ensure that the app runs (by checking the server and build tasks).
The latest-release branch can be used to update the prototype kit. Instructions for [updating your version of the prototype kit via the latest-release branch can be found here](https://govuk-prototype-kit.herokuapp.com/docs/updating-the-kit#updating-via-the-command-line-advanced-).

# 4.0.0

Breaking changes:
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.0
6.0.0
7 changes: 1 addition & 6 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@ if (
}

$(document).ready(function () {
// Use GOV.UK selection-buttons.js to set selected
// and focused states for block labels
var $blockLabels = $(".block-label input[type='radio'], .block-label input[type='checkbox']")
new GOVUK.SelectionButtons($blockLabels) // eslint-disable-line

// Use GOV.UK shim-links-with-button-role.js to trigger a link styled to look like a button,
// with role="button" when the space key is pressed.
GOVUK.shimLinksWithButtonRole.init()

// Show and hide toggled content
// Where .block-label uses the data-target attribute
// Where .multiple-choice uses the data-target attribute
// to toggle hidden content
var showHideContent = new GOVUK.ShowHideContent()
showHideContent.init()
Expand Down
29 changes: 29 additions & 0 deletions app/assets/javascripts/auto-store-data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* global $ */
$('body').on('submit', 'form', function (e) {
// On form submit, add hidden inputs for checkboxes so the server knows if
// they've been unchecked. This means we can automatically store and update
// all form data on the server, including checkboxes that are checked, then
// later unchecked

var $checkboxes = $(this).find('input:checkbox')

var $inputs = []
var names = {}

$checkboxes.each(function () {
var $this = $(this)

if (!names[$this.attr('name')]) {
names[$this.attr('name')] = true
var $input = $('<input type="hidden">')
$input.attr('name', $this.attr('name'))
$input.attr('value', '_unchecked')
$inputs.push($input)
}
})

$(this).prepend($inputs)

// e.preventDefault();

})
73 changes: 73 additions & 0 deletions app/assets/sass/patterns/_task-list.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// Task list pattern

// Override column width for tablet and up
.column-minimum {
@include media(tablet) {
min-width: 600px;
}
}

// Spacing to the left of the task list
$task-list-indent: 35px;

.task-list {
margin-top: $gutter;
@include media(tablet) {
margin-top: ($gutter * 2);
}
}


.task-list-section {
display: table;

@include bold-24;
padding-bottom: ($gutter / 6);
}

.task-list-section-number {
display: table-cell;
padding-right: ($gutter / 6);

@include media(tablet) {
min-width: $task-list-indent;
padding-right: 0;
}
}


.task-list-items {
margin-bottom: $gutter;
@include media(tablet) {
margin-bottom: ($gutter * 2);
}

@include media(tablet) {
padding-left: $task-list-indent;
}
}

.task-list-item {
border-bottom: 1px solid $border-colour;
padding-top: $gutter-one-third;
padding-bottom: $gutter-one-third;
@extend %contain-floats;
}

.task-list-item:first-child {
border-top: 1px solid $border-colour;
}


.task-name {
width: $two-thirds;
float: left;
}

.task-completed {
@include phase-tag;

float: right;
margin-right: 0;
padding-top: 3px;
}
2 changes: 1 addition & 1 deletion app/assets/sass/unbranded.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $path: "/public/images/";

// Override the govuk_frontend_toolkit's font stack
// https://github.com/alphagov/govuk_frontend_toolkit/blob/master/stylesheets/_font_stack.scss#L13
$toolkit-font-stack: $Helvetica-Regular;
$toolkit-font-stack: $helvetica-regular;

.unbranded {
background: $white;
Expand Down
8 changes: 7 additions & 1 deletion app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ module.exports = {
// Enable or disable password protection on production
useAuth: 'true',

// Automatically stores form data, and send to all views
useAutoStoreData: 'true',

// Enable or disable built-in docs and examples.
useDocumentation: 'true',

Expand All @@ -22,6 +25,9 @@ module.exports = {
cookieText: 'This service uses cookies to make the site simpler. <a href="/help/cookies" title="Find out more about cookies">Find out more about cookies</a>',

// use the routing for sub applications within app
useSubapplications: true
useSubapplications: true,

// Enable or disable Browser Sync
useBrowserSync: 'true'

}
26 changes: 26 additions & 0 deletions app/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,32 @@ module.exports = function (env) {
------------------------------------------------------------------ */

/**
* generateID
* @param {string} string the stirng to concatenate with a random string
* @return {string} the based text concatenated with a
* randomly generated string
*/
filters.generateID = function generateID(string) {
let text = "";
let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for(var i=0; i < 5; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return `${string ? string : ''}-${text}`;
}

/**
* Exposes object.assign to views
* @param {Object} objA first object
* @param {Object} objB second object the merge in and override
* @return {Object} merged object
*/
filters.merge = function merge(objA,objB) {
let newObj = Object.assign(objA,objB)
return newObj
}

/* ------------------------------------------------------------------
keep the following line to return your filters to the app
------------------------------------------------------------------ */
Expand Down
11 changes: 5 additions & 6 deletions app/subapps.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ glob.sync(baseSubAppPath + appsDir + '/**/*-routes.js').forEach(function(current
// if we have a session then destroy it
if(req.session) {

console.log(`Current session looks like:`);
console.log(req.session);
// console.log(`Current session looks like:`);
// console.log(req.session);

req.session.destroy()
req.session[appData.slug] = {};
console.log(`Destroyed session for ${appData.slug}`);

console.log(`Current session after destroy looks like:`);
console.log(req.session);
// console.log(`Current session after destroy looks like:`);
// console.log(req.session);

}

Expand Down Expand Up @@ -223,7 +223,6 @@ glob.sync(baseSubAppPath + appsDir + '/**/*-routes.js').forEach(function(current

// Route index page including the collection of apps in the context
router.get('/', function (req, res, next) {
console.log('using this');
// remove 'live version from the list' we will link to that directly.
res.locals.apps = subApps.filter(item => item.slug !== 'live');
res.render('index')
Expand Down
4 changes: 2 additions & 2 deletions app/views/apps/live/subapp-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ module.exports = (router, config) => {
}

if (employeeStatus) {

answers[claimantType].employeeStatus = employeeStatus;

// Self-employed
Expand All @@ -580,9 +581,8 @@ module.exports = (router, config) => {
else if (employeeStatus.dontWork === 'true') {
res.redirect(`${appRoot}/questions/employee-status-dont-work?${claimantType}`);
}
}

else {
} else {
res.render(`${appRootRel}/questions/employee-status`);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ <h1 class="heading-large">
<span class="visuallyhidden">Have they brought a biometric residence permit today?</span>
</legend>

<label for="brp-yes-today" class="block-label selection-button-radio">
<input type="radio" name="brp" value="yes" id="brp-yes-today">
Yes
</label>

<label for="brp-no" class="block-label selection-button-radio">
<input type="radio" name="brp" value="no" id="brp-no">
No
</label>
{{
form.radio({
name: 'brp',
label: "Yes"
})
}}

{{
form.radio({
name: 'brp',
label: "No"
})
}}

</fieldset>
</div>
Expand Down
Loading

0 comments on commit 4c64af1

Please sign in to comment.