Skip to content
Browse files

cleanup and move extracted method right into the helper

  • Loading branch information...
1 parent ed4fc43 commit d0d2497c2a00da7d96f12b3240af266428a1d579 @prikha prikha committed Mar 3, 2014
Showing with 5 additions and 9 deletions.
  1. +5 −9 actionview/lib/action_view/helpers/form_tag_helper.rb
View
14 actionview/lib/action_view/helpers/form_tag_helper.rb
@@ -469,13 +469,17 @@ def submit_tag(value = "Save changes", options = {})
# # => <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 @@ def form_tag_in_block(html_options, &block)
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

0 comments on commit d0d2497

Please sign in to comment.
Something went wrong with that request. Please try again.