From 4fdddc331ed8236c3c0a892c20a42c03b9584e16 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 4 Sep 2006 20:41:38 +0000 Subject: Expose more options of inplace_editor (but its still going plugin with v2.0) (closes #5103) git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5002 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/java_script_macros_helper.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_view') 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 8ce2940aeb..d4a1456561 100644 --- a/actionpack/lib/action_view/helpers/java_script_macros_helper.rb +++ b/actionpack/lib/action_view/helpers/java_script_macros_helper.rb @@ -35,13 +35,15 @@ module ActionView # :size:: Synonym for :cols when using a single line text input. # :cancel_text:: The text on the cancel link. (default: "cancel") # :save_text:: The text on the save link. (default: "ok") - # :loading_text:: The text to display when submitting to the server (default: "Saving...") + # :loading_text:: The text to display while the data is being loaded from the server (default: "Loading...") + # :saving_text:: The text to display when submitting to the server (default: "Saving...") # :external_control:: The id of an external control used to enter edit mode. # :load_text_url:: URL where initial value of editor (content) is retrieved. # :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) + # :click_to_edit_text::The text shown during mouseover the editable text (default: "Click to edit") def in_place_editor(field_id, options = {}) function = "new Ajax.InPlaceEditor(" function << "'#{field_id}', " @@ -51,6 +53,7 @@ module ActionView js_options['cancelText'] = %('#{options[:cancel_text]}') if options[:cancel_text] js_options['okText'] = %('#{options[:save_text]}') if options[:save_text] js_options['loadingText'] = %('#{options[:loading_text]}') if options[:loading_text] + js_options['savingText'] = %('#{options[:saving_text]}') if options[:saving_text] js_options['rows'] = options[:rows] if options[:rows] js_options['cols'] = options[:cols] if options[:cols] js_options['size'] = options[:size] if options[:size] @@ -59,6 +62,7 @@ module ActionView 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] + js_options['clickToEditText'] = %('#{options[:click_to_edit_text]}') if options[:click_to_edit_text] function << (', ' + options_for_javascript(js_options)) unless js_options.empty? function << ')' -- cgit v1.2.3