diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 86829c273863bedfe35c039ec4f5f1afa852612c..8777b51b9a44b179b110f6e2265fb10f25d72204 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -44,7 +44,7 @@ module JavaScriptHelper include PrototypeHelper - # Returns a link that'll trigger a JavaScript +function+ using the + # Returns a link that will trigger a JavaScript +function+ using the # onclick handler and return false after the fact. # # The +function+ argument can be omitted in favor of an +update_page+ @@ -53,11 +53,32 @@ module JavaScriptHelper # # Examples: # link_to_function "Greeting", "alert('Hello world!')" + # Produces: + # Greeting + # # link_to_function(image_tag("delete"), "if (confirm('Really?')) do_delete()") + # Produces: + # + # Delete + # + # # link_to_function("Show me more", nil, :id => "more_link") do |page| # page[:details].visual_effect :toggle_blind # page[:more_link].replace_html "Show me less" # end + # Produces: + # Show me more + # def link_to_function(name, function = '', html_options = {}, &block) html_options.symbolize_keys! function = update_page(&block) if block_given?