diff options
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/prototype_helper.rb | 4 | ||||
-rw-r--r-- | actionpack/test/template/prototype_helper_test.rb | 8 |
3 files changed, 8 insertions, 6 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 780ba1135f..3faf510337 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Pass multiple arguments to Element.show and Element.hide in JavaScriptGenerator instead of using iterators. [Sam Stephenson] + * Improve expire_fragment documentation. #2966 [court3nay@gmail.com] * Correct docs for automatic layout assignment. #2610. [Charles M. Gerungan] diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index 1ba607a90f..94de4613ce 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -435,12 +435,12 @@ module ActionView # Shows hidden DOM elements with the given +ids+. def show(*ids) - record "#{ids.inspect}.each(Element.show)" + record "Element.show(#{ids.map {|id| id.inspect} * ', '})" end # Hides the visible DOM elements with the given +ids+. def hide(*ids) - record "#{ids.inspect}.each(Element.hide)" + record "Element.hide(#{ids.map {|id| id.inspect} * ', '})" end private diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb index c15280dcb3..32292a7e18 100644 --- a/actionpack/test/template/prototype_helper_test.rb +++ b/actionpack/test/template/prototype_helper_test.rb @@ -179,16 +179,16 @@ class JavaScriptGeneratorTest < Test::Unit::TestCase end def test_show - assert_equal '["foo"].each(Element.show);', + assert_equal 'Element.show("foo");', @generator.show('foo') - assert_equal '["foo", "bar", "baz"].each(Element.show);', + assert_equal 'Element.show("foo", "bar", "baz");', @generator.show('foo', 'bar', 'baz') end def test_hide - assert_equal '["foo"].each(Element.hide);', + assert_equal 'Element.hide("foo");', @generator.hide('foo') - assert_equal '["foo", "bar", "baz"].each(Element.hide);', + assert_equal 'Element.hide("foo", "bar", "baz");', @generator.hide('foo', 'bar', 'baz') end |