aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2010-01-30 15:01:02 -0600
committerJoshua Peek <josh@joshpeek.com>2010-01-30 15:01:02 -0600
commit95f317b0204d63810b837eae48667d9ed311f7dd (patch)
tree301af62fc9db53469410f9128007031cb7e22cfc
parent61c9b1648703c29133c3ea2ec083e275d95edbec (diff)
downloadrails-95f317b0204d63810b837eae48667d9ed311f7dd.tar.gz
rails-95f317b0204d63810b837eae48667d9ed311f7dd.tar.bz2
rails-95f317b0204d63810b837eae48667d9ed311f7dd.zip
Move periodically_call_remote into prototype_legacy_helper plugin
-rw-r--r--actionpack/lib/action_view/helpers/prototype_helper.rb35
-rw-r--r--actionpack/test/template/prototype_helper_test.rb12
2 files changed, 0 insertions, 47 deletions
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb
index 92f4ca838f..0ec7b48c25 100644
--- a/actionpack/lib/action_view/helpers/prototype_helper.rb
+++ b/actionpack/lib/action_view/helpers/prototype_helper.rb
@@ -39,10 +39,6 @@ module ActionView
# <div><%= submit_tag 'Recalculate Shipping' %></div>
# <% end -%>
#
- # ...periodically...
- #
- # periodically_call_remote(:url => 'update', :frequency => '5', :update => 'ticker')
- #
# As you can see, there are numerous ways to use Prototype's Ajax functions (and actually more than
# are listed here); check out the documentation for each method to find out more about its usage and options.
#
@@ -255,37 +251,6 @@ module ActionView
button_to_function(name, remote_function(options), html_options)
end
- # Periodically calls the specified url (<tt>options[:url]</tt>) every
- # <tt>options[:frequency]</tt> seconds (default is 10). Usually used to
- # update a specified div (<tt>options[:update]</tt>) with the results
- # of the remote call. The options for specifying the target with <tt>:url</tt>
- # and defining callbacks is the same as link_to_remote.
- # Examples:
- # # Call get_averages and put its results in 'avg' every 10 seconds
- # # Generates:
- # # new PeriodicalExecuter(function() {new Ajax.Updater('avg', '/grades/get_averages',
- # # {asynchronous:true, evalScripts:true})}, 10)
- # periodically_call_remote(:url => { :action => 'get_averages' }, :update => 'avg')
- #
- # # Call invoice every 10 seconds with the id of the customer
- # # If it succeeds, update the invoice DIV; if it fails, update the error DIV
- # # Generates:
- # # new PeriodicalExecuter(function() {new Ajax.Updater({success:'invoice',failure:'error'},
- # # '/testing/invoice/16', {asynchronous:true, evalScripts:true})}, 10)
- # periodically_call_remote(:url => { :action => 'invoice', :id => customer.id },
- # :update => { :success => "invoice", :failure => "error" }
- #
- # # Call update every 20 seconds and update the new_block DIV
- # # Generates:
- # # new PeriodicalExecuter(function() {new Ajax.Updater('news_block', 'update', {asynchronous:true, evalScripts:true})}, 20)
- # periodically_call_remote(:url => 'update', :frequency => '20', :update => 'news_block')
- #
- def periodically_call_remote(options = {})
- frequency = options[:frequency] || 10 # every ten seconds by default
- code = "new PeriodicalExecuter(function() {#{remote_function(options)}}, #{frequency})"
- javascript_tag(code)
- end
-
# Returns a form tag that will submit using XMLHttpRequest in the
# background instead of the regular reloading POST arrangement. Even
# though it's using JavaScript to serialize the form elements, the form
diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb
index b37f71dd61..4e37de2aef 100644
--- a/actionpack/test/template/prototype_helper_test.rb
+++ b/actionpack/test/template/prototype_helper_test.rb
@@ -122,18 +122,6 @@ class PrototypeHelperTest < PrototypeHelperBaseTest
button_to_remote("Remote outpost", :failure => "alert(request.reponseText)", :url => { :action => "whatnot", :a => '10', :b => '20' })
end
- def test_periodically_call_remote
- assert_dom_equal %(<script type="text/javascript">\n//<![CDATA[\nnew PeriodicalExecuter(function() {new Ajax.Updater('schremser_bier', 'http://www.example.com/mehr_bier', {asynchronous:true, evalScripts:true})}, 10)\n//]]>\n</script>),
- periodically_call_remote(:update => "schremser_bier", :url => { :action => "mehr_bier" })
- end
-
- def test_periodically_call_remote_with_frequency
- assert_dom_equal(
- "<script type=\"text/javascript\">\n//<![CDATA[\nnew PeriodicalExecuter(function() {new Ajax.Request('http://www.example.com/', {asynchronous:true, evalScripts:true})}, 2)\n//]]>\n</script>",
- periodically_call_remote(:frequency => 2)
- )
- end
-
def test_form_remote_tag
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;\">),
form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast })