Skip to content
Newer
Older
100644 135 lines (97 sloc) 3.7 KB
62906b4 README
Sandip Ransing authored
1 # RailsTinyMCE - A Rich Text Editor for rails 3
3c64208 @sandipransing modified
authored
2
139e03b @sandipransing Readme added
authored
3 TinyMCE is a javascript rich text editor. It is easy to integrate with blogs, cms, messages and mailers.
5a183f2 @sandipransing modified
authored
4
9bcdc1b README & dependency gems
Sandip Ransing authored
5 Plugin uses jrails(jQuery) and Paperclip plugin for image & media upload support
885ca90 @sandipransing modified
authored
6
7 Features
8 --------------
9bcdc1b README & dependency gems
Sandip Ransing authored
9 - Provides Rich Text Editor
885ca90 @sandipransing modified
authored
10 - Customisable TinyMCE plugins
11 - Easy to integrate
12 - Supports Image upload & insert
13 - Supports Media upload & Youtube embed
14 - TODO: Document upload plugin
15
9bcdc1b README & dependency gems
Sandip Ransing authored
16 1. Installation
020d089 @sandipransing modified
authored
17 ---------------------
70b938f Rails 3 changes
Sandip Ransing authored
18 rails plugin install git://github.com/sandipransing/rails_tiny_mce.git
9bcdc1b README & dependency gems
Sandip Ransing authored
19
20 2. Migrations
21 ---------------------
51c2832 Rails 3 migration file generator
Sandip Ransing authored
22 rails g tiny_migration
88743ac @sandipransing modified
authored
23
24 rake db:migrate
f0f9ddd @sandipransing README added
authored
25
0254ff4 @sandipransing modified
authored
26 2. Install jrails(jquery) plugin using
9bcdc1b README & dependency gems
Sandip Ransing authored
27 ---------------------
70b938f Rails 3 changes
Sandip Ransing authored
28 rails plugin install git://github.com/aaronchi/jrails.git
f0f9ddd @sandipransing README added
authored
29
62906b4 README
Sandip Ransing authored
30 3. Install dependent plugins(if you did not already)
9bcdc1b README & dependency gems
Sandip Ransing authored
31 ---------------------
88743ac @sandipransing modified
authored
32 rake rails_tiny_mce:plugins
f0f9ddd @sandipransing README added
authored
33
9bcdc1b README & dependency gems
Sandip Ransing authored
34 Above command will copy `paperclip`, `respond_to_parent`, `will_paginate` plugins to vendor/plugins directory.
f0f9ddd @sandipransing README added
authored
35
4dfb7aa README
Sandip Ransing authored
36 - paperclip `git://github.com/thoughtbot/paperclip.git`
37 - respond_to_parent `git://github.com/itkin/respond_to_parent.git`
38 - will_paginate `git://github.com/mislav/will_paginate.git`
f0f9ddd @sandipransing README added
authored
39
020d089 @sandipransing modified
authored
40 4. In your layout add following lines
9bcdc1b README & dependency gems
Sandip Ransing authored
41 ---------------------
88743ac @sandipransing modified
authored
42 <%= javascript_include_tag :defaults %>
43 <%= javascript_include_tiny_mce_if_used %>
44 <%= tiny_mce if using_tiny_mce? %>
f0f9ddd @sandipransing README added
authored
45
020d089 @sandipransing modified
authored
46 5. Inside controller class on top add following lines
9bcdc1b README & dependency gems
Sandip Ransing authored
47 ---------------------
88743ac @sandipransing modified
authored
48 uses_tiny_mce(:options => AppConfig.default_mce_options, :only => [:new, :edit])
f0f9ddd @sandipransing README added
authored
49
9bcdc1b README & dependency gems
Sandip Ransing authored
50 This AppConfig.default_mce_options is in `config/initializers/tiny_mce_plus_config.rb`, you could change the setting there
f0f9ddd @sandipransing README added
authored
51
020d089 @sandipransing modified
authored
52 6. In your view add class mceEditor to text_area
9bcdc1b README & dependency gems
Sandip Ransing authored
53 ---------------------
f0f9ddd @sandipransing README added
authored
54 Then append the following to the text area you want to transform into a TinyMCE editor.
62906b4 README
Sandip Ransing authored
55 :class => :mceEditor
f0f9ddd @sandipransing README added
authored
56
77a3e17 @sandipransing modified README
authored
57 7. Install file lists
9bcdc1b README & dependency gems
Sandip Ransing authored
58 ---------------------
88743ac @sandipransing modified
authored
59 rake rails_tiny_mce:install
f0f9ddd @sandipransing README added
authored
60
9bcdc1b README & dependency gems
Sandip Ransing authored
61 will install following files:
f0f9ddd @sandipransing README added
authored
62
88743ac @sandipransing modified
authored
63 app
64 |-- controller
65 |-- attachments_controller.rb
66 |-- helpers
67 |-- remote_link_renderer.rb
68 |-- models
69 |-- print.rb
70 |-- video.rb
71 |-- views
72 |-- attachments
73 |-- _show_attachment_list.html.erb
74 config
75 |-- initializers
76 |-- tiny_mce_plus_config.rb
77 public
78 |-- images
79 |-- tiny_mce
80 |-- javascripts
81 |-- tiny_mce
f0f9ddd @sandipransing README added
authored
82
83 You may custom the config in tiny_mce_plus_config.rb.
84
77a3e17 @sandipransing modified README
authored
85 ## Attention Note:
9bcdc1b README & dependency gems
Sandip Ransing authored
86 * Do not put `\<p> \</p>` around the textarea.
87 * If you are using `old will_paginate plugin`, change the *url_for* to *url_option* in *remote_link_renderer.rb*
ccc3c39 Will Paginate edge version help
Sandip Ransing authored
88 * If you are using <pre>gem "will_paginate", "~> 3.0.pre2"</pre> you need changes in app/helpers/remote_link_renderer.rb
89 class RemoteLinkRenderer < WillPaginate::LinkRenderer
90 to
91 class RemoteLinkRenderer < WillPaginate::ViewHelpers::LinkRenderer
92
77a3e17 @sandipransing modified README
authored
93 ## Example use:
e3302df @sandipransing modified
authored
94
88743ac @sandipransing modified
authored
95 - Create CRUD for post
14b51e0 @sandipransing modified
authored
96
70b938f Rails 3 changes
Sandip Ransing authored
97 rails g scaffold post title:string text:description
f0f9ddd @sandipransing README added
authored
98
88743ac @sandipransing modified
authored
99 - Run Migrations
14b51e0 @sandipransing modified
authored
100
88743ac @sandipransing modified
authored
101 rake db:migrate
f0f9ddd @sandipransing README added
authored
102
e3302df @sandipransing modified
authored
103 - Add following line to *posts_controller.rb*
14b51e0 @sandipransing modified
authored
104
0254ff4 @sandipransing modified
authored
105 uses_tiny_mce(:options => AppConfig.default_mce_options, :only => [:new, :edit])
f0f9ddd @sandipransing README added
authored
106
70b938f Rails 3 changes
Sandip Ransing authored
107 - Open */views/posts/_form.html.erb*
14b51e0 @sandipransing modified
authored
108
109 - Modifiy following line
110
88743ac @sandipransing modified
authored
111 <%= f.text_area :description %>
f0f9ddd @sandipransing README added
authored
112 to
62906b4 README
Sandip Ransing authored
113 <%= f.text_area :description, :class => :mceEditor %>
f0f9ddd @sandipransing README added
authored
114
daff358 @sandipransing GET IMAGE from html content
authored
115 ## FAQ
116 1. How to get image from post body
117
c779718 @sandipransing IMAGE URL
authored
118 #Add imagepath method in post model
daff358 @sandipransing GET IMAGE from html content
authored
119 def imagepath
120 match = body.match(/img src="(.+)" border/)
121 $1 if match
122 end
123
124 And use *post.imagepath* to get url of image embeded in post content
125
5a183f2 @sandipransing modified
authored
126 ## Contributors
e3302df @sandipransing modified
authored
127
88743ac @sandipransing modified
authored
128 1. Sandip Ransing, Josh Software Private Limited
5a183f2 @sandipransing modified
authored
129 2. ilake
88743ac @sandipransing modified
authored
130
f0f9ddd @sandipransing README added
authored
131 thats, all
132
70b938f Rails 3 changes
Sandip Ransing authored
133 any sugestions? **sandip at funonrails.com** or **sandip at joshsoftware.com** released under the MIT license
daff358 @sandipransing GET IMAGE from html content
authored
134
Something went wrong with that request. Please try again.