1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Properly quote the arguments to visual_effect. Closes #7220 [jeremymcanally]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7396 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Michael Koziarski 2007-09-02 23:51:27 +00:00
parent 2fc4be68a6
commit bde8be41fb
2 changed files with 6 additions and 0 deletions

View file

@ -50,6 +50,10 @@ module ActionView
"'#{js_options[:queue]}'" "'#{js_options[:queue]}'"
end if 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 if TOGGLE_EFFECTS.include? name.to_sym
"Effect.toggle(#{element},'#{name.to_s.gsub(/^toggle_/,'')}',#{options_for_javascript(js_options)});" "Effect.toggle(#{element},'#{name.to_s.gsub(/^toggle_/,'')}',#{options_for_javascript(js_options)});"
else else

View file

@ -28,6 +28,8 @@ class ScriptaculousHelperTest < Test::Unit::TestCase
assert_equal "new Effect.Fade(\"fademe\",{duration:4.0});", visual_effect(:fade, "fademe", :duration => 4.0) 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.Shake(element,{});", visual_effect(:shake)
assert_equal "new Effect.DropOut(\"dropme\",{queue:'end'});", visual_effect(:drop_out, 'dropme', :queue => :end) 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 # chop the queue params into a comma separated list
beginning, ending = 'new Effect.DropOut("dropme",{queue:{', '}});' beginning, ending = 'new Effect.DropOut("dropme",{queue:{', '}});'