From 6450d6ca76603bc5d1b1a6cdcb77e33e35f53d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tarmo=20T=C3=A4nav?= Date: Sat, 30 Aug 2008 02:08:16 +0300 Subject: Added button_to_remote helper Ticket originally from http://dev.rubyonrails.org/ticket/3641 Signed-off-by: Jeremy Kemper --- actionpack/lib/action_view/helpers/prototype_helper.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'actionpack/lib') 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 (options[:url]) every # options[:frequency] seconds (default is 10). Usually used to # update a specified div (options[:update]) with the results -- cgit v1.2.3