diff options
author | Xavier Noria <fxn@hashref.com> | 2008-05-07 15:42:39 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2008-05-07 15:42:39 +0200 |
commit | 4bf5f67be9625274faaa4c14a32170d50e987cbe (patch) | |
tree | a12da0a2ccc83bdaf335e9a30920be612da8ea92 /actionpack | |
parent | 8c937edca001deca824f0bdd7d33ed17cf0b8302 (diff) | |
download | rails-4bf5f67be9625274faaa4c14a32170d50e987cbe.tar.gz rails-4bf5f67be9625274faaa4c14a32170d50e987cbe.tar.bz2 rails-4bf5f67be9625274faaa4c14a32170d50e987cbe.zip |
applied patch in http://rails.lighthouseapp.com/projects/8994/tickets/133-patch-prototype-helper-doc-patch
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/prototype_helper.rb | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index 908728c0e6..1b12aa8058 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -631,6 +631,27 @@ module ActionView # render(:update) { |page| page.update_time } # end # + # Calls to JavaScriptGenerator not matching a helper method below + # generate a proxy to the JavaScript Class named by the method called. + # + # Examples: + # + # # Generates: + # # Foo.init(); + # update_page do |page| + # page.foo.init + # end + # + # # Generates: + # # Event.observe('one', 'click', function () { + # # $('two').show(); + # # }); + # update_page do |page| + # page.event.observe('one', 'click') do |p| + # p[:two].show + # end + # end + # # You can also use PrototypeHelper#update_page_tag instead of # PrototypeHelper#update_page to wrap the generated JavaScript in a # <script> tag. @@ -855,12 +876,21 @@ module ActionView # # Examples: # - # # Generates: Element.replace(my_element, "My content to replace with.") - # page.call 'Element.replace', 'my_element', "My content to replace with." - # - # # Generates: alert('My message!') - # page.call 'alert', 'My message!' - # + # # Generates: Element.replace(my_element, "My content to replace with.") + # page.call 'Element.replace', 'my_element', "My content to replace with." + # + # # Generates: alert('My message!') + # page.call 'alert', 'My message!' + # + # # Generates: + # # my_method(function() { + # # $("one").show(); + # # $("two").hide(); + # # }); + # page.call(:my_method) do |p| + # p[:one].show + # p[:two].hide + # end def call(function, *arguments, &block) record "#{function}(#{arguments_for_call(arguments, block)})" end |