aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorTarmo Tänav <tarmo@itech.ee>2008-08-30 02:08:16 +0300
committerJeremy Kemper <jeremy@bitsweat.net>2008-08-29 16:22:01 -0700
commit6450d6ca76603bc5d1b1a6cdcb77e33e35f53d83 (patch)
treecfe8467e3a16c5a90a4e6aa09a2e99319966bcff /actionpack/lib
parent5a6e20b60702fbe86fa84c1b7b5a25f33cec5945 (diff)
downloadrails-6450d6ca76603bc5d1b1a6cdcb77e33e35f53d83.tar.gz
rails-6450d6ca76603bc5d1b1a6cdcb77e33e35f53d83.tar.bz2
rails-6450d6ca76603bc5d1b1a6cdcb77e33e35f53d83.zip
Added button_to_remote helper
Ticket originally from http://dev.rubyonrails.org/ticket/3641 Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/prototype_helper.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb
index 2ce818cd71..94c5abe2a1 100644
--- a/actionpack/lib/action_view/helpers/prototype_helper.rb
+++ b/actionpack/lib/action_view/helpers/prototype_helper.rb
@@ -255,6 +255,14 @@ module ActionView
link_to_function(name, remote_function(options), html_options || options.delete(:html))
end
+ # Creates a button with an onclick event which calls a remote action
+ # via XMLHttpRequest
+ # The options for specifying the target with :url
+ # and defining callbacks is the same as link_to_remote.
+ def button_to_remote(name, options = {}, html_options = {})
+ 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