Railsify!

In Place Rich Editor

In Place Rich Editor

Author : Mathieu Fosse

In Place Rich Editor is a Rails plugin. It aims to enrich the classical “In Place Editor” helper with WYSIWYG features.

This Rails plugin use :

  • the TinyMCE javascript library TinyMCE released as Open Source under LGPL by Moxiecode Systems AB. And available here : http://tinymce.moxiecode.com
  • the ‘tiny_mce’ rails plugin of Blake Watters This plugin was developed by Blake Watters(http://thatswhatimtalkingabout.org) under the sponsorship of Near-Time (http://www.near-time.com). Avaible here : “https://secure.near-time.com/svn/plugins/trunk/tiny_mce”https://secure.near-time.com/svn/plugins/trunk/tiny_mce
  • A javascript code found in the Rails Trac The Javascript code of the ticket of ‘patrys@pld-linux.org’ in the Ruby On Rails Trac available here: “http://dev.rubyonrails.org/ticket/5263”http://dev.rubyonrails.org/ticket/5263

Usage

Install

$ cd RAILS_ROOT/vendor/plugins
$ svn checkout http://svn.kawooa.org/svn/plugins/in_place_rich_editor

And run this command to install the necessary Javascript Library :

$ rake ipre:install

Enjoy !

Example

In your Layout :

Ipre example <%= javascript_include_tag :defaults, :ipre %> <%= ipre_init_if_used %> <%= yield %>

In your controller :

class Post < ActionController::Base
    in_place_rich_edit_for(:post, :content, {:theme => "advanced", 
        :theme_advanced_toolbar_location => "top",
        :theme_advanced_buttons2 => "", 
        :theme_advanced_buttons3 => ""}, :only => :show)
end

In your view :

<%= in_place_rich_editor_field(:post, :content, {}, {:rows => 20}) %>