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

Changeset 6851

Show
Ignore:
Timestamp:
05/26/07 00:32:52 (3 years ago)
Author:
bitsweat
Message:

auto_complete_field takes a :method option so you can GET or POST. Closes #8120.

Files:

Legend:

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

    r6830 r6851  
    11*SVN* 
     2 
     3* auto_complete_field takes a :method option so you can GET or POST.  #8120 [zapnap] 
    24 
    35* Added option to suppress :size when using :maxlength for FormTagHelper#text_field #3112 [rails@tpope.info] 
  • trunk/actionpack/lib/action_view/helpers/java_script_macros_helper.rb

    r6350 r6851  
    140140      #                                  insertion should be extracted. If this is not specified, 
    141141      #                                  the entire element is used. 
     142      # <tt>:method</tt>::               Specifies the HTTP verb to use when the autocompletion 
     143      #                                  request is made. Defaults to POST. 
    142144      def auto_complete_field(field_id, options = {}) 
    143145        function =  "var #{field_id}_auto_completer = new Ajax.Autocompleter(" 
     
    153155        js_options[:paramName]  = "'#{options[:param_name]}'" if options[:param_name] 
    154156        js_options[:frequency]  = "#{options[:frequency]}" if options[:frequency] 
     157        js_options[:method]     = "'#{options[:method].to_s}'" if options[:method] 
    155158 
    156159        { :after_update_element => :afterUpdateElement,  
  • trunk/actionpack/test/template/java_script_macros_helper_test.rb

    r6729 r6851  
    4141    assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {paramName:'huidriwusch'})\n//]]>\n</script>), 
    4242      auto_complete_field("some_input", :url => { :action => "autocomplete" }, :param_name => 'huidriwusch'); 
     43    assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {method:'get'})\n//]]>\n</script>), 
     44      auto_complete_field("some_input", :url => { :action => "autocomplete" }, :method => :get); 
    4345  end 
    4446