Skip to content
Endel Dreyer edited this page Aug 27, 2014 · 1 revision

View helpers

String helpers

Helper Template Output
str_plural {{ str_plural "hook" }} hooks
str_singular {{ str_singular "hooks" }} hook
uppercase {{ uppercase "hook" }} HOOK
lowercase {{ lowercase "HOOK-Platform" }} hook-platform
camel_case {{ camel_case "hook_platform" }} hookPlatform
snake_case {{ snake_case "HookPlatform" }} hook_platform

URL helpers

link_to

Generate a HTML link to the given URL.

{{ link_to "about" "About page" class="featured" }}

Form helpers

input

Generate HTML input tag.

{{ input "username" placeholder="Username" class="inline" }}

select

Generate HTML select tag.

{{ select "country" options=countries }}

form

Generate HTML form tag.

{{#form method="post"}}
  {{ input "username" }}
  {{ input "password" type="password" }}
{{/form}}

form_for

Same as form. Plus generated field names will have a namespace. Example: <input name="item[name]" />

{{#form_for "item"}}
  {{ input "name" }}
  {{ input type="submit" value="Create!" }}
{{/form}}

Miscelaneous

count

Count number of items in array.

{{ count items }}

paginate

Generate pagination links.

{{#items}}
  <p>{{ name }}</p>
{{/items}}

{{ paginate items }}