Label Helpers plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install http://svn.eric-stewart.com/pub/rails/plugins/label_helpers/
== Usage
< form action="save_person" method="post"> <%= label "person", "name", "Name:" %> <%= text_field "person", "name", "size" => 20 %> < input type="submit" value="Save"> < /form>
This would produce:
< form action="save_person" method="post"> < label for="person[name]">Name:< /label> < input type="text" id="person_name" name="person[name]" size="20" value="<%= @person.name %>" /> < input type="submit" value="Save"> < /form>
Say you had validates_presense_of on person.name. The template output would then be:
< form action="save_person" method="post"> < label for="person[name]">Name: cannot be blank < div class="fieldWithErrors">< /div> < input type="submit" value="Save"> < /form>
Of course there is a handy tag helper as well to be used in a template as such:
< form action="save_person" method="post"> <%= label_tag "person[name]", "Name:" <%= text_field "person", "name", "size" => 20 %> < input type="submit" value="Save"> < /form>
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | Back in time (1 older version) | Last edited by: hardway, 10 months ago

