GithubHelp home page GithubHelp logo

jxr227 / url-builder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hmrc/url-builder

0.0 1.0 0.0 48 KB

Micro-library for building URLs from templates and tags

License: Apache License 2.0

Scala 100.00%

url-builder's Introduction

URL Builder

Build Status Download

Micro-library for building URLs from templates and tags.

  • Creates links with settings that are appropriate to the target. See Link's companion object:
Links.toInternalPage            // No SSO, Same Window
Links.toExternalPage            // No SSO, New Window
Links.toPortalPage              // Client-based SSO, Same Window
Links.toInternalPageWithSso     // Server-based SSO, Same Window
  • Constructs parametrized urls based on the tags and corresponding values provided.

Usage

  • Link can be used in scala html templates to generate consistent links across a page:
@import uk.gov.hmrc.urls.Link
<li>
  @{Link.toPortalPage(id = Some("link-id"), 
                      url = "http://someserver:8080/something", 
                      value = Some("Placeholder text displayed for the link")).toHtml}
</li>
  • UrlBuilder can be used to build a URL based on parameters from a (tag, value) map:
UrlBuilder.buildUrl("http://server:8080/something/<tag1>/<tag2>",
                     Seq("<tag1>"->Some("value1"), "<tag2>"->Some("value2"))
                    )

would produce the url: http://someserver:8080/something/value1/value2

Adding to your service

Include the following dependency in your SBT build

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

libraryDependencies += "uk.gov.hmrc" %% "url-builder" % "x.x.x"

License

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

url-builder's People

Contributors

howyp avatar steve-e avatar andy1138 avatar duncancrawford avatar timothygordon32 avatar lxol avatar itsonlysoftwareltd avatar jakobgrunig avatar johno1985 avatar diksta avatar stingrayfunk avatar stjasink avatar tomasz-rosiek avatar enriquefaci avatar vasanthavijaya avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.