Skip to content

Commit

Permalink
Merge pull request #1009 from hmrc/PSR-1648_member_contributions_fix
Browse files Browse the repository at this point in the history
PSR-1648 Rendering radio option differently for member contributions …
  • Loading branch information
kberec authored Dec 11, 2024
2 parents b0564a6 + 4709671 commit 5e302c0
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions app/views/YesNoPageView.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@govukErrorSummary(ErrorSummaryViewModel(form))
}

@if(viewModel.page.legend.nonEmpty) {
@if(viewModel.page.legend.nonEmpty || viewModel.description.nonEmpty) {
<h1 class="govuk-heading-l">@renderMessage(viewModel.heading)</h1>
}

Expand All @@ -46,18 +46,33 @@ <h1 class="govuk-heading-l">@renderMessage(viewModel.heading)</h1>
@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)))
Expand Down

0 comments on commit 5e302c0

Please sign in to comment.