From 47096717f3c3d00e1f4b6c069eef5cc3ffb9ed41 Mon Sep 17 00:00:00 2001
From: kberec <26416940+kberec@users.noreply.github.com>
Date: Wed, 11 Dec 2024 13:40:20 +0000
Subject: [PATCH] PSR-1648 Rendering radio option differently for member
contributions page
---
app/views/YesNoPageView.scala.html | 41 ++++++++++++++++++++----------
1 file changed, 28 insertions(+), 13 deletions(-)
diff --git a/app/views/YesNoPageView.scala.html b/app/views/YesNoPageView.scala.html
index 3d0f14ba5..5faa2675f 100644
--- a/app/views/YesNoPageView.scala.html
+++ b/app/views/YesNoPageView.scala.html
@@ -36,7 +36,7 @@
@govukErrorSummary(ErrorSummaryViewModel(form))
}
- @if(viewModel.page.legend.nonEmpty) {
+ @if(viewModel.page.legend.nonEmpty || viewModel.description.nonEmpty) {
@renderMessage(viewModel.heading)
}
@@ -46,18 +46,33 @@ @renderMessage(viewModel.heading)
@govukDetails(DetailsViewModel(renderMessage(detail.title), renderMessage(detail.contents)))
}
- @govukRadios(
- RadiosViewModel.yesNo(
- field = form("value"),
- legend = viewModel.page.legend
- .map(legend => Some(LegendViewModel(renderMessage(legend))
- .withSize(LegendSize.Medium)))
- .getOrElse(Some(LegendViewModel(renderMessage(viewModel.heading))
- .asPageHeading(LegendSize.Large))),
- yes = viewModel.page.yes.map(renderMessage(_)),
- no = viewModel.page.no.map(renderMessage(_))
- )
- )
+ @if(viewModel.description.isEmpty) {
+ @govukRadios(
+ RadiosViewModel.yesNo(
+ field = form("value"),
+ legend = viewModel.page.legend
+ .map(legend => Some(LegendViewModel(renderMessage(legend))
+ .withSize(LegendSize.Medium)))
+ .getOrElse(Some(LegendViewModel(renderMessage(viewModel.heading))
+ .asPageHeading(LegendSize.Large))),
+ yes = viewModel.page.yes.map(renderMessage(_)),
+ no = viewModel.page.no.map(renderMessage(_))
+ )
+ )
+ } else {
+ @govukRadios(
+ RadiosViewModel.yesNo(
+ field = form("value"),
+ legend = viewModel.page.legend
+ .map(legend => Some(LegendViewModel(renderMessage(legend))
+ .withSize(LegendSize.Medium)))
+ .getOrElse(Some(LegendViewModel(renderMessage(viewModel.heading))
+ .withCssClass("govuk-visually-hidden"))),
+ yes = viewModel.page.yes.map(renderMessage(_)),
+ no = viewModel.page.no.map(renderMessage(_))
+ )
+ )
+ }
@viewModel.page.details.map { detail =>
@govukDetails(DetailsViewModel(renderMessage(detail.title), renderMessage(detail.contents)))