diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-10 15:11:15 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-10 15:11:15 +0000 |
commit | ac4b4701c0dc94375956f320545bff2ebe0ba832 (patch) | |
tree | a9c17bdfa9fd51eea0462b960a3dcad7fa935dd4 /actionpack/lib/action_view | |
parent | 25d27b39ea3cb3343b1b83177551053691964e70 (diff) | |
download | rails-ac4b4701c0dc94375956f320545bff2ebe0ba832.tar.gz rails-ac4b4701c0dc94375956f320545bff2ebe0ba832.tar.bz2 rails-ac4b4701c0dc94375956f320545bff2ebe0ba832.zip |
Fixed that radio buttons shouldn't have a default size attribute #1074 [hendrik@mans.de] Added ActionView::Helpers::InstanceTag::DEFAULT_RADIO_OPTIONS that contains a hash of default options for radio buttons #1074 [hendrik@mans.de]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1127 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 7333f4036d..007437b7ad 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -145,6 +145,7 @@ module ActionView attr_reader :method_name, :object_name DEFAULT_FIELD_OPTIONS = { "size" => 30 }.freeze unless const_defined?(:DEFAULT_FIELD_OPTIONS) + DEFAULT_RADIO_OPTIONS = { }.freeze unless const_defined?(:DEFAULT_RADIO_OPTIONS) DEFAULT_TEXT_AREA_OPTIONS = { "wrap" => "virtual", "cols" => 40, "rows" => 20 }.freeze unless const_defined?(:DEFAULT_TEXT_AREA_OPTIONS) DEFAULT_DATE_OPTIONS = { :discard_type => true }.freeze unless const_defined?(:DEFAULT_DATE_OPTIONS) @@ -158,10 +159,10 @@ module ActionView def to_input_field_tag(field_type, options = {}) options = options.stringify_keys + options["size"] ||= options["maxlength"] || DEFAULT_FIELD_OPTIONS["size"] + options = DEFAULT_FIELD_OPTIONS.merge(options) if field_type == "hidden" options.delete("size") - else - options["size"] ||= options["maxlength"] || DEFAULT_FIELD_OPTIONS["size"] end options["type"] = field_type options["value"] ||= value_before_type_cast unless field_type == "file" @@ -170,7 +171,7 @@ module ActionView end def to_radio_button_tag(tag_value, options = {}) - options = DEFAULT_FIELD_OPTIONS.merge(options.stringify_keys) + options = DEFAULT_RADIO_OPTIONS.merge(options.stringify_keys) options["type"] = "radio" options["value"] = tag_value options["checked"] = "checked" if value == tag_value |