Skip to content

Commit

Permalink
Merge pull request #2396 from alphagov/frontend-5.2.0
Browse files Browse the repository at this point in the history
Update to GOV.UK Frontend v5.2.0 on management pages
  • Loading branch information
colinrotherham authored Feb 22, 2024
2 parents 73e4b7d + 5acf2a4 commit e2640d9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- [#2327: Use GOV.UK Frontend v5 on management pages and tests](https://github.com/alphagov/govuk-prototype-kit/pull/2327)
- [#2395: Update to GOV.UK Frontend v5.2.0 on management pages](https://github.com/alphagov/govuk-prototype-kit/pull/2395)

## 13.16.0

Expand Down
14 changes: 9 additions & 5 deletions lib/manage-prototype-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,18 +283,22 @@ function locateTemplateConfig (req) {
}

function getTemplatesViewHandler (req, res) {
const model = {
pluginConfig: plugins.getAppConfig({ scripts: prototypeAppScripts }),
serviceName: 'Service name goes here'
}
const templateConfig = locateTemplateConfig(req)

// Nunjucks environment for template previews uses `getAppViews()` to
// add plugins including GOV.UK Frontend views via project package
const nunjucksAppEnv = nunjucksConfiguration.getNunjucksAppEnv(appViews)

// Use GOV.UK Frontend paths from Express.js locals
const { govukFrontend, govukFrontendInternal } = req.app.locals

if (templateConfig) {
res.send(nunjucksAppEnv.render(templateConfig.path, model))
res.send(nunjucksAppEnv.render(templateConfig.path, {
govukFrontend,
govukFrontendInternal,
pluginConfig: plugins.getAppConfig({ scripts: prototypeAppScripts }),
serviceName: 'Service name goes here'
}))
} else {
res.status(404).send('Template not found.')
}
Expand Down
14 changes: 7 additions & 7 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"express": "^4.18.2",
"express-session": "^1.17.3",
"fs-extra": "^11.1.1",
"govuk-frontend": "5.0.0",
"govuk-frontend": "5.2.0",
"inquirer": "^8.2.6",
"lodash": "^4.17.21",
"marked": "^4.3.0",
Expand Down

0 comments on commit e2640d9

Please sign in to comment.