diff options
author | miloops <miloops@gmail.com> | 2008-07-22 11:13:38 -0300 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-07-30 01:42:32 -0700 |
commit | eaab895f83276674891227c656df9b4cebc50200 (patch) | |
tree | 04abcb82319b12701ca8690dc829a9fe6b375e98 /actionpack/lib/action_view/helpers/prototype_helper.rb | |
parent | c8e80f6389b45134c0514dde6736488cf5507765 (diff) | |
download | rails-eaab895f83276674891227c656df9b4cebc50200.tar.gz rails-eaab895f83276674891227c656df9b4cebc50200.tar.bz2 rails-eaab895f83276674891227c656df9b4cebc50200.zip |
Prototype helpers should generate Element.insert instead of Insertion.new, which has been deprecated in Prototype 1.6.
Diffstat (limited to 'actionpack/lib/action_view/helpers/prototype_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/prototype_helper.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index cb4b53a9f7..5194f00382 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -608,7 +608,7 @@ module ActionView # Example: # # # Generates: - # # new Insertion.Bottom("list", "<li>Some item</li>"); + # # new Element.insert("list", { bottom: <li>Some item</li>" }); # # new Effect.Highlight("list"); # # ["status-indicator", "cancel-link"].each(Element.hide); # update_page do |page| @@ -741,16 +741,16 @@ module ActionView # # # Insert the rendered 'navigation' partial just before the DOM # # element with ID 'content'. - # # Generates: new Insertion.Before("content", "-- Contents of 'navigation' partial --"); + # # Generates: Element.insert("content", { before: "-- Contents of 'navigation' partial --" }); # page.insert_html :before, 'content', :partial => 'navigation' # # # Add a list item to the bottom of the <ul> with ID 'list'. - # # Generates: new Insertion.Bottom("list", "<li>Last item</li>"); + # # Generates: Element.insert("list", { bottom: "<li>Last item</li>" }); # page.insert_html :bottom, 'list', '<li>Last item</li>' # def insert_html(position, id, *options_for_render) - insertion = position.to_s.camelize - call "new Insertion.#{insertion}", id, render(*options_for_render) + content = javascript_object_for(render(*options_for_render)) + record "Element.insert(\"#{id}\", { #{position.to_s.downcase}: #{content} });" end # Replaces the inner HTML of the DOM element with the given +id+. @@ -1054,7 +1054,7 @@ module ActionView js_options['asynchronous'] = options[:type] != :synchronous js_options['method'] = method_option_to_s(options[:method]) if options[:method] - js_options['insertion'] = "Insertion.#{options[:position].to_s.camelize}" if options[:position] + js_options['insertion'] = options[:position].to_s.downcase if options[:position] js_options['evalScripts'] = options[:script].nil? || options[:script] if options[:form] |