Skip to content

Commit

Permalink
Fixing page highlights (including Plugins which was broken before).
Browse files Browse the repository at this point in the history
  • Loading branch information
nataliecarey committed Apr 5, 2023
1 parent f53e57b commit 5b86ccb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
9 changes: 6 additions & 3 deletions lib/manage-prototype-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ function getTemplatesInstallHandler (req, res) {

if (templateConfig) {
res.render(getManagementView('template-install.njk'), {
currentPage: `Create new ${templateConfig.name}`,
currentPage: 'Templates',
pageName: `Create new ${templateConfig.name}`,
currentUrl: req.originalUrl,
links: managementLinks,
templateName: templateConfig.name,
Expand Down Expand Up @@ -365,7 +366,8 @@ function getTemplatesPostInstallHandler (req, res) {
const chosenUrl = req.query['chosen-url']

res.render(getManagementView('template-post-install.njk'), {
currentPage: pageName,
currentPage: 'Templates',
pageName,
links: managementLinks,
url: chosenUrl,
filePath: path.join('app', 'views', `${chosenUrl}.${getFileExtensionForNunjucksFiles()}`)
Expand Down Expand Up @@ -542,7 +544,8 @@ async function getPluginsModeHandler (req, res) {
const returnLink = req.query.returnTo === 'templates' ? templatesReturnLink : pluginsReturnLink

res.render(getManagementView('plugin-install-or-uninstall.njk'), {
currentPage: pageName,
currentPage: 'Plugins',
pageName,
currentUrl: req.originalUrl,
links: managementLinks,
chosenPlugin,
Expand Down
9 changes: 6 additions & 3 deletions lib/manage-prototype-handlers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ describe('manage-prototype-handlers', () => {
expect(res.render).toHaveBeenCalledWith(
'views/manage-prototype/template-install.njk',
expect.objectContaining({
currentPage: 'Create new A page with everything',
currentPage: 'Templates',
pageName: 'Create new A page with everything',
chosenUrl,
currentUrl: req.originalUrl,
error,
Expand Down Expand Up @@ -344,7 +345,8 @@ describe('manage-prototype-handlers', () => {
expect(res.render).toHaveBeenCalledWith(
'views/manage-prototype/template-post-install.njk',
expect.objectContaining({
currentPage: 'Page created',
currentPage: 'Templates',
pageName: 'Page created',
filePath: path.join(`app/views${chosenUrl}.html`)
})
)
Expand Down Expand Up @@ -410,7 +412,8 @@ describe('manage-prototype-handlers', () => {
chosenPlugin: availablePlugin,
command: `npm install ${packageName}`,
csrfToken,
currentPage: `Install ${pluginDisplayName.name}`,
currentPage: 'Plugins',
pageName: `Install ${pluginDisplayName.name}`,
currentUrl: req.originalUrl,
isSameOrigin: false,
returnLink: {
Expand Down
3 changes: 3 additions & 0 deletions lib/nunjucks/views/manage-prototype/layout.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{% extends "govuk-prototype-kit/layouts/govuk-branded.njk" %}

{% block pageTitle %}
{% if pageName %}
{{ pageName }} -
{% endif %}
{% if currentPage !== "Home" %}{{ currentPage }}
- {% endif %}Manage your prototype
- {{ serviceName }}
Expand Down
2 changes: 1 addition & 1 deletion lib/nunjucks/views/manage-prototype/template-install.njk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}) }}
{% endif %}

<h1 class="govuk-heading-l">{{ currentPage }}</h1>
<h1 class="govuk-heading-l">{{ pageName }}</h1>

<form action="{{ currentUrl }}" method="post">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">{{ currentPage }}</h1>
<h1 class="govuk-heading-l">{{ pageName }}</h1>

<p class="govuk-body">View your page at
<a class="govuk-link" href="{{ url }}">{{ url }}</a></p>
Expand Down

0 comments on commit 5b86ccb

Please sign in to comment.