-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FCRM-4472 flood-map page created for Nafra2 preview, with link from fzr
- Loading branch information
Showing
5 changed files
with
189 additions
and
29 deletions.
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
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,28 @@ | ||
const Joi = require('joi') | ||
const { polygonToArray } = require('../services/shape-utils') | ||
module.exports = [{ | ||
method: 'GET', | ||
path: '/flood-map', | ||
options: { | ||
description: 'Displays a full page map with the Nafra 2 layers', | ||
handler: async (request, h) => { | ||
const location = request.query.location | ||
const polygon = polygonToArray(request.query.polygon) | ||
const center = request.query.center ? JSON.parse(request.query.center) : [] | ||
return h.view('flood-map', { | ||
location, | ||
easting: center[0], | ||
northing: center[1], | ||
polygon: JSON.stringify(polygon), | ||
center: JSON.stringify(center) | ||
}) | ||
}, | ||
validate: { | ||
query: Joi.object().keys({ | ||
polygon: Joi.string().required(), | ||
center: Joi.string().required(), | ||
location: Joi.string().required() | ||
}) | ||
} | ||
} | ||
}] |
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,57 @@ | ||
{% extends 'layout.html' %} | ||
{% set htmlClasses = "full-page-map-html" %} | ||
{% set bodyClasses = "full-page-map-body" %} | ||
{% block pageTitle %} | ||
Flood risk information for this location - Flood map for planning - GOV.UK | ||
{% endblock %} | ||
{% block content %} | ||
{{ super() }} | ||
|
||
<link rel="stylesheet" type="text/css" href="{{assetPath}}/fonts/style.css"> | ||
<link rel="stylesheet" type="text/css" href="{{assetPath}}/stylesheets/ol.css"> | ||
<link rel="stylesheet" type="text/css" href="{{assetPath}}/stylesheets/summary/index.css"> | ||
|
||
{% from "button/macro.njk" import govukButton %} | ||
|
||
<script src="{{assetPath}}/javascripts/jquery.min.js"></script> | ||
<script src="{{assetPath}}/javascripts/summary.js"></script> | ||
|
||
{% if polygon %} | ||
<script> | ||
$(function () { | ||
var page = new FMP.SummaryPage({ | ||
polygon: {{ polygon }} | ||
}) | ||
}) | ||
</script> | ||
{% else %} | ||
<script> | ||
$(function () { | ||
var page = new FMP.SummaryPage({ easting: '{{easting}}', northing: '{{northing}}' }) | ||
}) | ||
</script> | ||
{% endif %} | ||
|
||
{% endblock %} | ||
{% block footer %} | ||
{{ super() }} | ||
<div id="flood-map" class="govuk-grid-row full-page-map"> | ||
<!-- The Map --> | ||
<figure class="map-container flood-zone-results-map govuk-!-margin-bottom-6" role="application"> | ||
<figcaption class="govuk-visually-hidden" aria-hidden="false"> | ||
A map showing the flood risk for the location you have provided | ||
</figcaption> | ||
<div class="mobile-heading"> | ||
<h2 class="heading-medium">Map</h2> | ||
<a href="#legend">View map key</a> | ||
</div> | ||
<div id="map--result" class="map--result"> | ||
<div id="map" class="map"> | ||
{% include "./partials/map/no-js.html" %} | ||
</div> | ||
{% include "./partials/map/summary-legend.html" %} | ||
<button onclick="history.back()" class="defra-map__back">Exit map</button> | ||
</div> | ||
</figure> | ||
</div> | ||
{% endblock %} |
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