diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss new file mode 100644 index 000000000..7c015d0d6 --- /dev/null +++ b/app/assets/stylesheets/application.scss @@ -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; + } +} diff --git a/app/uk/gov/hmrc/accessibilitystatementfrontend/controllers/StatementController.scala b/app/uk/gov/hmrc/accessibilitystatementfrontend/controllers/StatementController.scala index d66263c8d..4e52794af 100644 --- a/app/uk/gov/hmrc/accessibilitystatementfrontend/controllers/StatementController.scala +++ b/app/uk/gov/hmrc/accessibilitystatementfrontend/controllers/StatementController.scala @@ -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 @@ -73,7 +74,8 @@ class StatementController @Inject() ( accessibilityStatement, safeReferrerUrl.map(_.url), language, - isWelshTranslationAvailable + isWelshTranslationAvailable, + useServiceNavigation.getOrElse(false) ) ) ) @@ -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) } } diff --git a/app/uk/gov/hmrc/accessibilitystatementfrontend/models/LanguageSelect.scala b/app/uk/gov/hmrc/accessibilitystatementfrontend/models/LanguageSelect.scala new file mode 100644 index 000000000..113f78bf9 --- /dev/null +++ b/app/uk/gov/hmrc/accessibilitystatementfrontend/models/LanguageSelect.scala @@ -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: _*)) +} diff --git a/app/uk/gov/hmrc/accessibilitystatementfrontend/views/Layout.scala.html b/app/uk/gov/hmrc/accessibilitystatementfrontend/views/Layout.scala.html index cf2fe9b51..7e5347795 100644 --- a/app/uk/gov/hmrc/accessibilitystatementfrontend/views/Layout.scala.html +++ b/app/uk/gov/hmrc/accessibilitystatementfrontend/views/Layout.scala.html @@ -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) diff --git a/app/uk/gov/hmrc/accessibilitystatementfrontend/views/NotFoundPage.scala.html b/app/uk/gov/hmrc/accessibilitystatementfrontend/views/NotFoundPage.scala.html index 696002d71..06ccf14c4 100644 --- a/app/uk/gov/hmrc/accessibilitystatementfrontend/views/NotFoundPage.scala.html +++ b/app/uk/gov/hmrc/accessibilitystatementfrontend/views/NotFoundPage.scala.html @@ -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) {
@{messages("notFound.paragraph1")}
@{messages("notFound.paragraph2")}
diff --git a/app/uk/gov/hmrc/accessibilitystatementfrontend/views/StatementPage.scala.html b/app/uk/gov/hmrc/accessibilitystatementfrontend/views/StatementPage.scala.html index 6a0db3ae4..da0de667f 100644 --- a/app/uk/gov/hmrc/accessibilitystatementfrontend/views/StatementPage.scala.html +++ b/app/uk/gov/hmrc/accessibilitystatementfrontend/views/StatementPage.scala.html @@ -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) diff --git a/app/uk/gov/hmrc/accessibilitystatementfrontend/views/layouts/AccessibleNavigationPage.scala.html b/app/uk/gov/hmrc/accessibilitystatementfrontend/views/layouts/AccessibleNavigationPage.scala.html new file mode 100644 index 000000000..84991a821 --- /dev/null +++ b/app/uk/gov/hmrc/accessibilitystatementfrontend/views/layouts/AccessibleNavigationPage.scala.html @@ -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) +} + + +} + +@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) diff --git a/app/uk/gov/hmrc/accessibilitystatementfrontend/views/layouts/DeprecatedLanguageSelect.scala.html b/app/uk/gov/hmrc/accessibilitystatementfrontend/views/layouts/DeprecatedLanguageSelect.scala.html new file mode 100644 index 000000000..5d661470b --- /dev/null +++ b/app/uk/gov/hmrc/accessibilitystatementfrontend/views/layouts/DeprecatedLanguageSelect.scala.html @@ -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._ + + diff --git a/conf/app.routes b/conf/app.routes index a93046a4f..8c68786f2 100644 --- a/conf/app.routes +++ b/conf/app.routes @@ -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]) diff --git a/project/AppDependencies.scala b/project/AppDependencies.scala index 7110c8227..23a9308be 100644 --- a/project/AppDependencies.scala +++ b/project/AppDependencies.scala @@ -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: diff --git a/project/plugins.sbt b/project/plugins.sbt index b84716188..845ed0245 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -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")