-
Notifications
You must be signed in to change notification settings - Fork 17
Home
RailsTinyMce
===
This plugin based on ja_tiny_mce plugin, thanks to ilake for his great job, i have modified and updated this plugin for
my project, now this plugin works with jrails(jquery), paperclip plugin.
1, Install rails_tiny_mce plugin using
script/plugin install git://github.com/funonrails/rails_tiny_mce.git
script/generate rails_tiny_mce_migration
rake db:migrate
2, Install dependent plugins(if you didn’t):
rake rails_tiny_mce:plugins
this command will copy 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
3, In your layout:
<%= javascript_include_tag :defaults >
<= javascript_include_tiny_mce_if_used >
<= tiny_mce if using_tiny_mce? %>
4, In your controller:
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
5. In your view
Then append the following to the text area you want to transform into a TinyMCE editor.
:class => “mceEditor”
6. 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
around the textarea.
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, 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