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

Feature/beta banner #12

Merged
merged 4 commits into from
Jun 4, 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
11 changes: 11 additions & 0 deletions src/server/common/templates/layouts/page.njk
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@

{% block head %}
<link href="{{ getAssetPath('application.css') }}" rel="stylesheet">
{% endblock %}#

{% block header %}
{{ govukHeader({
homepageUrl: "https://www.gov.uk/",
classes: "app-header",
containerClasses: "govuk-width-container",
serviceName: "Check plant health information and import rules",
serviceUrl: "/",
useTudorCrown: true
}) }}
{% endblock %}

{% block pageTitle %}
Expand Down
2 changes: 1 addition & 1 deletion src/server/common/templates/partials/get-help.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<h3 class="govuk-heading-s govuk-!-margin-top-2">{{supportSection.title}}</h3>
<h2 class="govuk-heading-s govuk-!-margin-top-2">{{supportSection.title}}</h2>
<p class="govuk-body govuk-!-margin-bottom-1">{{supportSection.description}}</p>
<a class="govuk-link govuk-body" href="mailto:[email protected]?subject=Plant Health Information Service">[email protected]</a>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/server/home/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const homeController = {
request.yar.set('importConfirmationRadiooption', null)
request.yar.set('searchQuery', null)
request.yar.set('countrySearchQuery', null)
request.yar.set('format', null)

const data = getDefaultLocaleData('home')
const govukHeading = data?.govukheading
Expand Down
9 changes: 9 additions & 0 deletions src/server/home/index.njk
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{% extends 'layouts/page.njk' %}
{% block beforeContent %}
{% from "govuk/components/phase-banner/macro.njk" import govukPhaseBanner %}
{{ govukPhaseBanner({
tag: {
text: getHelpSection.betaText
},
html: getHelpSection.betabannertext1+" "+'<a class="govuk-link" href="#">feedback</a>'+" "+getHelpSection.betabannertext2
}) }}
{% endblock %}
{% block content %}
<div class="govuk-width-container">
<main class="govuk-main-wrapper">
Expand Down
5 changes: 4 additions & 1 deletion src/server/locales/country-search/en_cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"titleText": "Cael help gyda'r gwasanaeth hwn",
"supportUrl": {
"text": "os oes gennych unrhyw ymholiadau neu os oes angen cymorth technegol arnoch, e-bostiwch"
}
},
"betabannertext1": "Mae hwn yn wasanaeth newydd - eich",
"betabannertext2": "bydd yn ein helpu i'w wella.",
"betaText": "BETA"
},
"errors": {
"titleText": "Mae yna broblem",
Expand Down
5 changes: 4 additions & 1 deletion src/server/locales/country-search/en_gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"titleText": "Get help with this service",
"supportUrl": {
"text": "If you have any queries or you need technical support, email"
}
},
"betabannertext1": "This is a new service - your",
"betabannertext2": "will help us to improve it.",
"betaText": "BETA"
},
"errors": {
"titleText": "There is a problem",
Expand Down
30 changes: 30 additions & 0 deletions src/server/locales/format/en_cy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"mainContent": {
"headerText1": "Pa fformat o",
"headerText2": "ydych chi'n mewnforio?",
"radioButtonText1": "Planhigion ar gyfer plannu",
"hint1": "Mae hyn yn cynnwys hadau, planhigion cwsg, planhigion sydd wedi'u corlannu'n naturiol neu'n artiffisial, deunydd in vitro a chloron.",
"radioButtonText2": "Cynnyrch",
"hint2": "Mae hyn yn cynnwys ffrwythau, llysiau, blodau wedi'u torri, grawn, dail, cloron a llysiau gwraidd a chloronen.",
"radioButtonText3": "Rhan o blanhigyn",
"hint3": "Mae hyn yn cynnwys hadau, blodau wedi'u torri, cloron, llysiau deiliog, dail, coesynnau a llysiau gwraidd a thwbercwl.",
"radioButtonText4": "Pren",
"hint4": "Mae hyn yn cynnwys pren nad yw wedi cadw ei arwyneb crwn naturiol, pecynnu pren, pren gwastraff a chynhyrchion coopers.",
"radioButtonText5": "Rhisgl ynysig",
"buttonText": "Parhewch"
},
"getHelpSection": {
"titleText": "Cael help gyda'r gwasanaeth hwn",
"supportUrl": {
"text": "os oes gennych unrhyw ymholiadau neu os oes angen cymorth technegol arnoch, e-bostiwch"
},
"betabannertext1": "Mae hwn yn wasanaeth newydd - eich",
"betabannertext2": "bydd yn ein helpu i'w wella.",
"betaText": "BETA"
},
"errors": {
"titleText": "Mae yna broblem",
"formatPageErrorListText1": "Dewiswch pa fformat o",
"formatPageErrorListText2": "ydych chi'n mewnforio"
}
}
35 changes: 35 additions & 0 deletions src/server/locales/format/en_gb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"mainContent": {
"headerText1": "Which format of",
"headerText2": "are you importing?",
"radioButtonText1": "Plants for planting",
"hint1": "This includes seeds, dormant plants, naturally or artificially dwarfed plants, in vitro material and tubers.",
"radioButtonText2": "Produce",
"hint2": "This includes fruit, vegetables, cut flowers, grain, leaves, tubers and root and tubercle vegetables.",
"radioButtonText3": "Part of a plant",
"hint3": "This includes seeds, cut flowers, tubers, leafy vegetables, leaves, stems and root and tubercle vegetables.",
"radioButtonText4": "Wood",
"hint4": "This includes wood which has not kept its natural round surface, wood packaging, waste wood and coopers products.",
"radioButtonText5": "Isolated bark",
"buttonText": "Continue"
},
"getHelpSection": {
"titleText": "Get help with this service",
"supportUrl": {
"text": "If you have any queries or you need technical support, email"
},
"betabannertext1": "This is a new service - your",
"betabannertext2": "will help us to improve it.",
"betaText": "BETA"
},
"serviceUnavailablePage": {
"headerText": "This service does not include import and plant health information for Northern Ireland",
"desc1": "You will be able to use the service later.",
"desc2": "There are different plant health controls for Northern Ireland and Great Britain. You can"
},
"errors": {
"titleText": "There is a problem",
"formatPageErrorListText1": "Select which format of",
"formatPageErrorListText2": "are you importing?"
}
}
5 changes: 4 additions & 1 deletion src/server/locales/home/en_cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
"titleText": "Cael help gyda'r gwasanaeth hwn",
"supportUrl": {
"text": "os oes gennych unrhyw ymholiadau neu os oes angen cymorth technegol arnoch, e-bostiwch"
}
},
"betabannertext1": "Mae hwn yn wasanaeth newydd - eich",
"betabannertext2": "bydd yn ein helpu i'w wella.",
"betaText": "BETA"
}
}
5 changes: 4 additions & 1 deletion src/server/locales/home/en_gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
"titleText": "Get help with this service",
"supportUrl": {
"text": "If you have any queries or you need technical support, email"
}
},
"betabannertext1": "This is a new service - your",
"betabannertext2": "will help us to improve it.",
"betaText": "BETA"
}
}
5 changes: 4 additions & 1 deletion src/server/locales/import-confirmation/en_cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"titleText": "Cael help gyda'r gwasanaeth hwn",
"supportUrl": {
"text": "os oes gennych unrhyw ymholiadau neu os oes angen cymorth technegol arnoch, e-bostiwch"
}
},
"betabannertext1": "Mae hwn yn wasanaeth newydd - eich",
"betabannertext2": "bydd yn ein helpu i'w wella.",
"betaText": "BETA"
},
"serviceUnavailablePage": {
"headerText": "Nid yw'r gwasanaeth hwn yn cynnwys gwybodaeth am fewnforion ac iechyd planhigion ar gyfer Gogledd Iwerddon",
Expand Down
5 changes: 4 additions & 1 deletion src/server/locales/import-confirmation/en_gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"titleText": "Get help with this service",
"supportUrl": {
"text": "If you have any queries or you need technical support, email"
}
},
"betabannertext1": "This is a new service - your",
"betabannertext2": "will help us to improve it.",
"betaText": "BETA"
},
"serviceUnavailablePage": {
"headerText": "This service does not include import and plant health information for Northern Ireland",
Expand Down
5 changes: 4 additions & 1 deletion src/server/locales/plant-health/en_cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"titleText": "Cael help gyda'r gwasanaeth hwn",
"supportUrl": {
"text": "os oes gennych unrhyw ymholiadau neu os oes angen cymorth technegol arnoch, e-bostiwch"
}
},
"betabannertext1": "Mae hwn yn wasanaeth newydd - eich",
"betabannertext2": "bydd yn ein helpu i'w wella.",
"betaText": "BETA"
}
}
5 changes: 4 additions & 1 deletion src/server/locales/plant-health/en_gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"titleText": "Get help with this service",
"supportUrl": {
"text": "If you have any queries or you need technical support, email"
}
},
"betabannertext1": "This is a new service - your",
"betabannertext2": "will help us to improve it.",
"betaText": "BETA"
}
}
5 changes: 4 additions & 1 deletion src/server/locales/purpose-of-visit/en_cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"titleText": "Cael help gyda'r gwasanaeth hwn",
"supportUrl": {
"text": "os oes gennych unrhyw ymholiadau neu os oes angen cymorth technegol arnoch, e-bostiwch"
}
},
"betabannertext1": "Mae hwn yn wasanaeth newydd - eich",
"betabannertext2": "bydd yn ein helpu i'w wella.",
"betaText": "BETA"
},
"serviceUnavailablePage": {
"headerText": "Nid oes gwybodaeth am blâu neu glefydau ar gael",
Expand Down
5 changes: 4 additions & 1 deletion src/server/locales/purpose-of-visit/en_gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"titleText": "Get help with this service",
"supportUrl": {
"text": "If you have any queries or you need technical support, email"
}
},
"betabannertext1": "This is a new service - your",
"betabannertext2": "will help us to improve it.",
"betaText": "BETA"
},
"serviceUnavailablePage": {
"headerText": "Pest or disease information unavailable",
Expand Down
5 changes: 4 additions & 1 deletion src/server/locales/search/en_cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"titleText": "Cael help gyda'r gwasanaeth hwn",
"supportUrl": {
"text": "os oes gennych unrhyw ymholiadau neu os oes angen cymorth technegol arnoch, e-bostiwch"
}
},
"betabannertext1": "Mae hwn yn wasanaeth newydd - eich",
"betabannertext2": "bydd yn ein helpu i'w wella.",
"betaText": "BETA"
},
"errors": {
"titleText": "Mae yna broblem",
Expand Down
5 changes: 4 additions & 1 deletion src/server/locales/search/en_gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"titleText": "Get help with this service",
"supportUrl": {
"text": "If you have any queries or you need technical support, email"
}
},
"betabannertext1": "This is a new service - your",
"betabannertext2": "will help us to improve it.",
"betaText": "BETA"
},
"errors": {
"titleText": "There is a problem",
Expand Down
15 changes: 14 additions & 1 deletion src/server/plant-health/country-search/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,34 @@ const countrySearchController = {
request.yar.set('countrySearchQuery', {
value: decodeURI(request.query.countrySearchQuery)
})
request.yar.set('fullSearchQuery', {
value: decodeURI(request.yar?.get('fullSearchQuery')?.value)
})
request.yar.set('searchQuery', {
value: decodeURI(request.yar?.get('searchQuery')?.value)
})
const searchInput = request?.yar?.get('countrySearchQuery')
const searchValue = searchInput?.value
const searchQuery = request.yar?.get('searchQuery')
if (searchValue) {
const countrySearchQuery = request.yar?.get('countrySearchQuery')
return h.view('plant-health/country-search/format', {
const fullSearchQuery = request.yar?.get('fullSearchQuery')
const data = getDefaultLocaleData('format')
const mainContent = data?.mainContent
const getHelpSection = data?.getHelpSection
return h.view('plant-health/format/index', {
pageTitle: 'Format',
heading: 'Format',
getHelpSection,
mainContent,
fullSearchQuery,
countrySearchQuery,
searchQuery
})
} else {
const countrySearchQuery = request.yar?.get('countrySearchQuery')
const searchQuery = request.yar?.get('searchQuery')
const fullSearchQuery = request.yar?.get('fullSearchQuery')
if (request.query.countrySearchQuery === '') {
const errorData = getDefaultLocaleData('country-search')
const errorSection = errorData?.errors
Expand All @@ -47,6 +59,7 @@ const countrySearchController = {
getHelpSection,
countrySearchQuery,
searchQuery,
fullSearchQuery,
pageTitle: 'Country Search',
heading: 'Country Search',
errors,
Expand Down
14 changes: 11 additions & 3 deletions src/server/plant-health/country-search/index.njk
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{% extends 'layouts/page.njk' %}
{% block beforeContent %}
{% from "govuk/components/phase-banner/macro.njk" import govukPhaseBanner %}

{{ govukPhaseBanner({
tag: {
text: getHelpSection.betaText
},
html: getHelpSection.betabannertext1+" "+'<a class="govuk-link" href="#">feedback</a>'+" "+getHelpSection.betabannertext2
}) }}
<a href="/plant-health/import-confirmation?whereareyouimportinginto=gb&searchQuery={{fullSearchQuery.value}}" class="govuk-back-link" type='button'>Back</a>
{% endblock %}
{% block content %}
Expand All @@ -22,12 +30,12 @@
<p id="event-name-error" class="govuk-error-message">
<span class="govuk-visually-hidden">Error:</span> {{errorMessage.message.text}}
</p>
<input class="govuk-input govuk-input--error" id="query" name="countrySearchQuery" type="text" aria-describedby="event-name-hint event-name-error">
<input class="govuk-input govuk-input--error" id="query" autocomplete="off" name="countrySearchQuery" type="text" aria-describedby="event-name-hint event-name-error">
{% else %}
{% if countrySearchQuery.value %}
<input class="govuk-input" id="query" name="countrySearchQuery" type="text" value='{{countrySearchQuery.value}}'>
<input class="govuk-input" id="query" name="countrySearchQuery" autocomplete="off" type="text" value='{{countrySearchQuery.value}}'>
{% else %}
<input class="govuk-input" id="query" name="countrySearchQuery" type="text">
<input class="govuk-input" id="query" name="countrySearchQuery" autocomplete="off" type="text">
{% endif %}
{% endif %}
<ul class="govuk-task-list solid-div" id="searchResults" style="width: 99.3%; max-height: 342px; display: none; overflow: auto"></ul>
Expand Down
Loading
Loading