Forum: Ruby on Rails Edit in Place

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
91a469d9f43a066babfd5531311d0fd1?d=identicon&s=25 Rath --- (rath)
on 2006-02-18 01:56
I need help using In Place Editor by script.aculo.us

#controller
def my_action
    #get the text to display initially
    @fancy_text = "Some fancy *bold* and _emphasized_ text."
end

def update_text
    #save your text here, and return the saved value
    @fancy_text = params[:value]
    render :layout => false, :inline => "<%= textilize( @fancy_text )
%>"
end

def return_unformatted_text
    #get your text and return it without the formatting
    @fancy_text = "Some fancy edited, *bold* and _emphasized_ text."
    render :layout => false, :inline => "<%= @fancy_text %>"
end

#view ( of my_action.rhtml )
<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>

They have this example at their site. What else should I do because if
doing just that, it doesn't work.

Thanks
91a469d9f43a066babfd5531311d0fd1?d=identicon&s=25 Rath --- (rath)
on 2006-02-18 02:03
I have installed RedCloth already: gem install redcloth

Should I also include require 'redCloth' somewhere?
1e99128ebac5ca41c91940291d315332?d=identicon&s=25 Luke Redpath (Guest)
on 2006-02-18 02:32
(Received via mailing list)
No need to do that.

Cheers
Luke Redpath
91a469d9f43a066babfd5531311d0fd1?d=identicon&s=25 Rath --- (rath)
on 2006-02-18 05:05
Thanks Luke,

Finally it is working, I didn't add the controls.js file.
This topic is locked and can not be replied to.