View Helpers

The Jasper::Helpers library provides a common set of helper methods that can simplify the development of the views.

A link_to helper is available:

== link_to "Home", "/"

Produces the following HTML

<a href="/">Home</a>

Buttons

A button_to helper is available:

== button_to "Logout", "/logout"

Produces the following HTML

<form action="/logout" class="button" method="post">
  <button type="submit">Logout</button>
</form>

For more complex forms, see section below.

Forms

A form helper is available, along with helpers for the following form elements:

  • text_field

  • label

  • hidden_field

  • select_field

  • text_area

  • check_box

  • submit

Use maze generate scaffold [Resource] [field:type] ... to get the most up-to-date examples of using helpers for resources.

text_field

Produces the following HTML

label

Produces the following HTML

text_area

Produces the following HTML

hidden_field

Produces the following HTML

select_field

All the previous code samples produce the following HTML

check_box

Produces the following HTML

All together

Produces the following HTML

Last updated