Permalink
Browse files

constants everywhere

  • Loading branch information...
1 parent 5ce636f commit 44f1ec57024b7dc02bd6e9481e777eb3e7ebdefc @rjspotter committed Feb 4, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 lib/action_view/helpers/prototype_helper.rb
View
14 lib/action_view/helpers/prototype_helper.rb
@@ -95,6 +95,11 @@ module Helpers
# See JavaScriptGenerator for information on updating multiple elements
# on the page in an Ajax response.
module PrototypeHelper
+
+ unless const_defined? :JQUERY_VAR
+ JQUERY_VAR = 'jQuery'
+ end
+
CALLBACKS = Set.new([ :beforeSend, :complete, :error, :success ] + (100..599).to_a)
AJAX_OPTIONS = Set.new([ :before, :after, :condition, :url,
:asynchronous, :method, :insertion, :position,
@@ -753,6 +758,11 @@ def append_to_function_chain!(call)
end
class JavaScriptElementProxy < JavaScriptProxy #:nodoc:
+
+ unless const_defined? :JQUERY_VAR
+ JQUERY_VAR = PrototypeHelper::JQUERY_VAR
+ end
+
def initialize(generator, id)
@id = id
super(generator, "#{JQUERY_VAR}(\"#{id}\")")
@@ -911,6 +921,10 @@ def append_enumerable_function!(call)
end
class JavaScriptElementCollectionProxy < JavaScriptCollectionProxy #:nodoc:\
+ unless const_defined? :JQUERY_VAR
+ JQUERY_VAR = PrototypeHelper::JQUERY_VAR
+ end
+
def initialize(generator, pattern)
super(generator, "#{JQUERY_VAR}(#{::ActiveSupport::JSON.encode(pattern)})")
end

0 comments on commit 44f1ec5

Please sign in to comment.