diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-01-16 21:54:44 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-01-17 00:05:30 -0300 |
commit | f0041d4714f264bd72e9aaab055b03a7106c5990 (patch) | |
tree | e7362a5054e7e87766c0a0e7e983457399d84acd /actionpack | |
parent | 0f49caa6e0544521765fce2010337e3376e18c83 (diff) | |
download | rails-f0041d4714f264bd72e9aaab055b03a7106c5990.tar.gz rails-f0041d4714f264bd72e9aaab055b03a7106c5990.tar.bz2 rails-f0041d4714f264bd72e9aaab055b03a7106c5990.zip |
Extract RangeField
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 12 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/tags.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/tags/range_field.rb | 8 |
3 files changed, 10 insertions, 11 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 8d0375bf4f..4d45e9d65b 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -920,7 +920,7 @@ module ActionView # ==== Options # * Accepts same options as range_field_tag def range_field(object_name, method, options = {}) - InstanceTag.new(object_name, method, self, options.delete(:object)).to_number_field_tag("range", options) + ActionView::Helpers::Tags::RangeField.new(object_name, method, self, options).render end private @@ -970,16 +970,6 @@ module ActionView tag("input", options) end - def to_number_field_tag(field_type, options = {}) - options = options.stringify_keys - options['size'] ||= nil - - if range = options.delete("in") || options.delete("within") - options.update("min" => range.min, "max" => range.max) - end - to_input_field_tag(field_type, options) - end - def to_boolean_select_tag(options = {}) options = options.stringify_keys add_default_name_and_id(options) diff --git a/actionpack/lib/action_view/helpers/tags.rb b/actionpack/lib/action_view/helpers/tags.rb index 6071ce1913..4dfd81841e 100644 --- a/actionpack/lib/action_view/helpers/tags.rb +++ b/actionpack/lib/action_view/helpers/tags.rb @@ -12,6 +12,7 @@ module ActionView autoload :UrlField, 'action_view/helpers/tags/url_field' autoload :EmailField, 'action_view/helpers/tags/email_field' autoload :NumberField, 'action_view/helpers/tags/number_field' + autoload :RangeField, 'action_view/helpers/tags/range_field' autoload :TextArea, 'action_view/helpers/tags/text_area' autoload :CheckBox, 'action_view/helpers/tags/check_box' autoload :RadioButton, 'action_view/helpers/tags/radio_button' diff --git a/actionpack/lib/action_view/helpers/tags/range_field.rb b/actionpack/lib/action_view/helpers/tags/range_field.rb new file mode 100644 index 0000000000..47db4680e7 --- /dev/null +++ b/actionpack/lib/action_view/helpers/tags/range_field.rb @@ -0,0 +1,8 @@ +module ActionView + module Helpers + module Tags + class RangeField < NumberField #:nodoc: + end + end + end +end |