aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-09-04 20:41:38 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-09-04 20:41:38 +0000
commit4fdddc331ed8236c3c0a892c20a42c03b9584e16 (patch)
treebf5fabedb420f80a0c343d93fb3dcc0d4c54f522 /actionpack
parentc2054c42891a9d99385535209e643c878bb42a35 (diff)
downloadrails-4fdddc331ed8236c3c0a892c20a42c03b9584e16.tar.gz
rails-4fdddc331ed8236c3c0a892c20a42c03b9584e16.tar.bz2
rails-4fdddc331ed8236c3c0a892c20a42c03b9584e16.zip
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
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/helpers/java_script_macros_helper.rb6
1 files changed, 5 insertions, 1 deletions
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
# <tt>:size</tt>:: Synonym for :cols when using a single line text input.
# <tt>:cancel_text</tt>:: The text on the cancel link. (default: "cancel")
# <tt>:save_text</tt>:: The text on the save link. (default: "ok")
- # <tt>:loading_text</tt>:: The text to display when submitting to the server (default: "Saving...")
+ # <tt>:loading_text</tt>:: The text to display while the data is being loaded from the server (default: "Loading...")
+ # <tt>:saving_text</tt>:: The text to display when submitting to the server (default: "Saving...")
# <tt>:external_control</tt>:: The id of an external control used to enter edit mode.
# <tt>:load_text_url</tt>:: URL where initial value of editor (content) is retrieved.
# <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)
+ # <tt>:click_to_edit_text</tt>::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 << ')'