Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Footers are now customizable (#151)
Browse files Browse the repository at this point in the history
* Footers are now customizable

* Adding condition for default footer

* Adding test for footer

* Adding test for footer

* Push verison increase

---------

Co-authored-by: adamdavies1 <[email protected]>
  • Loading branch information
adamdavies1 and adamdavies1 authored Apr 19, 2023
1 parent edefd56 commit 4698f28
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dluhc-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
]

env:
VERSION: "0.1.53" # Manually increment this version when pushing to main
VERSION: "0.1.54" # Manually increment this version when pushing to main
IMAGE_NAME_STUB: "digital-form-builder-dluhc-"
DOCKER_REGISTRY: ghcr.io
IMAGE_REPO_PATH: "ghcr.io/${{github.repository_owner}}"
Expand Down
6 changes: 6 additions & 0 deletions model/src/data-model/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ export type Fee = {
prefix?: string;
};

export type Footer = {
href: string;
text: string;
};

/**
* `FormDefinition` is a typescript representation of `Schema`
*/
Expand All @@ -164,4 +169,5 @@ export type FormDefinition = {
specialPages?: SpecialPages;
paymentReferenceFormat?: string;
backLinkText?: string;
footer?: Footer;
};
6 changes: 6 additions & 0 deletions model/src/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ const phaseBannerSchema = joi.object().keys({
phase: joi.string().valid("alpha", "beta"),
});

const footerSchema = joi.object().keys({
href: joi.string(),
text: joi.string(),
});

export const Schema = joi
.object()
.required()
Expand All @@ -252,6 +257,7 @@ export const Schema = joi
phaseBanner: phaseBannerSchema,
specialPages: specialPagesSchema.optional(),
backLinkText: joi.string().allow("").optional(),
footer: joi.array().items(footerSchema).optional(),
});

/**
Expand Down
18 changes: 18 additions & 0 deletions runner/src/server/forms/report-a-terrorist.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,5 +285,23 @@
]
}
}
],
"footer": [
{
"href": "https://www.gov.uk/government/publications/community-ownership-fund-privacy-notice/community-ownership-fund-privacy-notice",
"text": "Privacy test"
},
{
"href": "https://www.google.com",
"text": "Cookies test"
},
{
"href": "https://www.gov.uk/government/publications/community-ownership-fund-privacy-notice/community-ownership-fund-privacy-notice",
"text": "Accessibility Statement test"
},
{
"href": "https://www.gov.uk/government/publications/community-ownership-fund-privacy-notice/community-ownership-fund-privacy-notice",
"text": "Contact Us test"
}
]
}
45 changes: 28 additions & 17 deletions runner/src/server/views/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,32 @@ <h1 class="govuk-heading-l">Default page template</h1>


{% block footer %}
{{ govukFooter({
meta: {
items: [{
href: 'https://www.gov.uk/government/publications/community-ownership-fund-privacy-notice/community-ownership-fund-privacy-notice',
text: 'Privacy'
}, {
href: cookiePolicyUrl,
text: 'Cookies'
}, {
href: accessibilityStatementUrl,
text: 'Accessibility Statement'
}, {
href: contactUsUrl,
text: 'Contact Us'
}]
}
}) }}
{% set footerItems = [] %}
{% if page.def.footer %}
{% for footerItem in page.def.footer %}
{% set _ = footerItems.push({
href: footerItem.href,
text: footerItem.text
}) %}
{% endfor %}
{% else %}
{% set footerItems = [{
href: 'https://www.gov.uk/government/publications/community-ownership-fund-privacy-notice/community-ownership-fund-privacy-notice',
text: 'Privacy'
}, {
href: cookiePolicyUrl,
text: 'Cookies'
}, {
href: accessibilityStatementUrl,
text: 'Accessibility Statement'
}, {
href: contactUsUrl,
text: 'Contact Us'
}]%}
{% endif %}
{{ govukFooter({
meta: {
items: footerItems
}
}) }}
{% endblock %}
4 changes: 4 additions & 0 deletions smoke-tests/designer/features/completeAForm.feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Feature: Complete a form
Given I am at the start of the "runner components test" form
When I complete the form
Then the Summary page is displayed with my answers

Scenario: The footer and links are visible on start page
Given I am at the start of the "report a terrorist" form
Then I can see the footer at the bottom of the page

Scenario: Back link is displayed
Given I am at the start of the "report a terrorist" form
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class FormRunnerPage extends Page {
return browser.$("h1");
}

get govFooter() {
return browser.$("footer");
}

/**
* Locates the index of a checkbox by label name
* @param labelText
Expand Down
8 changes: 8 additions & 0 deletions smoke-tests/designer/features/steps/completeAForm.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,11 @@ Then(/^the Summary page is displayed with my answers$/, function () {
"[email protected]"
);
});

Then("I can see the footer at the bottom of the page", function () {
let footer = formRunner.govFooter;
expect(footer).toHaveTextContaining("Privacy test");
expect(footer).toHaveTextContaining("Cookies test");
expect(footer).toHaveTextContaining("Accessibility Statement test");
expect(footer).toHaveTextContaining("Contact Us test");
});

0 comments on commit 4698f28

Please sign in to comment.