Label Helper plugin

Plugin details

Rails has no helper for label tags, which are important accessibility/usability features of forms.

Websitehttp://blog.jcoglan.com/labelhelper/ Repositoryhttp://svn.jcoglan.com/labelhelper/trunk/label_helper Author James Coglan Tags label, tag LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://svn.jcoglan.com/labelhelper/trunk/label_helper

You shouldn't have to repeat yourself when writing labels for things: currently you need to do:

  <% form_for(:post, ...) do |f| %>
    Title
    <%= f.text_field(:title) %>
    Body
    <%= f.text_area(:body) %>
  <% end %>


Whereas I'd rather not repeat myself over and over...

  <% form_for(:post, ...) do |f| %>
    <%= f.label(:title) %>
    <%= f.text_field(:title) %>
    <%= f.label(:body) %>
    <%= f.text_area(:body) %>
  <% end %>


This plugin lets you do this by adding a +label+ method to ActionView::Helpers::FormHelper. You can also use the +FormBuilder+ style as shown above. See the docs for that module for more details.

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, 7 months ago