Skip to content

Core for HMRC's UI, incl. formatters, validators, mappers and helper templates

License

Notifications You must be signed in to change notification settings

grahampaulcook/play-ui

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

play-ui

Join the chat at https://gitter.im/hmrc/play-ui Build Status Download

Micro-library containing core for HMRC's Play UI:

Formatters

  • Dates provides various human-readable date formats
  • Money formats pounds and pence
  • Strings changes the case of phrases and hyphenates

Form Mappers & Validators

  • DateTuple maps year, month, day fields to a LocalDate
  • StopOnFirstFail applies constraints in order and fails fast
  • Validators contains multiple small validation functions such as addressTuple, positiveInteger & nonEmptySmallText

Helper Templates

Has many standard snippets for form fields, such as: address, dateFields, dropdown, fieldGroup. Each helper correctly adds labels, error messages and CSS classes.

Layout Templates

Contains templates for components used across frontend applications such as: header, footer, sidebar, betaBanner.

Adding to your service

Include the following dependency in your SBT build

resolvers += Resolver.bintrayRepo("hmrc", "releases")

libraryDependencies += "uk.gov.hmrc" %% "play-ui" % "x.x.x"

If you require either head or footer you'll also need to add some config to your application.conf file in order to build the complete urls for assets:

assets {
  version = "x.x.x"
  url = ""
}

How to test changes locally

Publish the library locally with

sbt clean compile publishLocal

This will build and install the library into your local Ivy cache. The final lines of the output will contain the version number.

Then update the configuration of your frontend application to use this version number. This is in different files depending on the application. In business-tax-account, it is in FrontendBuild.scala. In one-time-password-frontend, it is in MicroServiceBuild.scala. The line will look like "uk.gov.hmrc" %% "play-ui" % "4.10"

now restart your frontend application, and you will see your local changes.

n.b. you will need to run the sbt command to publish locally each time you make a change.

License

This code is open source software licensed under the Apache 2.0 License.

About

Core for HMRC's UI, incl. formatters, validators, mappers and helper templates

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 62.8%
  • HTML 35.7%
  • Cycript 1.5%