diff options
author | Gonçalo Silva <goncalossilva@gmail.com> | 2010-06-30 23:01:30 +0100 |
---|---|---|
committer | Gonçalo Silva <goncalossilva@gmail.com> | 2010-06-30 23:01:30 +0100 |
commit | d2c633ba0bfb7baacdee89a46d7d036d24c68817 (patch) | |
tree | 8f0974852b51597652e6ae73da26f3eb80fe878b /actionpack/lib/action_view/helpers/prototype_helper.rb | |
parent | 92c0f17d6d2a958d3a6285b0e5408e9e0e7122e1 (diff) | |
parent | c63cf7bf0db708fe46a929cf57649ab5a92034af (diff) | |
download | rails-d2c633ba0bfb7baacdee89a46d7d036d24c68817.tar.gz rails-d2c633ba0bfb7baacdee89a46d7d036d24c68817.tar.bz2 rails-d2c633ba0bfb7baacdee89a46d7d036d24c68817.zip |
Merge branch 'master' of http://github.com/rails/rails
Diffstat (limited to 'actionpack/lib/action_view/helpers/prototype_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/prototype_helper.rb | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index a798c3eaef..5c0ff5d59c 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -1,9 +1,9 @@ require 'set' require 'active_support/json' -require 'active_support/core_ext/object/returning' require 'active_support/core_ext/object/blank' module ActionView + # = Action View Prototype Helpers module Helpers # Prototype[http://www.prototypejs.org/] is a JavaScript library that provides # DOM[http://en.wikipedia.org/wiki/Document_Object_Model] manipulation, @@ -94,14 +94,12 @@ module ActionView # See JavaScriptGenerator for information on updating multiple elements # on the page in an Ajax response. module PrototypeHelper - unless const_defined? :CALLBACKS - CALLBACKS = Set.new([ :create, :uninitialized, :loading, :loaded, - :interactive, :complete, :failure, :success ] + - (100..599).to_a) - AJAX_OPTIONS = Set.new([ :before, :after, :condition, :url, - :asynchronous, :method, :insertion, :position, - :form, :with, :update, :script, :type ]).merge(CALLBACKS) - end + CALLBACKS = Set.new([ :create, :uninitialized, :loading, :loaded, + :interactive, :complete, :failure, :success ] + + (100..599).to_a) + AJAX_OPTIONS = Set.new([ :before, :after, :condition, :url, + :asynchronous, :method, :insertion, :position, + :form, :with, :update, :script, :type ]).merge(CALLBACKS) # Returns the JavaScript needed for a remote function. # Takes the same arguments as link_to_remote. @@ -133,7 +131,7 @@ module ActionView url_options = options[:url] url_options = url_options.merge(:escape => false) if url_options.is_a?(Hash) - function << "'#{escape_javascript(url_for(url_options))}'" + function << "'#{html_escape(escape_javascript(url_for(url_options)))}'" function << ", #{javascript_options})" function = "#{options[:before]}; #{function}" if options[:before] @@ -229,7 +227,7 @@ module ActionView # <script> tag. module GeneratorMethods def to_s #:nodoc: - returning javascript = @lines * $/ do + (@lines * $/).tap do |javascript| if ActionView::Base.debug_rjs source = javascript.dup javascript.replace "try {\n#{source}\n} catch (e) " @@ -531,9 +529,9 @@ module ActionView end def record(line) - returning line = "#{line.to_s.chomp.gsub(/\;\z/, '')};" do - self << line - end + line = "#{line.to_s.chomp.gsub(/\;\z/, '')};" + self << line + line end def render(*options) |