diff options
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/scriptaculous_helper.rb | 7 | ||||
-rw-r--r-- | actionpack/test/template/scriptaculous_helper_test.rb | 6 |
3 files changed, 14 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index f167b6f453..66035496cf 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Added support for visual effects scoped queues to the visual_effect helper #3530 [Abdur-Rahman Advany] + * Added .rxml (and any non-rhtml template, really) supportfor CaptureHelper#content_for and CaptureHelper#capture #3287 [Brian Takita] * Added script.aculo.us drag and drop helpers to RJS [Thomas Fuchs]. Examples: diff --git a/actionpack/lib/action_view/helpers/scriptaculous_helper.rb b/actionpack/lib/action_view/helpers/scriptaculous_helper.rb index 5498ae1cd9..bd88b3ec0a 100644 --- a/actionpack/lib/action_view/helpers/scriptaculous_helper.rb +++ b/actionpack/lib/action_view/helpers/scriptaculous_helper.rb @@ -43,7 +43,12 @@ module ActionView # http://script.aculo.us for more documentation. def visual_effect(name, element_id = false, js_options = {}) element = element_id ? "'#{element_id}'" : "element" - js_options[:queue] = "'#{js_options[:queue]}'" if js_options[:queue] + + js_options[:queue] = if js_options[:queue].is_a?(Hash) + '{' + js_options[:queue].map {|k, v| k == :limit ? "#{k}:#{v}" : "#{k}:'#{v}'" }.join(',') + '}' + elsif js_options[:queue] + "'#{js_options[:queue]}'" + end if js_options[:queue] if TOGGLE_EFFECTS.include? name.to_sym "Effect.toggle(#{element},'#{name.to_s.gsub(/^toggle_/,'')}',#{options_for_javascript(js_options)});" diff --git a/actionpack/test/template/scriptaculous_helper_test.rb b/actionpack/test/template/scriptaculous_helper_test.rb index 779b5aa13b..80647f24c0 100644 --- a/actionpack/test/template/scriptaculous_helper_test.rb +++ b/actionpack/test/template/scriptaculous_helper_test.rb @@ -28,6 +28,12 @@ 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.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:{scope:'test',limit:2,position:'end'}});", + visual_effect(:drop_out, 'dropme', :queue => {:position => "end", :scope => "test", :limit => 2}) + assert_equal "new Effect.DropOut('dropme',{queue:{scope:'list',limit:2}});", + visual_effect(:drop_out, 'dropme', :queue => {:scope => :list, :limit => 2}) + assert_equal "new Effect.DropOut('dropme',{queue:{scope:'test',limit:2,position:'end'}});", + visual_effect(:drop_out, 'dropme', :queue => {:position => :end, :scope => :test, :limit => 2}) end def test_toggle_effects |