From f49ba114dbb330c1865682c111a9ba372cb40bda Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Sun, 19 Mar 2006 19:40:11 +0000 Subject: 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 --- actionpack/lib/action_view/helpers/java_script_macros_helper.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actionpack/lib/action_view/helpers') 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 # :options:: Pass through options to the AJAX call (see prototype's Ajax.Updater) # :with:: JavaScript snippet that should return what is to be sent # in the AJAX call, +form+ is an implicit parameter + # :script:: 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? -- cgit v1.2.3