Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10917 (new defect)

Opened 4 months ago

visual_effect escapes and alters options hash

Reported by: jeremy_walker Assigned to: madrobby
Priority: normal Milestone: 2.x
Component: script.aculo.us Version: 2.0.1
Severity: minor Keywords: visual_effect escape
Cc:

Description

visual_effect escapes the values for [:endcolor, :direction, :startcolor, :scaleMode, :restorecolor] which is great, except it alters the values passed in, meaning you cannot use the same options hash more than once.

For example:

colors = {:startcolor => "#aaaa33", :endcolor => "#111111"}
page.visual_effect :highlight, :basket_subtotal, colors
page.visual_effect :highlight, :basket_postage, colors
page.visual_effect :highlight, :basket_total, colors

produces

new Effect.Highlight("basket_subtotal",{endcolor:'#111111', startcolor:'#aaaa33'});
new Effect.Highlight("basket_postage",{endcolor:''#111111'', startcolor:''#aaaa33''});
new Effect.Highlight("basket_total",{endcolor:'''#111111''', startcolor:'''#aaaa33'''});

I think visual_effect should either check to see if the parameters are already escaped or should modify a copy of the hash.

Hope that makes sense,
Cheers - Jez