Skip to content
Draft
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
31 changes: 31 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@import 'lib/govuk-frontend/dist/govuk/base';

// stylelint-disable number-max-precision -- deferred during move to stylelint-config-gds
.hmrc-language-select {
@include govuk-font($size: 16);
@include govuk-clearfix;
}

.hmrc-language-select__list {
margin-top: 1em;
float: right;
text-align: right;
}

.hmrc-language-select__list-item {
display: inline-block;

&:first-child::after {
content: "";
display: inline-block;
position: relative;
top: 0.1875em;
height: 1em;
border-right: 0.09375em solid $govuk-text-colour;
}

a,
[aria-current] {
padding: 0.3125em;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class StatementController @Inject() (

def getStatement(
service: String,
referrerUrl: Option[RedirectUrl]
referrerUrl: Option[RedirectUrl],
useServiceNavigation: Option[Boolean]
): Action[AnyContent] =
Action.async { request =>
given MessagesRequest[AnyContent] = request
Expand All @@ -73,7 +74,8 @@ class StatementController @Inject() (
accessibilityStatement,
safeReferrerUrl.map(_.url),
language,
isWelshTranslationAvailable
isWelshTranslationAvailable,
useServiceNavigation.getOrElse(false)
)
)
)
Expand Down Expand Up @@ -105,10 +107,11 @@ class StatementController @Inject() (
statement: AccessibilityStatement,
referrerUrl: Option[String],
language: Lang,
isWelshTranslationAvailable: Boolean
isWelshTranslationAvailable: Boolean,
useServiceNavigation: Boolean
)(using request: Request[?]): HtmlFormat.Appendable = {
given Messages = messagesApi.preferred(Seq(language))

statementPage(statement, referrerUrl, isWelshTranslationAvailable)
statementPage(statement, referrerUrl, isWelshTranslationAvailable, useServiceNavigation)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2026 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package uk.gov.hmrc.accessibilitystatementfrontend.models

import uk.gov.hmrc.hmrcfrontend.views.viewmodels.language._
import scala.collection.immutable.SortedMap

case class LanguageSelect(language: Language, private val languageLinks: (Language, String)*) {
val languageToggle: LanguageToggle = {
val linkMapWithDefaults = Map[Language, String](En -> "", Cy -> "") ++ languageLinks
LanguageToggle(linkMapWithDefaults.toArray: _*)
}
}

case class LanguageToggle(linkMap: SortedMap[Language, String] = SortedMap.empty)

object LanguageToggle {
def apply(linkMap: (Language, String)*): LanguageToggle = LanguageToggle(SortedMap(linkMap: _*))
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@
*@

@import uk.gov.hmrc.hmrcfrontend.views.viewmodels.hmrcstandardpage.{HmrcStandardPageParams, Banners, TemplateOverrides}
@import uk.gov.hmrc.accessibilitystatementfrontend.views.html.layouts.AccessibleNavigationPage

@this(hmrcStandardPage: HmrcStandardPage)
@this(accessibleNavigationPage: AccessibleNavigationPage)
@(
pageTitle: String,
isWelshTranslationAvailable: Boolean,
useServiceNavigation: Boolean = false,
maybeTemplateOverrides: TemplateOverrides = TemplateOverrides())(
contentBlock: Html)(implicit request: RequestHeader, messages: Messages)

@hmrcStandardPage(HmrcStandardPageParams(
@accessibleNavigationPage(HmrcStandardPageParams(
pageTitle = Some(pageTitle),
banners = Banners(displayHmrcBanner = true),
isWelshTranslationAvailable = isWelshTranslationAvailable,
templateOverrides = maybeTemplateOverrides
))(contentBlock)
), useServiceNavigation)(contentBlock)
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

@()(implicit request: MessagesRequest[?], messages: Messages)

@layout(pageTitle = messages("notFound.pageTitle"), isWelshTranslationAvailable = true) {
@layout(pageTitle = messages("notFound.pageTitle"), isWelshTranslationAvailable = true, useServiceNavigation = true) {
<h1 class="govuk-heading-xl">@{messages("notFound.heading")}</h1>
<p class="govuk-body">@{messages("notFound.paragraph1")}</p>
<p class="govuk-body">@{messages("notFound.paragraph2")}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
mobileStatementTemplate: MobileStatementTemplate,
hmrcReportTechnicalIssueHelper: HmrcReportTechnicalIssueHelper)

@(statement: AccessibilityStatement, referrerUrl: Option[String], isWelshTranslationAvailable: Boolean)(
@(statement: AccessibilityStatement, referrerUrl: Option[String], isWelshTranslationAvailable: Boolean, useServiceNavigation: Boolean = false)(
implicit request: Request[?], messages: Messages, appConfig: AppConfig)

@import statement.*

@layout(pageTitle = platformSpecificMessage("general.page-title", serviceName), isWelshTranslationAvailable) {
@layout(pageTitle = platformSpecificMessage("general.page-title", serviceName), isWelshTranslationAvailable, useServiceNavigation) {
@{statementTemplate match {
case VOA => voaStatementTemplate(statement, referrerUrl)
case CHGV => chgvStatementTemplate(statement, referrerUrl)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
@*
* Copyright 2023 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*@

@import uk.gov.hmrc.govukfrontend.views.html.components.GovukLayout
@import uk.gov.hmrc.govukfrontend.views.html.components.GovukBackLink
@import uk.gov.hmrc.govukfrontend.views.html.components.TwoThirdsMainContent
@import uk.gov.hmrc.hmrcfrontend.views.html.helpers.HmrcStandardFooter
@import uk.gov.hmrc.hmrcfrontend.views.html.helpers.HmrcStandardHeader
@import uk.gov.hmrc.hmrcfrontend.views.html.helpers.HmrcHead
@import uk.gov.hmrc.hmrcfrontend.views.html.helpers.HmrcScripts
@import uk.gov.hmrc.hmrcfrontend.views.viewmodels.hmrcstandardpage.HmrcStandardPageParams
@import uk.gov.hmrc.govukfrontend.views.html.components.FixedWidthPageLayout
@import uk.gov.hmrc.govukfrontend.views.html.components.GovukExitThisPage
@import uk.gov.hmrc.hmrcfrontend.views.viewmodels.language._

@this(
govukLayout: GovukLayout,
hmrcStandardHeader: HmrcStandardHeader,
hmrcStandardFooter: HmrcStandardFooter,
hmrcHead: HmrcHead,
hmrcScripts: HmrcScripts,
govukBackLink: GovukBackLink,
govukExitThisPage: GovukExitThisPage,
defaultMainContent: TwoThirdsMainContent,
fixedWidthPageLayout: FixedWidthPageLayout,
deprecatedLanguageSelect: DeprecatedLanguageSelect
)
@(params: HmrcStandardPageParams, useServiceNavigation: Boolean = false)(contentBlock: Html)(implicit request: RequestHeader, messages: Messages)
@import params._

@headerBlock = {
@hmrcStandardHeader(
serviceUrl = serviceURLs.serviceUrl,
serviceName = serviceName,
userResearchBanner = banners.userResearchBanner,
phaseBanner = banners.phaseBanner,
displayHmrcBanner = true,
// By doing this, we force the service navigation language select to be hidden if using the deprecated language select
// This works because there is no service name. If serviceName were defined, the Service Navigation would still display
isWelshTranslationAvailable = if(useServiceNavigation) isWelshTranslationAvailable else false
)
}

@beforeContent = {
@if(isWelshTranslationAvailable && !useServiceNavigation) {
@deprecatedLanguageSelect(LanguageSelect(
if (messages.lang.code == "cy") Cy else En,
(En, "/accessibility-statement/hmrc-frontend/language/en"),
(Cy, "/accessibility-statement/hmrc-frontend/language/cy")
))
}

@backLink.map { link =>
@govukBackLink(link)
}
@exitThisPage.map { exit =>
@govukExitThisPage(exit)
}

<link href='@controllers.routes.Assets.versioned("stylesheets/application.css")' media="screen" rel="stylesheet" type="text/css" />
}

@govukLayout(
pageTitle = pageTitle,
headBlock = Some(hmrcHead(headBlock = templateOverrides.additionalHeadBlock)),
headerBlock = Some(headerBlock),
scriptsBlock = Some(hmrcScripts(scriptsBlock = templateOverrides.additionalScriptsBlock)),
beforeContentBlock = templateOverrides.beforeContentBlock orElse Some(beforeContent),
footerBlock = Some(hmrcStandardFooter(accessibilityStatementUrl = serviceURLs.accessibilityStatementUrl)),
mainContentLayout = templateOverrides.mainContentLayout orElse Some(defaultMainContent(_)),
assetPath = None,
pageLayout = templateOverrides.pageLayout orElse Some(fixedWidthPageLayout(_))
)(contentBlock)
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@*
* Copyright 2023 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*@

@this()

@(params: LanguageSelect)
@import params._

<nav class="hmrc-language-select"
aria-label="@if(language.code == "cy"){Switcher iaith} else {Language switcher}"
>
<ul class="hmrc-language-select__list">
@languageToggle.linkMap.map {
case (lang, link) => {
@if(lang == language){
<li class="hmrc-language-select__list-item">
<span aria-current="true">@lang.name</span>
</li>
} else {
<li class="hmrc-language-select__list-item">
<a href="@link"
hreflang="@lang.code"
lang="@lang.code"
rel="alternate"
class="govuk-link"
>
<span class="govuk-visually-hidden">@if(lang.code == "cy"){Newid yr iaith i’r Gymraeg} else {Change the language to English}</span>
<span aria-hidden="true">@lang.name</span>
</a>
</li>
}
}
}
</ul>
</nav>
2 changes: 1 addition & 1 deletion conf/app.routes
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

-> /hmrc-frontend hmrcfrontend.Routes
GET /assets/*file controllers.Assets.versioned(path = "/public", file: Asset)
GET /:service uk.gov.hmrc.accessibilitystatementfrontend.controllers.StatementController.getStatement(service: String, referrerUrl: Option[RedirectUrl])
GET /:service uk.gov.hmrc.accessibilitystatementfrontend.controllers.StatementController.getStatement(service: String, referrerUrl: Option[RedirectUrl], useServiceNavigation: Option[Boolean])

2 changes: 1 addition & 1 deletion project/AppDependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sbt.*

object AppDependencies {
private val bootstrapVersion = "10.7.0"
private val frontendVersion = "12.32.0"
private val frontendVersion = "13.1.0"
private val playVersion = "play-30"

// Note for future developers:
Expand Down
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.10")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0")

addSbtPlugin("com.github.sbt" % "sbt-gzip" % "2.0.0")

addSbtPlugin("uk.gov.hmrc" % "sbt-sass-compiler" % "0.13.0")