-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1838c76
commit df9de76
Showing
8 changed files
with
195 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const BaseController = require("hmpo-form-wizard").Controller; | ||
const logger = require("hmpo-logger").get(); | ||
|
||
class ConsentController extends BaseController { | ||
async saveValues(req, res, next) { | ||
try { | ||
return next(); | ||
} catch (err) { | ||
logger.error("Error in consent controller - " + err); | ||
return next(err); | ||
} | ||
} | ||
} | ||
module.exports = ConsentController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const BaseController = require("hmpo-form-wizard").Controller; | ||
const ConsentController = require("./consent"); | ||
|
||
describe("consent controller", () => { | ||
const consentController = new ConsentController({ | ||
route: "/test" | ||
}); | ||
|
||
let req; | ||
let res; | ||
let next; | ||
let sandbox; | ||
|
||
beforeEach(() => { | ||
sandbox = sinon.createSandbox(); | ||
const setup = setupDefaultMocks(); | ||
req = setup.req; | ||
res = setup.res; | ||
next = setup.next; | ||
}); | ||
afterEach(() => sandbox.restore()); | ||
|
||
it("should be an instance of BaseController", () => { | ||
expect(consentController).to.be.an.instanceOf(BaseController); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
{% extends "base-form.njk" %} | ||
{% set hmpoPageKey = "consent" %} | ||
{% set hmpoH1Class = "govuk-heading-l" %} | ||
{% from "hmpo-form/macro.njk" import hmpoForm %} | ||
{% from "hmpo-checkboxes/macro.njk" import hmpoCheckboxes %} | ||
{% from "hmpo-text/macro.njk" import hmpoText %} | ||
|
||
{% block mainContent %} | ||
|
||
{% call hmpoForm(ctx, { | ||
attributes: { | ||
onsubmit: 'window.disableFormSubmit()' | ||
} | ||
}) %} | ||
|
||
{% if (values.licenceIssuer == "DVA") %} | ||
|
||
<h1 id="header" data-page="{{hmpoPageKey}}" class="govuk-heading-l"> | ||
{{ translate("pages.consent.titleDVA") }} | ||
</h1> | ||
<p> | ||
{{ translate("pages.consent.checkDVA") }} | ||
</p> | ||
<h2 >{{ translate("drivingLicence.consentDVA") }}</h2> | ||
|
||
{{ hmpoText(ctx, { | ||
id: "issuerDependent", | ||
type: "hidden", | ||
legend: "", | ||
default: "DVA" | ||
}) }} | ||
|
||
{{ hmpoCheckboxes(ctx, { | ||
id: "consentDVACheckbox", | ||
hint: { | ||
classes: "govuk-label" | ||
} | ||
}) }} | ||
|
||
{% endif %} | ||
|
||
{% if (values.licenceIssuer == "DVLA") %} | ||
|
||
<h1 id="header" data-page="{{hmpoPageKey}}" class="govuk-heading-l"> | ||
{{ translate("pages.consent.title") }} | ||
</h1> | ||
<p> | ||
{{ translate("pages.consent.checkDVLA") }} | ||
</p> | ||
<h2 >{{ translate("drivingLicence.consentDVLA") }}</h2> | ||
|
||
{{ hmpoText(ctx, { | ||
id: "issuerDependent", | ||
type: "hidden", | ||
legend: "", | ||
default: "DVLA" | ||
}) }} | ||
|
||
{{ hmpoCheckboxes(ctx, { | ||
id: "consentCheckbox", | ||
hint: { | ||
classes: "govuk-label" | ||
} | ||
}) }} | ||
|
||
{% endif %} | ||
|
||
{{ hmpoSubmit(ctx, { | ||
id: "continue", | ||
text: translate("buttons.next") | ||
}) }} | ||
|
||
{% endcall %} | ||
|
||
{% endblock %} | ||
|
||
{% block scripts %} | ||
|
||
{{ super ()}} | ||
|
||
<script nonce="{{ cspNonce }}"> | ||
var formSubmitted = false; | ||
|
||
submitSpinner() | ||
|
||
function delayDisableButton(button) { | ||
button.className += ' button--spinner' | ||
setTimeout(function () { | ||
button.setAttribute('disabled', 'disabled') | ||
}, 200); | ||
} | ||
|
||
function submitSpinner() { | ||
var selects = document.getElementById('continue') | ||
|
||
selects.addEventListener('click', function (event) { | ||
if (!formSubmitted) { | ||
formSubmitted = true; | ||
|
||
delayDisableButton(event.target); | ||
} else { | ||
event.preventDefault() | ||
} | ||
}) | ||
} | ||
|
||
window.addEventListener('load', function () { | ||
window | ||
.DI | ||
.analyticsGa4 | ||
.pageViewTracker | ||
.trackOnPageLoad({ | ||
statusCode: '200', // Access status code | ||
englishPageTitle: '{{translate("pages.check.title")}}', | ||
taxonomy_level1: 'web cri', // Access taxonomy level 1 | ||
taxonomy_level2: 'fraud', // Access taxonomy level 2 | ||
content_id: '001', | ||
logged_in_status: true, | ||
dynamic: false | ||
}); | ||
}); | ||
</script> | ||
|
||
{% endblock %} | ||
|
||
{% set footerNavItems = translate("govuk.footerNavItems") %} | ||
|
||
{% block footer %} | ||
{{ govukFooter( footerNavItems ) }} | ||
{% endblock %} |