From 8dca6586ded76d5950b4fccfb720e2861efede6d Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 30 Nov 2006 21:45:31 +0000 Subject: Fixed that script/server running against Mongrel should tail the proper log regardless of the environment [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5652 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/form_helper.rb | 9 +++++++++ actionpack/lib/action_view/helpers/form_tag_helper.rb | 5 +++++ 2 files changed, 14 insertions(+) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 8aa0b42fe1..8d89f74c3b 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -223,6 +223,11 @@ module ActionView def radio_button(object_name, method, tag_value, options = {}) InstanceTag.new(object_name, method, self, nil, options.delete(:object)).to_radio_button_tag(tag_value, options) end + + + def label(object_name, method, options = {}) + InstanceTag.new(object_name, method, self, nil, options.delete(:object)).to_label_tag(options) + end end class InstanceTag #:nodoc: @@ -328,6 +333,10 @@ module ActionView tag_text << ">True" end + def to_label_tag(options = {}) + label_tag(options.delete(:text) || value(object).humanize, options.reverse_merge(:for => tag_id)) + end + def to_content_tag(tag_name, options = {}) content_tag(tag_name, value(object), options) end diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index e2e796e7c8..661034e5ca 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -153,6 +153,11 @@ module ActionView tag :input, html_options end + # Creates a label tag. + def label_tag(text, options = {}) + content_tag :label, text, options + end + # Creates a submit button with the text value as the caption. If options contains a pair with the key of "disable_with", # then the value will be used to rename a disabled version of the submit button. def submit_tag(value = "Save changes", options = {}) -- cgit v1.2.3