diff options
author | Rick Olson <technoweenie@gmail.com> | 2006-03-19 19:40:11 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2006-03-19 19:40:11 +0000 |
commit | f49ba114dbb330c1865682c111a9ba372cb40bda (patch) | |
tree | babadef041ae5c086a0085d4d4da748fd4c9e63d /actionpack | |
parent | a6cfb4e0e4209e06b4ba561b688ee2c3b942e3dd (diff) | |
download | rails-f49ba114dbb330c1865682c111a9ba372cb40bda.tar.gz rails-f49ba114dbb330c1865682c111a9ba372cb40bda.tar.bz2 rails-f49ba114dbb330c1865682c111a9ba372cb40bda.zip |
Add :script option to in_place_editor to support evalScripts (closes #4194) [codyfauser@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3985 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/java_script_macros_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/java_script_macros_helper_test.rb | 7 |
3 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 75c22e8e98..46a1861f67 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Add :script option to in_place_editor to support evalScripts (closes #4194) [codyfauser@gmail.com] + * Fix mixed case enumerable methods in the JavaScript Collection Proxy (closes #4314) [codyfauser@gmail.com] * Undo accidental escaping for mail_to; add regression test. [Nicholas Seckar] 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 4237909f1d..c42ee687e4 100644 --- a/actionpack/lib/action_view/helpers/java_script_macros_helper.rb +++ b/actionpack/lib/action_view/helpers/java_script_macros_helper.rb @@ -39,6 +39,7 @@ module ActionView # <tt>:options</tt>:: Pass through options to the AJAX call (see prototype's Ajax.Updater) # <tt>:with</tt>:: JavaScript snippet that should return what is to be sent # in the AJAX call, +form+ is an implicit parameter + # <tt>:script</tt>:: Instructs the in-place editor to evaluate the remote JavaScript response (default: false) def in_place_editor(field_id, options = {}) function = "new Ajax.InPlaceEditor(" function << "'#{field_id}', " @@ -54,6 +55,7 @@ module ActionView js_options['externalControl'] = "'#{options[:external_control]}'" if options[:external_control] js_options['loadTextURL'] = "'#{url_for(options[:load_text_url])}'" if options[:load_text_url] js_options['ajaxOptions'] = options[:options] if options[:options] + js_options['evalScripts'] = options[:script] if options[:script] js_options['callback'] = "function(form) { return #{options[:with]} }" if options[:with] function << (', ' + options_for_javascript(js_options)) unless js_options.empty? diff --git a/actionpack/test/template/java_script_macros_helper_test.rb b/actionpack/test/template/java_script_macros_helper_test.rb index 1a18c00e72..59fe2398e5 100644 --- a/actionpack/test/template/java_script_macros_helper_test.rb +++ b/actionpack/test/template/java_script_macros_helper_test.rb @@ -91,4 +91,11 @@ class JavaScriptMacrosHelperTest < Test::Unit::TestCase :load_text_url => { :action => "action_to_get_value" }) end + def test_in_place_editor_eval_scripts + assert_match "Ajax.InPlaceEditor('id-goes-here', 'http://www.example.com/action_to_set_value', {evalScripts:true})", + in_place_editor( 'id-goes-here', + :url => { :action => "action_to_set_value" }, + :script => true ) + end + end |