From 8c9ce617c9989c74209235f68ba4497b905234fd Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 6 Sep 2006 01:31:04 +0000 Subject: Fixed JavaScriptHelper#link_to_function and JavaScriptHelper#button_to_function to have the script argument be optional [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5039 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/javascript_helper.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 8777b51b9a..3f0a462092 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -79,7 +79,10 @@ module ActionView # }; # return false;">Show me more # - def link_to_function(name, function = '', html_options = {}, &block) + def link_to_function(name, *args, &block) + html_options = args.last.is_a?(Hash) ? args.pop : {} + function = args[0] || '' + html_options.symbolize_keys! function = update_page(&block) if block_given? content_tag( @@ -104,7 +107,13 @@ module ActionView # button_to_function "Details" do |page| # page[:details].visual_effect :toggle_slide # end - def button_to_function(name, function = '', html_options = {}, &block) + # button_to_function "Details", :class => "details_button" do |page| + # page[:details].visual_effect :toggle_slide + # end + def button_to_function(name, *args, &block) + html_options = args.last.is_a?(Hash) ? args.pop : {} + function = args[0] || '' + html_options.symbolize_keys! function = update_page(&block) if block_given? tag(:input, html_options.merge({ -- cgit v1.2.3