rails_kindeditor 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{README.rdoc → README.md} +87 -40
- data/lib/generators/rails_kindeditor/migration/templates/migration/migration.rb +1 -1
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/asset.rb +2 -2
- data/lib/rails_kindeditor/version.rb +1 -1
- data/rails_kindeditor.gemspec +1 -0
- metadata +20 -4
data/{README.rdoc → README.md}
RENAMED
@@ -1,37 +1,48 @@
|
|
1
|
-
|
1
|
+
# Kindeditor for Ruby on Rails
|
2
2
|
|
3
|
-
Kindeditor is a WYSIWYG
|
3
|
+
Kindeditor is a WYSIWYG javascript editor, visit http://www.kindsoft.net for details.
|
4
4
|
rails_kindeditor will helps your rails app integrate with kindeditor, includes images and files uploading.
|
5
5
|
|
6
|
-
Deprecation: rails_kindeditor ~> v0.3.0 only support Rails3.1+!
|
6
|
+
Deprecation: rails_kindeditor ~> v0.3.0 only support Rails3.1+!(include Rails3.1 and Rails3.2)
|
7
|
+
If you're using rails3.0.x, please check rails_kindeditor v0.2.8
|
7
8
|
|
8
|
-
|
9
|
+
<img src="https://github.com/Macrow/rails_kindeditor/raw/master/screenshots/rails_kindeditor.png" alt="rails_indeditor">
|
9
10
|
|
10
|
-
|
11
|
+
## Installation and usage
|
11
12
|
|
12
|
-
Add this to your Gemfile
|
13
|
+
### Add this to your Gemfile
|
13
14
|
|
15
|
+
```ruby
|
14
16
|
gem 'rails_kindeditor', '~> 0.3.0'
|
17
|
+
```
|
15
18
|
|
16
|
-
Run "bundle" command.
|
19
|
+
### Run "bundle" command.
|
17
20
|
|
21
|
+
```bash
|
18
22
|
bundle
|
23
|
+
```
|
19
24
|
|
20
|
-
Run install generator:
|
25
|
+
### Run install generator:
|
21
26
|
|
27
|
+
```bash
|
22
28
|
rails generate rails_kindeditor:install
|
29
|
+
```
|
23
30
|
|
24
|
-
Include kindeditor javascripts for assets pipeline in your application.js:
|
31
|
+
### Include kindeditor javascripts for assets pipeline in your application.js:
|
25
32
|
|
33
|
+
```ruby
|
26
34
|
//= require kindeditor
|
35
|
+
```
|
27
36
|
|
28
|
-
Usage:
|
37
|
+
### Usage:
|
29
38
|
|
39
|
+
```ruby
|
30
40
|
1. <%= kindeditor_tag :content, 'default content value' %>
|
31
41
|
# or <%= kindeditor_tag :content, 'default content value', :width => 800, :height => 300 %>
|
32
42
|
# or <%= kindeditor_tag :content, 'default content value', :allowFileManager => false %>
|
43
|
+
```
|
33
44
|
|
34
|
-
|
45
|
+
```ruby
|
35
46
|
2. <%= form_for @article do |f| -%>
|
36
47
|
...
|
37
48
|
<%= f.kindeditor :content %>
|
@@ -39,25 +50,31 @@ Usage:
|
|
39
50
|
# or <%= f.kindeditor :content, :allowFileManager => false %>
|
40
51
|
...
|
41
52
|
<% end -%>
|
53
|
+
```
|
42
54
|
|
43
55
|
That's all.
|
44
56
|
|
45
|
-
|
57
|
+
## SimpleForm and Formtastic integration
|
46
58
|
|
47
|
-
simple_form:
|
59
|
+
### simple_form:
|
48
60
|
|
61
|
+
```ruby
|
49
62
|
<%= form.input :content, :as => :kindeditor, :label => false, :input_html => { :width => 800, :height => 300 } %>
|
63
|
+
```
|
50
64
|
|
51
|
-
formtastic:
|
65
|
+
### formtastic:
|
52
66
|
|
67
|
+
```ruby
|
53
68
|
<%= form.input :content, :as => :kindeditor %>
|
54
69
|
<%= form.input :content, :as => :kindeditor, :input_html => { :height => 300 } %>
|
70
|
+
```
|
55
71
|
|
56
|
-
|
72
|
+
## Upload options configuration
|
57
73
|
|
58
74
|
When you run "rails generate rails_kindeditor:install", installer will copy configuration files in config/initializers folder.
|
59
75
|
You can customize some option for uploading.
|
60
76
|
|
77
|
+
```ruby
|
61
78
|
# Specify the subfolders in public directory.
|
62
79
|
# You can customize it , eg: config.upload_dir = 'this/is/my/folder'
|
63
80
|
config.upload_dir = 'uploads'
|
@@ -73,57 +90,75 @@ You can customize some option for uploading.
|
|
73
90
|
# 1600x800 => 800x400
|
74
91
|
# 400x400 => 800x800
|
75
92
|
# config.image_resize_to_fit = [800, 800]
|
93
|
+
```
|
76
94
|
|
77
|
-
|
95
|
+
## Save upload file information into database(optional)
|
78
96
|
|
79
97
|
rails_kindeditor can save upload file information into database.
|
80
98
|
|
81
|
-
Just run migration generate, there are two ORM options for you: 1.active_record 2.mongoid, default is active_record.
|
99
|
+
### Just run migration generate, there are two ORM options for you: 1.active_record 2.mongoid, default is active_record.
|
82
100
|
|
101
|
+
```bash
|
83
102
|
rails generate rails_kindeditor:migration
|
84
103
|
or
|
85
104
|
rails generate rails_kindeditor:migration -o mongoid
|
105
|
+
```
|
86
106
|
|
87
|
-
The generator will copy model and migration to your application. When you are done, remember run rake db:migrate:
|
107
|
+
### The generator will copy model and migration to your application. When you are done, remember run rake db:migrate:
|
88
108
|
|
109
|
+
```bash
|
89
110
|
rake db:migrate
|
111
|
+
```
|
90
112
|
|
91
|
-
|
113
|
+
## License
|
92
114
|
|
93
115
|
MIT License.
|
94
116
|
|
95
|
-
== Kindeditor for Ruby on Rails 中文文档
|
96
117
|
|
97
|
-
|
118
|
+
|
119
|
+
# Kindeditor for Ruby on Rails 中文文档
|
120
|
+
|
121
|
+
Kindeditor是国产的所见即所得javascript富文本编辑器, 访问 http://www.kindsoft.net 获取更多信息.
|
98
122
|
rails_kindeditor可以帮助你的rails程序集成kindeditor,包括了图片和附件上传功能,文件按照类型、日期进行存储。
|
99
123
|
|
100
|
-
注意: rails_kindeditor ~> v0.3.0 仅支持Rails3.1
|
124
|
+
注意: rails_kindeditor ~> v0.3.0 仅支持Rails3.1+!当然,包括Rails3.1和Rails3.2.
|
125
|
+
如果你使用rails3.0.x,请使用rails_kindeditor v0.2.8
|
101
126
|
|
102
|
-
|
127
|
+
## 安装及使用
|
103
128
|
|
104
|
-
将下面代码加入Gemfile:
|
129
|
+
### 将下面代码加入Gemfile:
|
105
130
|
|
131
|
+
```ruby
|
106
132
|
gem 'rails_kindeditor', '~> 0.3.0'
|
133
|
+
```
|
107
134
|
|
108
|
-
运行"bundle"命令:
|
135
|
+
### 运行"bundle"命令:
|
109
136
|
|
137
|
+
```bash
|
110
138
|
bundle
|
139
|
+
```
|
111
140
|
|
112
|
-
安装Kindeditor,运行下面的代码:
|
141
|
+
### 安装Kindeditor,运行下面的代码:
|
113
142
|
|
143
|
+
```bash
|
114
144
|
rails generate rails_kindeditor:install
|
145
|
+
```
|
115
146
|
|
116
|
-
在application.js里面为assets pipeline加入以下代码:
|
147
|
+
### 在application.js里面为assets pipeline加入以下代码:
|
117
148
|
|
149
|
+
```ruby
|
118
150
|
//= require kindeditor
|
119
|
-
|
120
|
-
使用方法:
|
151
|
+
```
|
121
152
|
|
153
|
+
### 使用方法:
|
154
|
+
|
155
|
+
```ruby
|
122
156
|
1. <%= kindeditor_tag :content, 'default content value' %>
|
123
157
|
# or <%= kindeditor_tag :content, 'default content value', :width => 800, :height => 300 %>
|
124
158
|
# or <%= kindeditor_tag :content, 'default content value', :allowFileManager => false %>
|
159
|
+
```
|
125
160
|
|
126
|
-
|
161
|
+
```ruby
|
127
162
|
2. <%= form_for @article do |f| -%>
|
128
163
|
...
|
129
164
|
<%= f.kindeditor :content %>
|
@@ -131,24 +166,31 @@ rails_kindeditor可以帮助你的rails程序集成kindeditor,包括了图片和
|
|
131
166
|
# or <%= f.kindeditor :content, :allowFileManager => false %>
|
132
167
|
...
|
133
168
|
<% end -%>
|
169
|
+
```
|
134
170
|
|
135
171
|
完毕!
|
136
172
|
|
137
|
-
|
173
|
+
## SimpleForm与Formtastic集成:
|
138
174
|
|
139
|
-
simple_form:
|
175
|
+
### simple_form:
|
176
|
+
|
177
|
+
```ruby
|
140
178
|
<%= form.input :content, :as => :kindeditor, :label => false, :input_html => { :width => 800, :height => 300 } %>
|
141
|
-
|
142
|
-
|
179
|
+
```
|
180
|
+
|
181
|
+
### formtastic:
|
182
|
+
|
183
|
+
```ruby
|
143
184
|
<%= form.input :content, :as => :kindeditor %>
|
144
185
|
<%= form.input :content, :as => :kindeditor, :input_html => { :height => 300 } %>
|
186
|
+
```
|
145
187
|
|
146
|
-
|
147
|
-
== 上传图片及文件配置
|
188
|
+
## 上传图片及文件配置
|
148
189
|
|
149
190
|
当你运行"rails generate rails_kindeditor:install"的时候,安装器会将配置文件拷贝到config/initializers文件夹。
|
150
191
|
你可以配置以下上传选项:
|
151
192
|
|
193
|
+
```ruby
|
152
194
|
# 指定上传目录,目录可以指定多级,都存储在public目录下.
|
153
195
|
# You can customize it , eg: config.upload_dir = 'this/is/my/folder'
|
154
196
|
config.upload_dir = 'uploads'
|
@@ -164,21 +206,26 @@ formtastic:
|
|
164
206
|
# 1600x800 => 800x400
|
165
207
|
# 400x400 => 800x800
|
166
208
|
# config.image_resize_to_fit = [800, 800]
|
209
|
+
```
|
167
210
|
|
168
|
-
|
211
|
+
## 将上传文件信息记录入数据库(可选)
|
169
212
|
|
170
213
|
rails_kindeditor 可以将上传文件信息记录入数据库,以便扩展应用.
|
171
214
|
|
172
|
-
运行下面的代码,有两项选项:1.active_record 2.mongoid,默认是active_record。
|
215
|
+
### 运行下面的代码,有两项选项:1.active_record 2.mongoid,默认是active_record。
|
173
216
|
|
217
|
+
```bash
|
174
218
|
rails generate rails_kindeditor:migration
|
175
219
|
or
|
176
220
|
rails generate rails_kindeditor:migration -o mongoid
|
221
|
+
```
|
177
222
|
|
178
|
-
运行下面的代码:
|
223
|
+
### 运行下面的代码:
|
179
224
|
|
225
|
+
```bash
|
180
226
|
rake db:migrate
|
227
|
+
```
|
181
228
|
|
182
|
-
|
229
|
+
## License
|
183
230
|
|
184
231
|
MIT License.
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'carrierwave/
|
1
|
+
require 'carrierwave/mongoid'
|
2
2
|
|
3
3
|
class Kindeditor::Asset
|
4
|
-
self.collection_name = '
|
4
|
+
self.collection_name = 'kindeditor_assets'
|
5
5
|
include Mongoid::Document
|
6
6
|
include Mongoid::Timestamps
|
7
7
|
mount_uploader :asset
|
data/rails_kindeditor.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_kindeditor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: carrierwave
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: carrierwave-mongoid
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: mini_magick
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,7 +68,7 @@ extra_rdoc_files: []
|
|
52
68
|
files:
|
53
69
|
- .gitignore
|
54
70
|
- Gemfile
|
55
|
-
- README.
|
71
|
+
- README.md
|
56
72
|
- Rakefile
|
57
73
|
- app/assets/javascripts/kindeditor.js
|
58
74
|
- app/controllers/kindeditor/assets_controller.rb
|
@@ -292,7 +308,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
292
308
|
version: '0'
|
293
309
|
requirements: []
|
294
310
|
rubyforge_project: rails_kindeditor
|
295
|
-
rubygems_version: 1.8.
|
311
|
+
rubygems_version: 1.8.24
|
296
312
|
signing_key:
|
297
313
|
specification_version: 3
|
298
314
|
summary: Kindeditor for Ruby on Rails
|