Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Properly quote the arguments to visual_effect. Closes #7220 [jeremymc…

…anally]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7396 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit bde8be41fb3141e33dc86e24fa3fe6200cbb9e87 1 parent 2fc4be6
@NZKoz NZKoz authored
View
4 actionpack/lib/action_view/helpers/scriptaculous_helper.rb
@@ -50,6 +50,10 @@ def visual_effect(name, element_id = false, js_options = {})
"'#{js_options[:queue]}'"
end if js_options[:queue]
+ [:endcolor, :direction, :startcolor, :scaleMode, :restorecolor].each do |option|
+ js_options[option] = "'#{js_options[option]}'" if js_options[option]
+ end
+
if TOGGLE_EFFECTS.include? name.to_sym
"Effect.toggle(#{element},'#{name.to_s.gsub(/^toggle_/,'')}',#{options_for_javascript(js_options)});"
else
View
2  actionpack/test/template/scriptaculous_helper_test.rb
@@ -28,6 +28,8 @@ def test_effect
assert_equal "new Effect.Fade(\"fademe\",{duration:4.0});", visual_effect(:fade, "fademe", :duration => 4.0)
assert_equal "new Effect.Shake(element,{});", visual_effect(:shake)
assert_equal "new Effect.DropOut(\"dropme\",{queue:'end'});", visual_effect(:drop_out, 'dropme', :queue => :end)
+ assert_equal "new Effect.Highlight(\"status\",{endcolor:'#EEEEEE'});", visual_effect(:highlight, 'status', :endcolor => '#EEEEEE')
+ assert_equal "new Effect.Highlight(\"status\",{restorecolor:'#500000', startcolor:'#FEFEFE'});", visual_effect(:highlight, 'status', :restorecolor => '#500000', :startcolor => '#FEFEFE')
# chop the queue params into a comma separated list
beginning, ending = 'new Effect.DropOut("dropme",{queue:{', '}});'
Please sign in to comment.
Something went wrong with that request. Please try again.