mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
restructure compatibility module so it is no longer a child
This commit is contained in:
parent
565a696e71
commit
d8343a6ad7
3 changed files with 28 additions and 25 deletions
|
@ -3,7 +3,7 @@ require 'active_support/benchmarkable'
|
||||||
module ActionView #:nodoc:
|
module ActionView #:nodoc:
|
||||||
module Helpers #:nodoc:
|
module Helpers #:nodoc:
|
||||||
autoload :ActiveModelHelper, 'action_view/helpers/active_model_helper'
|
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 :AssetTagHelper, 'action_view/helpers/asset_tag_helper'
|
||||||
autoload :AtomFeedHelper, 'action_view/helpers/atom_feed_helper'
|
autoload :AtomFeedHelper, 'action_view/helpers/atom_feed_helper'
|
||||||
autoload :CacheHelper, 'action_view/helpers/cache_helper'
|
autoload :CacheHelper, 'action_view/helpers/cache_helper'
|
||||||
|
@ -48,7 +48,7 @@ module ActionView #:nodoc:
|
||||||
include FormTagHelper
|
include FormTagHelper
|
||||||
include JavaScriptHelper
|
include JavaScriptHelper
|
||||||
include NumberHelper
|
include NumberHelper
|
||||||
include AjaxHelper
|
include AjaxHelperCompat
|
||||||
include RawOutputHelper
|
include RawOutputHelper
|
||||||
include RecordIdentificationHelper
|
include RecordIdentificationHelper
|
||||||
include RecordTagHelper
|
include RecordTagHelper
|
||||||
|
|
|
@ -154,34 +154,37 @@ module ActionView
|
||||||
def create_js_function(statements, *arguments)
|
def create_js_function(statements, *arguments)
|
||||||
"function(#{arguments.join(", ")}) {#{statements}}"
|
"function(#{arguments.join(", ")}) {#{statements}}"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# TODO: All evaled goes here per wycat
|
# TODO: All evaled goes here per wycat
|
||||||
module Rails2Compatibility
|
module AjaxHelperCompat
|
||||||
def set_callbacks(options, html)
|
include AjaxHelper
|
||||||
[:complete, :failure, :success, :interactive, :loaded, :loading].each do |type|
|
|
||||||
html["data-#{type}-code"] = options.delete(type.to_sym)
|
|
||||||
end
|
|
||||||
|
|
||||||
options.each do |option, value|
|
def set_callbacks(options, html)
|
||||||
if option.is_a?(Integer)
|
[:complete, :failure, :success, :interactive, :loaded, :loading].each do |type|
|
||||||
html["data-#{option}-code"] = options.delete(option)
|
html["data-#{type}-code"] = options.delete(type.to_sym)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
options.each do |option, value|
|
||||||
|
if option.is_a?(Integer)
|
||||||
|
html["data-#{option}-code"] = options.delete(option)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
def link_to_remote(name, url, options = nil)
|
|
||||||
if !options && url.is_a?(Hash) && url.key?(:url)
|
def link_to_remote(name, url, options = nil)
|
||||||
url, options = url.delete(:url), url
|
if !options && url.is_a?(Hash) && url.key?(:url)
|
||||||
end
|
url, options = url.delete(:url), url
|
||||||
set_callbacks(options, options[:html] ||= {})
|
|
||||||
|
|
||||||
super
|
|
||||||
end
|
end
|
||||||
|
set_callbacks(options, options[:html] ||= {})
|
||||||
|
|
||||||
def button_to_remote(name, options = {}, html_options = {})
|
super
|
||||||
set_callbacks(options, html_options)
|
end
|
||||||
super
|
|
||||||
end
|
def button_to_remote(name, options = {}, html_options = {})
|
||||||
|
html_options.merge!(:testing => true)
|
||||||
|
set_callbacks(options, html_options)
|
||||||
|
super
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -39,7 +39,7 @@ module ActionView
|
||||||
JAVASCRIPT_PATH = File.join(File.dirname(__FILE__), 'javascripts')
|
JAVASCRIPT_PATH = File.join(File.dirname(__FILE__), 'javascripts')
|
||||||
end
|
end
|
||||||
|
|
||||||
include AjaxHelper::Rails2Compatibility
|
include AjaxHelperCompat
|
||||||
|
|
||||||
# Returns a link of the given +name+ that will trigger a JavaScript +function+ using the
|
# Returns a link of the given +name+ that will trigger a JavaScript +function+ using the
|
||||||
# onclick handler and return false after the fact.
|
# onclick handler and return false after the fact.
|
||||||
|
|
Loading…
Reference in a new issue