Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bookmarks to return requirements view page #1187

Merged
merged 3 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/presenters/return-requirements/view.presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function go (returnVersion) {
licenceId: licence.id,
licenceRef: licence.licenceRef,
notes,
pageTitle: `Check the requirements for returns for ${licence.$licenceHolder()}`,
pageTitle: `Requirements for returns for ${licence.$licenceHolder()}`,
reason: returnRequirementReasons[reason] || '',
requirements: _requirements(returnRequirements),
startDate: formatLongDate(startDate),
Expand Down
16 changes: 16 additions & 0 deletions app/views/return-requirements/view.njk
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@
{% if requirements.length > 0 %}
<div class="govuk-!-margin-bottom-9">
<h2 class="govuk-heading-l govuk-!-margin-bottom-4">Requirements for returns</h2>

{# Bookmarks - only displays when there us more than 1 return requirement #}
{% if requirements.length > 1 %}
<div class="govuk-body govuk-!-margin-bottom-6">
<ul>
{% for requirement in requirements %}
{% set requirementIndex = loop.index0 %}
<li><a href="#requirement-{{ requirementIndex }}">Return reference {{ requirement.returnReference }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}

{% for requirement in requirements %}
{# Generate the points cell #}
{# When a requirement has more than 5 points it is displayed as a GOVUK Details component which displays the count #}
Expand Down Expand Up @@ -116,6 +129,9 @@
card: {
title: {
html: "<p> Return reference " + requirement.returnReference + "</p>" + requirement.title
},
attributes: {
id: 'requirement-' + rowIndex
}
},
attributes: {
Expand Down
4 changes: 2 additions & 2 deletions test/presenters/return-requirements/view.presenter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Return Requirements - View presenter', () => {
licenceId: '761bc44f-80d5-49ae-ab46-0a90495417b5',
licenceRef: '01/123',
notes: 'A special note',
pageTitle: 'Check the requirements for returns for Mr Ingles',
pageTitle: 'Requirements for returns for Mr Ingles',
reason: 'New licence',
requirements: [
{
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('Return Requirements - View presenter', () => {
it("returns the title incorporating the licence holder's name", () => {
const result = ViewPresenter.go(returnVersion)

expect(result.pageTitle).to.equal('Check the requirements for returns for Mr Ingles')
expect(result.pageTitle).to.equal('Requirements for returns for Mr Ingles')
})
})

Expand Down
2 changes: 1 addition & 1 deletion test/services/return-requirements/view.service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Return Requirements - View service', () => {
licenceId: '761bc44f-80d5-49ae-ab46-0a90495417b5',
licenceRef: '01/123',
notes: null,
pageTitle: 'Check the requirements for returns for Mr Ingles',
pageTitle: 'Requirements for returns for Mr Ingles',
reason: 'New licence',
requirements: [
{
Expand Down
Loading