Ticket #5798: prototype_variable_name.diff
| File prototype_variable_name.diff, 1.8 kB (added by andrew.grim@planetargon.com, 2 years ago) |
|---|
-
actionpack/test/template/prototype_helper_test.rb
old new 57 57 periodically_call_remote(:update => "schremser_bier", :url => { :action => "mehr_bier" }) 58 58 end 59 59 60 def test_periodically_call_remote_with_variable_name 61 assert_dom_equal %(<script type="text/javascript">\n//<![CDATA[\nvar pe = new PeriodicalExecuter(function() {new Ajax.Updater('schremser_bier', 'http://www.example.com/mehr_bier', {asynchronous:true, evalScripts:true})}, 10)\n//]]>\n</script>), 62 periodically_call_remote(:update => "schremser_bier", :url => { :action => "mehr_bier" }, :name => "pe" ) 63 end 64 60 65 def test_form_remote_tag 61 66 assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\">), 62 67 form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }) -
actionpack/lib/action_view/helpers/prototype_helper.rb
old new 142 142 def periodically_call_remote(options = {}) 143 143 frequency = options[:frequency] || 10 # every ten seconds by default 144 144 code = "new PeriodicalExecuter(function() {#{remote_function(options)}}, #{frequency})" 145 if name = options.delete(:name) then code = "var #{name} = " + code end 145 146 javascript_tag(code) 146 147 end 147 148