Skip to content

Commit

Permalink
Merge pull request #184 from hmrc/DLS-9859
Browse files Browse the repository at this point in the history
DLS-9859 - CGT Calc Res Shares Currency hints fixes
  • Loading branch information
Timidigital authored Feb 5, 2024
2 parents 5c5ab4c + eabcf42 commit 4a0a069
Show file tree
Hide file tree
Showing 23 changed files with 97 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,23 @@
@(lossesBroughtForwardValueForm: Form[LossesBroughtForwardValueModel], taxYear: TaxYearModel, navBackLink: String, postAction: Call)(implicit request: Request[_], messages: Messages, lang: Lang)

@title = @{
if (lossesBroughtForwardValueForm.errors.nonEmpty) Messages("site.title.error", Messages("calc.resident.lossesBroughtForwardValue.title", TaxYearModel.convertWithWelsh(taxYear.taxYearSupplied))) else Messages("calc.resident.lossesBroughtForwardValue.title", TaxYearModel.convertWithWelsh(taxYear.taxYearSupplied))
if(lossesBroughtForwardValueForm.errors.nonEmpty) messages("site.title.error", Messages("calc.resident.lossesBroughtForwardValue.title", TaxYearModel.convertWithWelsh(taxYear.taxYearSupplied))) else Messages("calc.resident.lossesBroughtForwardValue.title", TaxYearModel.convertWithWelsh(taxYear.taxYearSupplied))
}

@layout(
pageTitle = title,
backLinkHref = Some(navBackLink)
) {

@errorSummary(lossesBroughtForwardValueForm.errors, Some("losses-brought-forward-value"))

@form(action = postAction) {

@formInputMoney(
field = lossesBroughtForwardValueForm("amount"),
question = Messages("calc.resident.lossesBroughtForwardValue.pageHeading", TaxYearModel.convertWithWelsh(taxYear.taxYearSupplied)),
hideLabel = false
labelClass = "govuk-label--xl",
hintText = Some(messages("calc.currencyHint", "£10,000.50"))
)

@submitButton()
}
}
}
13 changes: 7 additions & 6 deletions app/views/calculation/gain/acquisitionCosts.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,21 @@

@errorSummary(acquisitionCostsForm.errors, Some("amount"))

<h1 class="govuk-heading-xl">@Messages("calc.resident.shares.acquisitionCosts.question")</h1>
<h1 class="govuk-heading-xl">@messages("calc.resident.shares.acquisitionCosts.question")</h1>

@form(action = controllers.routes.GainController.submitAcquisitionCosts) {

<p class="govuk-body"> @Messages("calc.resident.shares.acquisitionCosts.help")</p>
<p class="govuk-body"> @messages("calc.resident.shares.acquisitionCosts.help")</p>

<p class="govuk-inset-text">@Messages("calc.resident.shares.acquisitionCosts.hintText")</p>
<p class="govuk-inset-text">@messages("calc.resident.shares.acquisitionCosts.hintText")</p>

@formInputMoney(
field = acquisitionCostsForm("amount"),
question = Messages("calc.resident.shares.acquisitionCosts.question"),
hideLabel = true
question = messages("calc.resident.shares.acquisitionCosts.question"),
labelClass = "govuk-label--m",
hintText = Some(messages("calc.currencyHint", "£10,000.50"))
)

@submitButton()
}
}
}
3 changes: 2 additions & 1 deletion app/views/calculation/gain/acquisitionValue.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ <h1 class="govuk-heading-xl">@messages("calc.resident.shares.acquisitionValue.qu
@formInputMoney(
field = acquisitionValueForm("amount"),
question = messages("calc.resident.shares.acquisitionValue.question"),
hideLabel = true
labelClass = "govuk-label--m",
hintText = Some(messages("calc.currencyHint", "£10,000.50"))
)

@submitButton()
Expand Down
5 changes: 3 additions & 2 deletions app/views/calculation/gain/disposalCosts.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ <h1 class="govuk-heading-xl">@Messages("calc.resident.shares.disposalCosts.quest
@formInputMoney(
field = disposalCostsForm("amount"),
question = Messages("calc.resident.shares.disposalCosts.question"),
hideLabel = true
labelClass = "govuk-label--m",
hintText = Some(messages("calc.currencyHint", "£10,000.50"))
)

@submitButton()
}
}
}
19 changes: 10 additions & 9 deletions app/views/calculation/gain/disposalValue.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
@import uk.gov.hmrc.govukfrontend.views.html.components.FormWithCSRF

@this(
layout: Layout,
form: FormWithCSRF,
errorSummary: playHelpers.errorSummary,
formInputMoney: playHelpers.formInputMoney,
submitButton: playHelpers.submitButton
layout: Layout,
form: FormWithCSRF,
errorSummary: playHelpers.errorSummary,
formInputMoney: playHelpers.formInputMoney,
submitButton: playHelpers.submitButton
)

@(disposalValueForm : Form[DisposalValueModel])(implicit request: Request[_], messages: Messages)
@(disposalValueForm: Form[DisposalValueModel])(implicit request: Request[_], messages: Messages)

@title = @{
if (disposalValueForm.errors.nonEmpty) Messages("site.title.error", Messages("calc.resident.shares.disposalValue.question")) else Messages("calc.resident.shares.disposalValue.question")
Expand All @@ -45,10 +45,11 @@ <h1 class="govuk-heading-xl">@Messages("calc.resident.shares.disposalValue.quest

@formInputMoney(
field = disposalValueForm("amount"),
question = Messages("calc.resident.shares.disposalValue.question"),
hideLabel = true
question = messages("calc.resident.shares.disposalValue.question"),
labelClass = "govuk-label--m",
hintText = Some(messages("calc.currencyHint", "£10,000.50"))
)

@submitButton()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ <h1 class="govuk-heading-xl">@messages("calc.resident.shares.valueBeforeLegislat
@formInputMoney(
field = valueBeforeLegislationStartForm("amount"),
question = messages("calc.resident.shares.valueBeforeLegislationStart.question"),
hideLabel = true
labelClass = "govuk-label--m",
hintText = Some(messages("calc.currencyHint", "£10,000.50"))
)

@submitButton()
Expand Down
13 changes: 7 additions & 6 deletions app/views/calculation/gain/worthWhenInherited.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,20 @@

@errorSummary(worthWhenInheritedForm.errors, Some("amount"))

<h1 class="govuk-heading-xl">@Messages("calc.resident.shares.worthWhenInherited.question")</h1>
<h1 class="govuk-heading-xl">@messages("calc.resident.shares.worthWhenInherited.question")</h1>

@form(action = controllers.routes.GainController.submitWorthWhenInherited) {

<p class="govuk-body"> @Messages("calc.resident.shares.worthWhenInherited.help")</p>
<p class="govuk-body"> @messages("calc.resident.shares.worthWhenInherited.help")</p>

<p class="govuk-inset-text">@Messages("calc.resident.shares.worthWhenInherited.hintText")</p>
<p class="govuk-inset-text">@messages("calc.resident.shares.worthWhenInherited.hintText")</p>

@formInputMoney(
field = worthWhenInheritedForm("amount"),
question = Messages("calc.resident.shares.worthWhenInherited.question"),
hideLabel = true
question = messages("calc.resident.shares.worthWhenInherited.question"),
labelClass = "govuk-label--m",
hintText = Some(messages("calc.currencyHint", "£10,000.50"))
)
@submitButton()
}
}
}
7 changes: 4 additions & 3 deletions app/views/calculation/gain/worthWhenSoldForLess.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ <h1 class="govuk-heading-l">@Messages("calc.resident.shares.worthWhenSoldForLess

@formInputMoney(
field = worthWhenSoldForLessForm("amount"),
question = Messages("calc.resident.shares.worthWhenSoldForLess.question"),
hideLabel = true
question = messages("calc.resident.shares.worthWhenSoldForLess.question"),
labelClass = "govuk-label--m",
hintText = Some(messages("calc.currencyHint", "£10,000.50"))
)

@submitButton()
}
}
}
19 changes: 9 additions & 10 deletions app/views/calculation/income/currentIncome.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
@import uk.gov.hmrc.govukfrontend.views.html.components.FormWithCSRF

@this(
layout: Layout,
errorSummary: playHelpers.errorSummary,
form: FormWithCSRF,
formInputMoney: playHelpers.formInputMoney,
submitButton: playHelpers.submitButton
layout: Layout,
errorSummary: playHelpers.errorSummary,
form: FormWithCSRF,
formInputMoney: playHelpers.formInputMoney,
submitButton: playHelpers.submitButton

)

Expand All @@ -34,7 +34,7 @@
else Messages("calc.resident.currentIncome.question", TaxYearModel.convertWithWelsh(taxYear.taxYearSupplied))
}
@titleWithError = @{
if (currentIncomeForm.errors.nonEmpty) Messages("site.title.error", title) else title
if(currentIncomeForm.errors.nonEmpty) Messages("site.title.error", title) else title
}

@layout(
Expand All @@ -44,15 +44,14 @@

@errorSummary(currentIncomeForm.errors, Some("current-income"))

@form(action = controllers.routes.IncomeController.submitCurrentIncome){
@form(action = controllers.routes.IncomeController.submitCurrentIncome) {

@formInputMoney(
field = currentIncomeForm("amount"),
question = title,
hintText = Some(Messages("calc.resident.shares.currentIncome.helpText")),
hideLabel = false
hintText = Some(s"${Messages("calc.resident.shares.currentIncome.helpText")} ${messages("calc.currencyHint", "£10,000.50")}")
)

@submitButton()
}
}
}
5 changes: 3 additions & 2 deletions app/views/calculation/income/personalAllowance.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@ <h1 class="govuk-heading-xl">@question</h1>
@formInputMoney(
field = personalAllowanceForm("amount"),
question = question,
hideLabel = true
labelClass = "govuk-label--m",
hintText = Some(messages("calc.currencyHint", "£10,000.50"))
)

@submitButton()
}

}
}
}
}
8 changes: 4 additions & 4 deletions app/views/playHelpers/formInputMoney.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
@(
field: Field,
question: String,
hideLabel: Boolean,
labelClass: String = "govuk-label--xl",
hintText: Option[String] = None
)(implicit messages: Messages)

@govukInput(Input(
label = Label(
isPageHeading = !hideLabel,
classes = if(hideLabel) "govuk-visually-hidden" else "govuk-label--xl",
isPageHeading = labelClass.matches("govuk-label--xl"),
classes = labelClass,
content = Text(question)
),
hint = hintText.map(text => (Hint(content = Text(text)))),
Expand All @@ -38,4 +38,4 @@
prefix = Some(PrefixOrSuffix(
content = Text("£")
))
).withFormField(field))
).withFormField(field))
Loading

0 comments on commit 4a0a069

Please sign in to comment.