diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-26 00:32:52 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-26 00:32:52 +0000 |
commit | 9dac6b759f57d93247ba6e8b8d8c7b9d5638dc22 (patch) | |
tree | ee6d1266fddd827911554195847358e12e172cb9 | |
parent | 64d655628c5b61cf21fc165d6c669325c3b5b6f4 (diff) | |
download | rails-9dac6b759f57d93247ba6e8b8d8c7b9d5638dc22.tar.gz rails-9dac6b759f57d93247ba6e8b8d8c7b9d5638dc22.tar.bz2 rails-9dac6b759f57d93247ba6e8b8d8c7b9d5638dc22.zip |
auto_complete_field takes a :method option so you can GET or POST. Closes #8120.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6851 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/java_script_macros_helper.rb | 3 | ||||
-rw-r--r-- | actionpack/test/template/java_script_macros_helper_test.rb | 2 |
3 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 252e7c0ecf..7a39ec0abd 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* auto_complete_field takes a :method option so you can GET or POST. #8120 [zapnap] + * Added option to suppress :size when using :maxlength for FormTagHelper#text_field #3112 [rails@tpope.info] * catch possible WSOD when trying to render a missing partial. Closes #8454 [Catfish] diff --git a/actionpack/lib/action_view/helpers/java_script_macros_helper.rb b/actionpack/lib/action_view/helpers/java_script_macros_helper.rb index 0d9e87fba0..d346f0367c 100644 --- a/actionpack/lib/action_view/helpers/java_script_macros_helper.rb +++ b/actionpack/lib/action_view/helpers/java_script_macros_helper.rb @@ -139,6 +139,8 @@ module ActionView # <tt>:select</tt>:: Pick the class of the element from which the value for # insertion should be extracted. If this is not specified, # the entire element is used. + # <tt>:method</tt>:: Specifies the HTTP verb to use when the autocompletion + # request is made. Defaults to POST. def auto_complete_field(field_id, options = {}) function = "var #{field_id}_auto_completer = new Ajax.Autocompleter(" function << "'#{field_id}', " @@ -152,6 +154,7 @@ module ActionView js_options[:select] = "'#{options[:select]}'" if options[:select] js_options[:paramName] = "'#{options[:param_name]}'" if options[:param_name] js_options[:frequency] = "#{options[:frequency]}" if options[:frequency] + js_options[:method] = "'#{options[:method].to_s}'" if options[:method] { :after_update_element => :afterUpdateElement, :on_show => :onShow, :on_hide => :onHide, :min_chars => :minChars }.each do |k,v| diff --git a/actionpack/test/template/java_script_macros_helper_test.rb b/actionpack/test/template/java_script_macros_helper_test.rb index 13318958c8..961f12cf32 100644 --- a/actionpack/test/template/java_script_macros_helper_test.rb +++ b/actionpack/test/template/java_script_macros_helper_test.rb @@ -40,6 +40,8 @@ class JavaScriptMacrosHelperTest < Test::Unit::TestCase :after_update_element => "function(element,value){alert('You have chosen: '+value)}"); 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>), auto_complete_field("some_input", :url => { :action => "autocomplete" }, :param_name => 'huidriwusch'); + 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>), + auto_complete_field("some_input", :url => { :action => "autocomplete" }, :method => :get); end def test_auto_complete_result |