Skip to content

Commit

Permalink
[PH][MIBM-126] tidy enums (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHodgson authored Oct 13, 2020
1 parent a37ebee commit a6dd0ef
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ trait EnumEntryRadioItemSupport {
this: EnumEntry =>

protected val baseMessageKeyForEntry: String = s"$baseMessageKey.$entryName"
protected val hintMessageKey: Option[String] = Some(s"$baseMessageKeyForEntry.hint")
protected val maybeHintMessageKey: Option[String] = None

def radioItem(form: Form[_])(implicit messages: Messages): RadioItem =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ object CustomsAgent {
implicit val format: OFormat[CustomsAgent] = Json.format[CustomsAgent]
}

sealed trait YesNo extends EnumEntry
sealed trait YesNo extends EnumEntry {
val messageKey = s"${YesNo.baseMessageKey}.$entryName"
}

object YesNo extends Enum[YesNo] {
override val baseMessageKey: String = "enum"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ object GoodsDestinations extends Enum[GoodsDestination] with RadioSupport[GoodsD
case object NorthernIreland extends GoodsDestination

case object GreatBritain extends GoodsDestination {
override val maybeHintMessageKey: Option[String] = hintMessageKey
override val maybeHintMessageKey: Option[String] = Some(s"$baseMessageKeyForEntry.hint")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ <h2 class="govuk-heading-m" id="main-message">@messages("checkYourAnswers.journe
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">@messages("checkYourAnswers.journeyDetails.travellingByVehicle")</dt>
<dd class="govuk-summary-list__value" style="text-transform: capitalize">@declaration.travellingByVehicle</dd>
<dd class="govuk-summary-list__value" style="text-transform: capitalize">@messages(declaration.travellingByVehicle.messageKey)</dd>
</div>
@declaration.maybeRegistrationNumber.fold(Html("")) { registrationNumber =>
<div class="govuk-summary-list__row">
Expand Down

0 comments on commit a6dd0ef

Please sign in to comment.