Flowdock
method

in_place_editor

Importance_3
v1.2.6 - Show latest stable - 1 note - Class: ActionView::Helpers::JavaScriptMacrosHelper
in_place_editor(field_id, options = {}) public

DEPRECATION WARNING: This method will become a separate plugin when Rails 2.0 ships.

Makes an HTML element specified by the DOM ID field_id become an in-place editor of a property.

A form is automatically created and displayed when the user clicks the element, something like this:

  <form id="myElement-in-place-edit-form" target="specified url">
    <input name="value" text="The content of myElement"/>
    <input type="submit" value="ok"/>
    <a onclick="javascript to cancel the editing">cancel</a>
  </form>

The form is serialized and sent to the server using an AJAX call, the action on the server should process the value and return the updated value in the body of the reponse. The element will automatically be updated with the changed value (as returned from the server).

Required options are:

:url:Specifies the url where the updated value should be sent after the user presses "ok".

Addtional options are:

:rows:Number of rows (more than 1 will use a TEXTAREA)
:cols:Number of characters the text input should span (works for both INPUT and TEXTAREA)
: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 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")

Show source
Register or log in to add new notes.
July 20, 2010 - (>= v1.2.6)
0 thanks