In_place_editor is missing load_text_url option


#1

Ajax.InPlaceEditor supports a loadTextURL option. If you look at the
InPlaceEditor page
(http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor)
you’ll see an excellent example in Rails of how you might use that
option textilize in place edited stuff.

Unfortunately, the example doesn’t use the nifty Rails in_place_editor
method because
ActionView::Helpers::JavaScriptMacrosHelper#in_place_editor doesn’t
suppport a load_text_url option (that would ostensibly be passed on to
the AJAX constructor as loadTextURL). Dissapointed.

I added this line to in_place_editor:

js_options[‘loadTextURL’] = “’#{url_for(options[:load_text_url])}’” if
options[:load_text_url]

And now I’m able to create in place editors that get their original text
from the server (not from the DOM). So from the scriptaculous example,
this code:

<%= textilize( @fancy_text )

becomes this:

<%= textilize( @fancy_text )

<%= in_place_editor( editme2', :url => "update_text", :load_text_url => "return_unformatted_text", :rows => 20 )%>

aside: notice that I elided the :cols option in my example because
in_place_editor is missing the cols option as well…

Anyhoo, so my questions are:

  1. is this a worthy change?
  2. what is the process for getting the change reflected in “edge”?
  3. do you think we should add the rest of the missing options (e.g.
    cols) while we’re about it?

Or is the prevailing philosophy that if you need to do “sophisticated”
stuff then don’t call in_place_editor – just code the JavaScript
directly? Or actually, maybe all this is moot with RJS templates and
all.


#2

mkay… thunderous silence :slight_smile: I took bull by horns and submitted a
patch: http://dev.rubyonrails.org/ticket/3743


#3

woops – that last comment referred to the wrong patch ticket. Here’s
the right one: http://dev.rubyonrails.org/ticket/3746