| Module | Waves::Helpers::Form |
| In: |
lib/helpers/form.rb
|
Form helpers are used in generating forms. Since Markaby already provides Ruby methods for basic form generation, the focus of this helper is on providing templates to handle things that go beyond the basics. You must define a form template directory with templates for each type of form element you wish to use. The names of the template should match the type option provided in the property method.
For example, this code:
property :name => 'blog.title', :type => :text, :value => @blog.title
will invoke the text form view (the template in +templates/form/text.mab+), passing in the name (‘blog.title’) and the value (@blog.title) as instance variables.
These helpers work best with Markaby, but may work for other Renderers.
This method really is a place-holder for common wrappers around groups of properties. You will usually want to override this. As is, it simply places a DIV element with class ‘properties’ around the block.
# File lib/helpers/form.rb, line 26
26: def properties(&block)
27: div.properties do
28: yield
29: end
30: end