aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorStephen St. Martin <kuprishuz@gmail.com>2010-01-23 15:33:05 -0500
committerStefan Penner <stefan.penner@gmail.com>2010-01-27 12:44:32 -0600
commitd8343a6ad7d6bffb88a075cb9e575d85e098e4b1 (patch)
tree747484663d177a4d8ec6e24e9baee3282ea70e06 /actionpack
parent565a696e71606a6e4dfe5b1c7f9fadbce50e04b1 (diff)
downloadrails-d8343a6ad7d6bffb88a075cb9e575d85e098e4b1.tar.gz
rails-d8343a6ad7d6bffb88a075cb9e575d85e098e4b1.tar.bz2
rails-d8343a6ad7d6bffb88a075cb9e575d85e098e4b1.zip
restructure compatibility module so it is no longer a child
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/helpers.rb4
-rw-r--r--actionpack/lib/action_view/helpers/ajax_helper.rb47
-rw-r--r--actionpack/lib/action_view/helpers/javascript_helper.rb2
3 files changed, 28 insertions, 25 deletions
diff --git a/actionpack/lib/action_view/helpers.rb b/actionpack/lib/action_view/helpers.rb
index 268ea984e3..215a697cce 100644
--- a/actionpack/lib/action_view/helpers.rb
+++ b/actionpack/lib/action_view/helpers.rb
@@ -3,7 +3,7 @@ require 'active_support/benchmarkable'
module ActionView #:nodoc:
module Helpers #:nodoc:
autoload :ActiveModelHelper, 'action_view/helpers/active_model_helper'
- autoload :AjaxHelper, 'action_view/helpers/ajax_helper'
+ autoload :AjaxHelperCompat, 'action_view/helpers/ajax_helper'
autoload :AssetTagHelper, 'action_view/helpers/asset_tag_helper'
autoload :AtomFeedHelper, 'action_view/helpers/atom_feed_helper'
autoload :CacheHelper, 'action_view/helpers/cache_helper'
@@ -48,7 +48,7 @@ module ActionView #:nodoc:
include FormTagHelper
include JavaScriptHelper
include NumberHelper
- include AjaxHelper
+ include AjaxHelperCompat
include RawOutputHelper
include RecordIdentificationHelper
include RecordTagHelper
diff --git a/actionpack/lib/action_view/helpers/ajax_helper.rb b/actionpack/lib/action_view/helpers/ajax_helper.rb
index 550f7fbbe2..ab4f5d53e9 100644
--- a/actionpack/lib/action_view/helpers/ajax_helper.rb
+++ b/actionpack/lib/action_view/helpers/ajax_helper.rb
@@ -154,34 +154,37 @@ module ActionView
def create_js_function(statements, *arguments)
"function(#{arguments.join(", ")}) {#{statements}}"
end
+ end
- # TODO: All evaled goes here per wycat
- module Rails2Compatibility
- def set_callbacks(options, html)
- [:complete, :failure, :success, :interactive, :loaded, :loading].each do |type|
- html["data-#{type}-code"] = options.delete(type.to_sym)
- end
+ # TODO: All evaled goes here per wycat
+ module AjaxHelperCompat
+ include AjaxHelper
- options.each do |option, value|
- if option.is_a?(Integer)
- html["data-#{option}-code"] = options.delete(option)
- end
- end
+ def set_callbacks(options, html)
+ [:complete, :failure, :success, :interactive, :loaded, :loading].each do |type|
+ html["data-#{type}-code"] = options.delete(type.to_sym)
end
-
- def link_to_remote(name, url, options = nil)
- if !options && url.is_a?(Hash) && url.key?(:url)
- url, options = url.delete(:url), url
+
+ options.each do |option, value|
+ if option.is_a?(Integer)
+ html["data-#{option}-code"] = options.delete(option)
end
- set_callbacks(options, options[:html] ||= {})
-
- super
end
-
- def button_to_remote(name, options = {}, html_options = {})
- set_callbacks(options, html_options)
- super
+ end
+
+ def link_to_remote(name, url, options = nil)
+ if !options && url.is_a?(Hash) && url.key?(:url)
+ url, options = url.delete(:url), url
end
+ set_callbacks(options, options[:html] ||= {})
+
+ super
+ end
+
+ def button_to_remote(name, options = {}, html_options = {})
+ html_options.merge!(:testing => true)
+ set_callbacks(options, html_options)
+ super
end
end
end
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb
index 9f6ec28a9e..adb35ccfa2 100644
--- a/actionpack/lib/action_view/helpers/javascript_helper.rb
+++ b/actionpack/lib/action_view/helpers/javascript_helper.rb
@@ -39,7 +39,7 @@ module ActionView
JAVASCRIPT_PATH = File.join(File.dirname(__FILE__), 'javascripts')
end
- include AjaxHelper::Rails2Compatibility
+ include AjaxHelperCompat
# Returns a link of the given +name+ that will trigger a JavaScript +function+ using the
# onclick handler and return false after the fact.