diff options
author | Sergey Prikhodko <prikha@gmail.com> | 2014-03-03 17:59:57 +0400 |
---|---|---|
committer | Sergey Prikhodko <prikha@gmail.com> | 2014-03-03 17:59:57 +0400 |
commit | d0d2497c2a00da7d96f12b3240af266428a1d579 (patch) | |
tree | 0e9997b2f3244827b46a260ee29f511c4019c7ca /actionview/lib/action_view | |
parent | ed4fc43287562efab01a903507cd0b9d19388a74 (diff) | |
download | rails-d0d2497c2a00da7d96f12b3240af266428a1d579.tar.gz rails-d0d2497c2a00da7d96f12b3240af266428a1d579.tar.bz2 rails-d0d2497c2a00da7d96f12b3240af266428a1d579.zip |
cleanup and move extracted method right into the helper
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r-- | actionview/lib/action_view/helpers/form_tag_helper.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 4113acc6e9..330f74882d 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -469,13 +469,17 @@ module ActionView # # => <button data-disable-with="Please wait..." name="button" type="submit">Checkout</button> # def button_tag(content_or_options = nil, options = nil, &block) + options ||= {} + default_options = { 'name' => 'button', 'type' => 'submit' } if content_or_options.is_a?(Hash) options = content_or_options content_or_options = nil end - options = button_tag_options_with_defaults(options) + options = options.stringify_keys + options.reverse_merge default_options + content_tag :button, content_or_options || 'Button', options, &block end @@ -742,14 +746,6 @@ module ActionView def sanitize_to_id(name) name.to_s.delete(']').gsub(/[^-a-zA-Z0-9:.]/, "_") end - - def button_tag_options_with_defaults(options) - options = options || {} - options = options.stringify_keys - - default_options = { 'name' => 'button', 'type' => 'submit' } - options.reverse_merge default_options - end end end end |