diff --git a/src/controllers/datasetController.js b/src/controllers/datasetController.js index 5f3904cf..2862c122 100644 --- a/src/controllers/datasetController.js +++ b/src/controllers/datasetController.js @@ -4,51 +4,17 @@ import MyController from './MyController.js' // ToDo: we shouldn't hardcode these values here, should we get them from the API // maybe take from specification -const datasetOptions = { - 'Article 4': [ - { - value: 'article-4-direction', - text: 'Article 4 direction dataset' - }, - { - value: 'article-4-direction area', - text: 'Article 4 direction area dataset' - } - ], - 'Conservation area': [ - { - value: 'conservation-area', - text: 'Conservation area dataset' - }, - { - value: 'conservation-area-document', - text: 'Conservation area document dataset' - } - ], - 'Tree preservation order': [ - { - value: 'tree-preservation-order', - text: 'Tree preservation order dataset' - }, - { - value: 'tree-preservation-zone', - text: 'Tree preservation zone dataset' - }, - { - value: 'tree', - text: 'Tree dataset' - } - ], - 'Listed building': false -} +import { dataSubjects } from '../utils/utils.js' class DatasetController extends MyController { get (req, res, next) { - const dataset = req.sessionModel.get('data-subject') - const options = datasetOptions[dataset] + // const dataset = req.sessionModel.get('data-subject') + // const options = datasetOptions[dataset] + + const options = [dataSubjects['Article 4'].dataSets[0], dataSubjects['Conservation area'].dataSets[0]] if (options) { - this.availableDatasets = options + this.availableDatasets = options.filter(option => option.available) req.form.options.datasetItems = options super.get(req, res, next) } else { diff --git a/src/controllers/errorsController.js b/src/controllers/errorsController.js index 436349a2..f369110d 100644 --- a/src/controllers/errorsController.js +++ b/src/controllers/errorsController.js @@ -2,7 +2,7 @@ import MyController from './MyController.js' -import { severityLevels } from '../utils/utils.js' +import { severityLevels, dataSubjects } from '../utils/utils.js' class ErrorsController extends MyController { get (req, res, next) { @@ -15,8 +15,18 @@ class ErrorsController extends MyController { req.form.options.rows = rows req.form.options.issueCounts = issueCounts req.form.options.columnNames = Object.keys(rows[0]) - // ToDo: should the api return the columns here? - // or should we get them from the specification? + + const dataSetValue = req.sessionModel.get('dataset') + + // ToDo: optimise this + for (const [key, value] of Object.entries(dataSubjects)) { + for (const dataset of value.dataSets) { + if (dataset.value === dataSetValue) { + req.form.options.dataSubject = key + req.form.options.dataset = dataset.text + } + } + } super.get(req, res, next) } diff --git a/src/routes/form-wizard/steps.js b/src/routes/form-wizard/steps.js index 5ce7e342..8a7a3538 100644 --- a/src/routes/form-wizard/steps.js +++ b/src/routes/form-wizard/steps.js @@ -13,14 +13,14 @@ export default { '/': { entryPoint: true, resetJourney: true, - next: 'data-subject', + next: 'dataset', template: '../views/start.html' }, - '/data-subject': { - ...baseSettings, - fields: ['data-subject'], - next: 'dataset' - }, + // '/data-subject': { + // ...baseSettings, + // fields: ['data-subject'], + // next: 'dataset' + // }, '/dataset': { ...baseSettings, controller: datasetController, @@ -42,28 +42,28 @@ export default { next: 'no-errors' }, '/no-errors': { - ...baseSettings, - next: 'email-address' - }, - '/email-address': { - ...baseSettings, - fields: ['email-address'], - next: 'name' - }, - '/name': { - ...baseSettings, - fields: ['first-name', 'last-name'], - next: 'lpa' - }, - '/lpa': { - ...baseSettings, - fields: ['lpa'], - next: 'check' - }, - '/check': { ...baseSettings, next: 'confirmation' }, + // '/email-address': { + // ...baseSettings, + // fields: ['email-address'], + // next: 'name' + // }, + // '/name': { + // ...baseSettings, + // fields: ['first-name', 'last-name'], + // next: 'lpa' + // }, + // '/lpa': { + // ...baseSettings, + // fields: ['lpa'], + // next: 'check' + // }, + // '/check': { + // ...baseSettings, + // next: 'confirmation' + // }, '/confirmation': { ...baseSettings, noPost: true diff --git a/src/utils/utils.js b/src/utils/utils.js index 5f616e5e..44e8c01b 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -4,3 +4,60 @@ export const severityLevels = { warning: 'warning', error: 'error' } + +export const dataSubjects = { + 'Article 4': { + available: true, + dataSets: [ + { + value: 'article-4-direction', + text: 'Article 4 direction dataset', + available: true + }, + { + value: 'article-4-direction area', + text: 'Article 4 direction area dataset', + available: false + } + ] + }, + 'Conservation area': { + available: true, + dataSets: [ + { + value: 'conservation-area', + text: 'Conservation area dataset', + available: true + }, + { + value: 'conservation-area-document', + text: 'Conservation area document dataset', + available: false + } + ] + }, + 'Tree preservation order': { + available: false, + dataSets: [ + { + value: 'tree-preservation-order', + text: 'Tree preservation order dataset', + available: false + }, + { + value: 'tree-preservation-zone', + text: 'Tree preservation zone dataset', + available: false + }, + { + value: 'tree', + text: 'Tree dataset', + available: false + } + ] + }, + 'Listed building': { + available: false, + dataSets: [] + } +} diff --git a/src/views/confirmation.html b/src/views/confirmation.html index e249e9b7..9155fdc7 100644 --- a/src/views/confirmation.html +++ b/src/views/confirmation.html @@ -1,27 +1,65 @@ +{% from 'govuk/components/panel/macro.njk' import govukPanel %} +{% from "govuk/components/details/macro.njk" import govukDetails %} + {% extends "layouts/main.html" %} -{% from 'govuk/components/panel/macro.njk' import govukPanel %} -{% set pageName = "Data sent" %} +{% set pageName = "Send your data for us to publish" %} {% block content %} + +{% set example %} + + ## About the data + + This dataset shows the locations of conservation areas. Conservation areas are designated to safeguard areas of special architectural and historic interest, the character and appearance of which it is desirable to preserve or enhance. Within these areas special planning controls operate which need to be considered when undertaking development. + + ## Data + + [Southwark conservations areas (CSV, 188KB)](#) + + ## Licensing + + The data is provided under the [Open Government Licence](#). + +{% endset %} + +{% set content %} + + ## What you need to do next + + You need to send an email to [digitalland@levellingup.gov.uk](mailto:digitalland@levellingup.gov.uk). + + The email must include: + + - your full name + - the name of your local planning authority (LPA) + - a link to a webpage containing the data on your LPA website + + The webpage must include: + + - a link to the data + - a summary of what the data is about + - a statement that the data is provided under the Open Government Licence + + {{ govukDetails({ + summaryText: "Example webpage", + text: example | govukMarkdown(headingsStartWith="m") | safe + }) }} + + ## Give feedback + + [Give feedback about this service](/feedback) (takes 30 seconds). + +{% endset %} +
We’ve sent you a confirmation email.
- -We’ll send you an email once we publish the data. This usually happens within 5 working days.
- -Give feedback about this service (takes 30 seconds).
+ {{content | govukMarkdown(headingsStartWith="l") | safe}}