-
Notifications
You must be signed in to change notification settings - Fork 17
Home
A Tiny MCE Rich text Editor for ruby on rails applications.
- Plugin Features
1. Provides ease to add TinyMCE editor in rails forms
2. Easily configurable external plugins for editor using YML file
3. Plugin provides way to upload images and media from editor itself.
4. Uses paperclip upload with validations
5. s3 storage can be enabled
This plugin based on ja_tiny_mce plugin, thanks to ilake for his great job, i have modified and updated this plugin for our project needs, now this plugin workswith jrails(jquery), paperclip plugin.
1, Install rails_tiny_mce plugin using
ruby script/plugin install git://github.com/sandipransing/rails_tiny_mce.git
ruby script/generate rails_tiny_mce_migration
rake db:migrate
2, Install dependent plugins(if you didn’t):
rake rails_tiny_mce:plugins
The command will pull paperclip, responds_to_parent, will_paginate to your plugin directory
paperclip : git://github.com/thoughtbot/paperclip.git
responds_to_parent : http://responds-to-parent.googlecode.com/svn/trunk
will_paginate : git://github.com/mislav/will_paginate.git
3, Install jrails(jquery) plugin using
script/plugin install git://github.com/aaronchi/jrails.git
4, Add following lines inside layout:
<%= javascript_include_tag :defaults >
<= javascript_include_tiny_mce_if_used >
<= tiny_mce if using_tiny_mce? %>
5, Add following lines in controller file where Editor needs to be added:
(just like before_filter):
uses_tiny_mce(:options => AppConfig.default_mce_options, :only => [:new, :edit])
This AppConfig.default_mce_options is in config/initializers/tiny_mce_plus_config.rb, you could change the setting there
6. In your view form
Then append the following to the text area you want to transform into a TinyMCE editor.
7. Install file lists
rake rails_tiny_mce:install
will Install following files:
app
|— controller
|— attachments_controller.rb
|— helpers
|— remote_link_renderer.rb
|— models
|— print.rb
|— video.rb
|— views
|— attachments
|— show_attachment_list.html.erb
config
|— initializers
|— tiny_mce_plusconfig.rb
public
|— images
|— tiny_mce
|— javascripts
|— tiny_mce
You may custom the config in tiny_mce_plus_config.rb.
- Attention:
1, do not put
2, If you use old will_paginate plugin, maybe change the url_for to url_option in remote_link_renderer.rb
- Example use:
1, Create CRUD for post
ruby script/generate scaffold post title:string text:description
2, Run migrations
rake db:migrate
3, Add following line to posts_controller.rb
uses_tiny_mce(:options => AppConfig.default_mce_options, :only => [:new, :edit])
4, Open /views/posts/new.html.erb and /views/posts/edit.html.erb
Modifiy following line
<%= f.text_area :description >
to
<= f.text_area :description, :class => “mceEditor” %>
thats, all
any sugestions? san2821 at gmail.com, sandip at joshsoftware.com released under the MIT license