lib/merb_helpers/form/helpers.rb in merb_helpers-0.9.5 vs lib/merb_helpers/form/helpers.rb in merb_helpers-0.9.6
- old
+ new
@@ -1,10 +1,7 @@
# Form helpers provide a number of methods to simplify the creation of HTML forms.
# They can work directly with models (bound) or standalone (unbound).
-#
-# The core method of this helper, +form_for+, gives you the ability to create a form for a resource.
-# For example, let's say that you have a model <tt>Person</tt> and want to create a new instance of it:
module Merb::Helpers::Form
def _singleton_form_context
@_singleton_form_context ||=
self._form_class.new(nil, nil, self)
@@ -148,9 +145,24 @@
def fieldset_for(name, attrs = {}, &blk)
with_form_context(name, attrs.delete(:builder)) do
current_form_context.fieldset(attrs, &blk)
end
+ end
+
+ # Provides a generic HTML label.
+ #
+ # ==== Parameters
+ # attrs<Hash>:: HTML attributes
+ #
+ # ==== Returns
+ # String:: HTML
+ #
+ # ==== Example
+ # <%= label "Full Name", :for => "name" %>
+ # => <label for="name">Full Name</label>
+ def label(*args)
+ current_form_context.label(*args)
end
# Provides a HTML text input tag
#
# ==== Parameters