Documentation
¶
Index ¶
- Constants
- func CSS(href string, options tags.Options) template.HTML
- func Img(src string, options tags.Options) template.HTML
- func JS(src string, options tags.Options) template.HTML
- func LinkTo(in interface{}, opts tags.Options, help hctx.HelperContext) (template.HTML, error)
- func New() hctx.Map
- func RemoteLinkTo(in interface{}, opts tags.Options, help hctx.HelperContext) (template.HTML, error)
Constants ¶
const ( ImgKey = "imgTag" CSSKey = "stylesheetTag" JSKey = "javascriptTag" LinkToKey = "linkTo" RemoteLinkToKey = "remoteLinkTo" )
Keys to be used in templates for the functions in this package.
Variables ¶
This section is empty.
Functions ¶
func CSS ¶
CSS creates html for a css link using `github.com/gobuffalo/tags` to create a link with the given options and href. Defaults to `stylesheet` for `rel` and `screen` for `media` if those options are not set.
func Img ¶
Img creates html for a `<img>` tag using `github.com/gobuffalo/tags` to create a tag with the given `src` and `options`.
func JS ¶
JS creates html for a `<script>` tag using `github.com/gobuffalo/tags` to create the tag with the given `options` and `src`. Defaults to `text/javascript` for `type` if not set in the `options`.
func LinkTo ¶
LinkTo creates html for a `<a>` tag using `github.com/gobuffalo/tags` to create tag with the given options(`opts`) and using [`paths#PathFor(in)`](https://godoc.org/github.com/gobuffalo/helpers/paths#PathFor) to set the `href`. If given a block it will be interrupted and appended inside of the `<a>` tag. Example 1:
<%= linkTo([user, widget], {class: "btn"}) %>
yields(assuming user ID'd by `id` and widget by `slug`):
<a class="btn" href="/users/id/widget/slug"></a>
Example 2:
<%= linkTo("foo", {class: "btn"}) %>
yields:
<a class="btn" href="/foo"></a>
func RemoteLinkTo ¶
func RemoteLinkTo(in interface{}, opts tags.Options, help hctx.HelperContext) (template.HTML, error)
RemoteLinkTo creates an AJAXified `<a>` tag.
<%= remoteLinkTo(widget, {class: "btn btn-info", body: "View"}) %> <a class="btn btn-info" data-remote="true" href="/widgets/b6b0ab24-19ae-4cdd-ad73-c5ecbddd6f91">View</a>
Types ¶
This section is empty.