Skip to content
This repository
Browse code

Add documentation examples to prototype helper. Closes #7211 [manfred]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8308 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 7e608af9ffd4fd62d6dca9fd2d4a31d6397f3b4d 1 parent 9ffb632
authored December 05, 2007
2  actionpack/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *SVN*
2 2
 
  3
+* Add documentation examples to prototype helper. Closes #7211 [manfred]
  4
+
3 5
 * Enhance documentation coverage for fragment caching. Closes #7315 [bscofield]
4 6
 
5 7
 * Fix typo in number helper docs. Closes #7582 [josh]
25  actionpack/lib/action_view/helpers/prototype_helper.rb
@@ -531,8 +531,23 @@ def remote_function(options)
531 531
       #                       you can specify it instead to be "blur" or "focus" or
532 532
       #                       any other event.
533 533
       #
534  
-      # Additionally, you may specify any of the options documented in
535  
-      # link_to_remote.
  534
+      # Additionally, you may specify any of the options documented in the
  535
+      # <em>Common options</em> section at the top of this document.
  536
+      #
  537
+      # Example:
  538
+      #
  539
+      #   # Sends params: {:title => 'Title of the book'} when the book_title input
  540
+      #   # field is changed.
  541
+      #   observe_field 'book_title',
  542
+      #     :url => 'http://example.com/books/edit/1',
  543
+      #     :with => 'title'
  544
+      #    
  545
+      #   # Sends params: {:book_title => 'Title of the book'} when the focus leaves
  546
+      #   # the input field.
  547
+      #   observe_field 'book_title',
  548
+      #     :url => 'http://example.com/books/edit/1',
  549
+      #     :on => 'blur'
  550
+      #
536 551
       def observe_field(field_id, options = {})
537 552
         if options[:frequency] && options[:frequency] > 0
538 553
           build_observer('Form.Element.Observer', field_id, options)
@@ -967,6 +982,12 @@ def method_missing(method, *arguments)
967 982
       # Yields a JavaScriptGenerator and returns the generated JavaScript code.
968 983
       # Use this to update multiple elements on a page in an Ajax response.
969 984
       # See JavaScriptGenerator for more information.
  985
+      #
  986
+      # Example:
  987
+      #
  988
+      #   update_page do |page|
  989
+      #     page.hide 'spinner'
  990
+      #   end
970 991
       def update_page(&block)
971 992
         JavaScriptGenerator.new(@template, &block).to_s
972 993
       end

0 notes on commit 7e608af

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