Skip to content
Browse files

Pass multiple arguments to Element.show and Element.hide in JavaScrip…

…tGenerator instead of using iterators

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3116 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent a0293c8 commit f212c88315a15922df408395ba3d4b85187019f5 @sstephenson sstephenson committed Nov 21, 2005
View
2 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]
View
4 actionpack/lib/action_view/helpers/prototype_helper.rb
@@ -435,12 +435,12 @@ def remove(*ids)
# 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
View
8 actionpack/test/template/prototype_helper_test.rb
@@ -179,16 +179,16 @@ def test_remove
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

0 comments on commit f212c88

Please sign in to comment.
Something went wrong with that request. Please try again.