1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Allow prototype functions to receive position parameter as a symbol.

[#887 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
This commit is contained in:
miloops 2008-08-30 19:49:32 -03:00 committed by Jeremy Kemper
parent cb25c4e584
commit 367a55e1b8
2 changed files with 3 additions and 1 deletions

View file

@ -1060,7 +1060,7 @@ module ActionView
js_options['asynchronous'] = options[:type] != :synchronous js_options['asynchronous'] = options[:type] != :synchronous
js_options['method'] = method_option_to_s(options[:method]) if options[:method] js_options['method'] = method_option_to_s(options[:method]) if options[:method]
js_options['insertion'] = options[:position].to_s.downcase if options[:position] js_options['insertion'] = "'#{options[:position].to_s.downcase}'" if options[:position]
js_options['evalScripts'] = options[:script].nil? || options[:script] js_options['evalScripts'] = options[:script].nil? || options[:script]
if options[:form] if options[:form]

View file

@ -79,6 +79,8 @@ class PrototypeHelperTest < PrototypeHelperBaseTest
link_to_remote("Remote outauthor", :failure => "alert(request.responseText)", :url => { :action => "whatnot", :a => '10', :b => '20' }) link_to_remote("Remote outauthor", :failure => "alert(request.responseText)", :url => { :action => "whatnot", :a => '10', :b => '20' })
assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:false, evalScripts:true}); return false;\">Remote outauthor</a>), assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:false, evalScripts:true}); return false;\">Remote outauthor</a>),
link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :type => :synchronous) link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :type => :synchronous)
assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, insertion:'bottom'}); return false;\">Remote outauthor</a>),
link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :position => :bottom)
end end
def test_link_to_remote_html_options def test_link_to_remote_html_options