Bill Burcham
2006-Feb-05 16:05 UTC
[Rails] in_place_editor is missing load_text_url option
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: <p id="editme2"><%= textilize( @fancy_text )</p> <script language="JavaScript"> new Ajax.InPlaceEditor(''editme2'', ''update_text'', {rows:15,cols:40,loadTextURL:''return_unformatted_text''}); </script> becomes this: <p id="editme2"><%= textilize( @fancy_text )</p> <%= 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. -- Posted via http://www.ruby-forum.com/.
Bill Burcham
2006-Feb-06 16:46 UTC
[Rails] Re: in_place_editor is missing load_text_url option
mkay... thunderous silence :) I took bull by horns and submitted a patch: http://dev.rubyonrails.org/ticket/3743 -- Posted via http://www.ruby-forum.com/.