Skip to content

Commit

Permalink
update back links to use new return-requirement pattern (#613)
Browse files Browse the repository at this point in the history
https://eaflood.atlassian.net/browse/WATER-4248

Testing noticed that the back links were still pointing at the old /licence/ style urls.

Updated all the njk files to use the new return-requirement url pattern.
  • Loading branch information
robertparkinson authored and Demwunz committed Dec 20, 2023
1 parent 7deed4a commit a78392e
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 25 deletions.
9 changes: 2 additions & 7 deletions app/controllers/return-requirements.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,8 @@ async function saveReturnsCheckYourAnswers (request, h) {
}

async function requirementsApproved (request, h) {
const { sessionId } = request.params

const session = await SessionModel.query().findById(sessionId)

return h.view('return-requirements/requirements-approved.njk', {
activeNavBar: 'search',
...session
activeNavBar: 'search'
})
}

Expand All @@ -106,7 +101,7 @@ async function saveNoReturnsRequired (request, h) {

const session = await SessionModel.query().findById(sessionId)

return h.redirect(`/system/return-requirements/${session.id}/no-returns-check-your-answers`)
return h.redirect(`/system/return-requirements/${session.id}/no-return-check-your-answers`)
}

async function noReturnsCheckYourAnswers (request, h) {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/return-requirement.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const routes = [
}
}, {
method: 'GET',
path: '/return-requirements/{sessionId}/requirements-approved',
path: '/return-requirements/requirements-approved',
handler: ReturnRequirementsController.requirementsApproved,
options: {
auth: {
Expand Down
2 changes: 1 addition & 1 deletion app/views/return-requirements/add-a-note.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% from "govuk/components/back-link/macro.njk" import govukBackLink %}
{% from "govuk/components/button/macro.njk" import govukButton %}

{% set rootLink = "/system/licences/" + licenceId %}
{% set rootLink = "/system/return-requirements/" + id %}
{% block breadcrumbs %}
{# Back link #}
{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% from "govuk/components/back-link/macro.njk" import govukBackLink %}
{% from "govuk/components/button/macro.njk" import govukButton %}

{% set rootLink = "/system/licences/" + licenceId %}
{% set rootLink = "/system/return-requirements/" + id %}
{% block breadcrumbs %}
{# Back link #}
{{
Expand Down
2 changes: 1 addition & 1 deletion app/views/return-requirements/no-returns-required.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% from "govuk/components/back-link/macro.njk" import govukBackLink %}
{% from "govuk/components/button/macro.njk" import govukButton %}

{% set rootLink = "/system/licences/" + licenceId %}
{% set rootLink = "/system/return-requirements/" + id %}
{% block breadcrumbs %}
{# Back link #}
{{
Expand Down
4 changes: 2 additions & 2 deletions app/views/return-requirements/reason.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
{% from "govuk/components/button/macro.njk" import govukButton %}

{% set title = "Select the reason for the return requirement" %}
{% set rootLink = "/system/licences/" + licenceId %}
{% set rootLink = "/system/return-requirements/" + id %}

{% block breadcrumbs %}
{# Back link #}
{{
govukBackLink({
text: 'back',
text: 'Back',
href: rootLink + "/"
})
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% from "govuk/components/back-link/macro.njk" import govukBackLink %}
{% from "govuk/components/button/macro.njk" import govukButton %}

{% set rootLink = "/system/licences/" + licenceId %}
{% set rootLink = "/system/return-requirements/" + id %}
{% block breadcrumbs %}
{# Back link #}
{{
Expand Down
16 changes: 8 additions & 8 deletions app/views/return-requirements/returns-how-do-you-want.njk
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{% extends 'layout.njk' %}
{# {% from "govuk/components/back-link/macro.njk" import govukBackLink %} #}
{# {% from "govuk/components/button/macro.njk" import govukButton %} #}
{% from "govuk/components/back-link/macro.njk" import govukBackLink %}
{% from "govuk/components/button/macro.njk" import govukButton %}

{# {% set rootLink = "/system/licences/" + licenceId %} #}
{% set rootLink = "/system/return-requirements/" + id %}

{% block breadcrumbs %}
{# Back link #}
{# {{
{{
govukBackLink({
text: 'back',
text: 'Back',
href: rootLink + "/reason"
})
}} #}
}}
{% endblock %}

{% block content %}
Expand All @@ -20,9 +20,9 @@
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">How do you want to set up the return requirement?</h1>
</div>

{# <form method="post">
<form method="post">
<div class="govuk-body">
{{ govukButton({ text: "Continue" }) }}
</div>
</form> #}
</form>
{% endblock %}
2 changes: 1 addition & 1 deletion app/views/return-requirements/select-return-start-date.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% from "govuk/components/back-link/macro.njk" import govukBackLink %}
{% from "govuk/components/button/macro.njk" import govukButton %}

{% set rootLink = "/system/licences/" + licenceId %}
{% set rootLink = "/system/return-requirements/" + id %}
{% block breadcrumbs %}
{# Back link #}
{{
Expand Down
4 changes: 2 additions & 2 deletions test/controllers/return-requirements.controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ describe('Return requirements controller', () => {
})
})

describe('GET /return-requirements/{sessionId}/requirements-approved', () => {
describe('GET /return-requirements/requirements-approved', () => {
const options = {
method: 'GET',
url: '/return-requirements/64924759-8142-4a08-9d1e-1e902cd9d316/requirements-approved',
url: '/return-requirements/requirements-approved',
auth: {
strategy: 'session',
credentials: { scope: ['billing'] }
Expand Down

0 comments on commit a78392e

Please sign in to comment.