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

Changeset 3116

Show
Ignore:
Timestamp:
11/21/05 01:54:36 (3 years ago)
Author:
sam
Message:

Pass multiple arguments to Element.show and Element.hide in JavaScriptGenerator instead of using iterators

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r3115 r3116  
    11*SVN* 
     2 
     3* Pass multiple arguments to Element.show and Element.hide in JavaScriptGenerator instead of using iterators. [Sam Stephenson] 
    24 
    35* Improve expire_fragment documentation.  #2966 [court3nay@gmail.com] 
  • trunk/actionpack/lib/action_view/helpers/prototype_helper.rb

    r3086 r3116  
    436436        # Shows hidden DOM elements with the given +ids+. 
    437437        def show(*ids) 
    438           record "#{ids.inspect}.each(Element.show)" 
     438          record "Element.show(#{ids.map {|id| id.inspect} * ', '})" 
    439439        end 
    440440   
    441441        # Hides the visible DOM elements with the given +ids+. 
    442442        def hide(*ids) 
    443           record "#{ids.inspect}.each(Element.hide)" 
     443          record "Element.hide(#{ids.map {|id| id.inspect} * ', '})" 
    444444        end 
    445445 
  • trunk/actionpack/test/template/prototype_helper_test.rb

    r3086 r3116  
    180180   
    181181  def test_show 
    182     assert_equal '["foo"].each(Element.show);', 
     182    assert_equal 'Element.show("foo");', 
    183183      @generator.show('foo') 
    184     assert_equal '["foo", "bar", "baz"].each(Element.show);', 
     184    assert_equal 'Element.show("foo", "bar", "baz");', 
    185185      @generator.show('foo', 'bar', 'baz') 
    186186  end 
    187187   
    188188  def test_hide 
    189     assert_equal '["foo"].each(Element.hide);', 
     189    assert_equal 'Element.hide("foo");', 
    190190      @generator.hide('foo') 
    191     assert_equal '["foo", "bar", "baz"].each(Element.hide);', 
     191    assert_equal 'Element.hide("foo", "bar", "baz");', 
    192192      @generator.hide('foo', 'bar', 'baz') 
    193193  end