aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorSergey Prikhodko <prikha@gmail.com>2014-03-04 13:18:32 +0400
committerSergey Prikhodko <prikha@gmail.com>2014-03-04 13:18:32 +0400
commite447ed6902e0134128728db7baaa48cdf74dc788 (patch)
tree76e2d1c436df5037920d317cd6facae45bcc2441 /actionview
parentca1b98a5599d25636aa07ac441579143a187bb85 (diff)
downloadrails-e447ed6902e0134128728db7baaa48cdf74dc788.tar.gz
rails-e447ed6902e0134128728db7baaa48cdf74dc788.tar.bz2
rails-e447ed6902e0134128728db7baaa48cdf74dc788.zip
remove private method and rewrite into more precise notation
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/helpers/form_tag_helper.rb24
1 files changed, 12 insertions, 12 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..961d01eff4 100644
--- a/actionview/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionview/lib/action_view/helpers/form_tag_helper.rb
@@ -469,14 +469,22 @@ module ActionView
# # => <button data-disable-with="Please wait..." name="button" type="submit">Checkout</button>
#
def button_tag(content_or_options = nil, options = nil, &block)
+ default_options = { 'name' => 'button', 'type' => 'submit' }
- if content_or_options.is_a?(Hash)
+ if content_or_options.is_a? Hash
options = content_or_options
- content_or_options = nil
+ else
+ options ||= {}
end
- options = button_tag_options_with_defaults(options)
- content_tag :button, content_or_options || 'Button', options, &block
+ options = options.stringify_keys
+ options = options.reverse_merge default_options
+
+ if block_given?
+ content_tag :button, options, &block
+ else
+ content_tag :button, content_or_options || 'Button', options
+ end
end
# Displays an image which when clicked will submit the form.
@@ -742,14 +750,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