Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Change Readme doc to MD format

  • Loading branch information...
commit 1228097b12a56a1e7f4835b948f28798eee4a05f 1 parent 7cac1e3
@Macrow authored
Showing with 86 additions and 39 deletions.
  1. +86 −39 README.rdoc → README.md
View
125 README.rdoc → README.md
@@ -1,37 +1,48 @@
-== Kindeditor for Ruby on Rails
+# Kindeditor for Ruby on Rails
-Kindeditor is a WYSIWYG text editor, visit http://www.kindsoft.net for details.
+Kindeditor is a WYSIWYG javascript editor, visit http://www.kindsoft.net for details.
rails_kindeditor will helps your rails app integrate with kindeditor, includes images and files uploading.
-Deprecation: rails_kindeditor ~> v0.3.0 only support Rails3.1+ ! If you're using rails3.0.x, please check rails_kindeditor v0.2.8
+Deprecation: rails_kindeditor ~> v0.3.0 only support Rails3.1+!(include Rails3.1 and Rails3.2)
+ If you're using rails3.0.x, please check rails_kindeditor v0.2.8
-Snapshot: <img src='https://github.com/Macrow/rails_kindeditor/raw/master/screenshots/rails_kindeditor.png' />
+<img src="https://github.com/Macrow/rails_kindeditor/raw/master/screenshots/rails_kindeditor.png" alt="rails_indeditor">
-== Installation and usage
+## Installation and usage
-Add this to your Gemfile
+### Add this to your Gemfile
+```ruby
gem 'rails_kindeditor', '~> 0.3.0'
+```
-Run "bundle" command.
+### Run "bundle" command.
+```bash
bundle
+```
-Run install generator:
+### Run install generator:
+```bash
rails generate rails_kindeditor:install
+```
-Include kindeditor javascripts for assets pipeline in your application.js:
+### Include kindeditor javascripts for assets pipeline in your application.js:
+```ruby
//= require kindeditor
+```
-Usage:
+### Usage:
+```ruby
1. <%= kindeditor_tag :content, 'default content value' %>
# or <%= kindeditor_tag :content, 'default content value', :width => 800, :height => 300 %>
# or <%= kindeditor_tag :content, 'default content value', :allowFileManager => false %>
+```
-
+```ruby
2. <%= form_for @article do |f| -%>
...
<%= f.kindeditor :content %>
@@ -39,25 +50,31 @@ Usage:
# or <%= f.kindeditor :content, :allowFileManager => false %>
...
<% end -%>
+```
That's all.
-== SimpleForm and Formtastic integration
+## SimpleForm and Formtastic integration
-simple_form:
+### simple_form:
+```ruby
<%= form.input :content, :as => :kindeditor, :label => false, :input_html => { :width => 800, :height => 300 } %>
+```
-formtastic:
+### formtastic:
+```ruby
<%= form.input :content, :as => :kindeditor %>
<%= form.input :content, :as => :kindeditor, :input_html => { :height => 300 } %>
+```
-== Upload options configuration
+## Upload options configuration
When you run "rails generate rails_kindeditor:install", installer will copy configuration files in config/initializers folder.
You can customize some option for uploading.
+```ruby
# Specify the subfolders in public directory.
# You can customize it , eg: config.upload_dir = 'this/is/my/folder'
config.upload_dir = 'uploads'
@@ -73,57 +90,75 @@ You can customize some option for uploading.
# 1600x800 => 800x400
# 400x400 => 800x800
# config.image_resize_to_fit = [800, 800]
+```
-== Save upload file information into database(optional)
+## Save upload file information into database(optional)
rails_kindeditor can save upload file information into database.
-Just run migration generate, there are two ORM options for you: 1.active_record 2.mongoid, default is active_record.
+### Just run migration generate, there are two ORM options for you: 1.active_record 2.mongoid, default is active_record.
+```bash
rails generate rails_kindeditor:migration
or
rails generate rails_kindeditor:migration -o mongoid
+```
-The generator will copy model and migration to your application. When you are done, remember run rake db:migrate:
+### The generator will copy model and migration to your application. When you are done, remember run rake db:migrate:
+```bash
rake db:migrate
+```
-== License
+## License
MIT License.
-== Kindeditor for Ruby on Rails 中文文档
+
+
+# Kindeditor for Ruby on Rails 中文文档
Kindeditor是国产的所见即所得javascript富文本编辑器, 访问 http://www.kindsoft.net 获取更多信息.
rails_kindeditor可以帮助你的rails程序集成kindeditor,包括了图片和附件上传功能,文件按照类型、日期进行存储。
-注意: rails_kindeditor ~> v0.3.0 仅支持Rails3.1+! 如果你使用rails3.0.x,请使用rails_kindeditor v0.2.8
+注意: rails_kindeditor ~> v0.3.0 仅支持Rails3.1+!当然,包括Rails3.1和Rails3.2.
+ 如果你使用rails3.0.x,请使用rails_kindeditor v0.2.8
-== 安装及使用
+## 安装及使用
-将下面代码加入Gemfile:
+### 将下面代码加入Gemfile:
+```ruby
gem 'rails_kindeditor', '~> 0.3.0'
+```
-运行"bundle"命令:
+### 运行"bundle"命令:
+```bash
bundle
+```
-安装Kindeditor,运行下面的代码:
+### 安装Kindeditor,运行下面的代码:
+```bash
rails generate rails_kindeditor:install
+```
-在application.js里面为assets pipeline加入以下代码:
+### 在application.js里面为assets pipeline加入以下代码:
+```ruby
//= require kindeditor
-
-使用方法:
+```
+### 使用方法:
+
+```ruby
1. <%= kindeditor_tag :content, 'default content value' %>
# or <%= kindeditor_tag :content, 'default content value', :width => 800, :height => 300 %>
# or <%= kindeditor_tag :content, 'default content value', :allowFileManager => false %>
+```
-
+```ruby
2. <%= form_for @article do |f| -%>
...
<%= f.kindeditor :content %>
@@ -131,24 +166,31 @@ rails_kindeditor可以帮助你的rails程序集成kindeditor,包括了图片和
# or <%= f.kindeditor :content, :allowFileManager => false %>
...
<% end -%>
+```
完毕!
-== SimpleForm与Formtastic集成:
+## SimpleForm与Formtastic集成:
-simple_form:
+### simple_form:
+
+```ruby
<%= form.input :content, :as => :kindeditor, :label => false, :input_html => { :width => 800, :height => 300 } %>
-
-formtastic:
+```
+
+### formtastic:
+
+```ruby
<%= form.input :content, :as => :kindeditor %>
<%= form.input :content, :as => :kindeditor, :input_html => { :height => 300 } %>
+```
-
-== 上传图片及文件配置
+## 上传图片及文件配置
当你运行"rails generate rails_kindeditor:install"的时候,安装器会将配置文件拷贝到config/initializers文件夹。
你可以配置以下上传选项:
+```ruby
# 指定上传目录,目录可以指定多级,都存储在public目录下.
# You can customize it , eg: config.upload_dir = 'this/is/my/folder'
config.upload_dir = 'uploads'
@@ -164,21 +206,26 @@ formtastic:
# 1600x800 => 800x400
# 400x400 => 800x800
# config.image_resize_to_fit = [800, 800]
+```
-== 将上传文件信息记录入数据库(可选)
+## 将上传文件信息记录入数据库(可选)
rails_kindeditor 可以将上传文件信息记录入数据库,以便扩展应用.
-运行下面的代码,有两项选项:1.active_record 2.mongoid,默认是active_record。
+### 运行下面的代码,有两项选项:1.active_record 2.mongoid,默认是active_record。
+```bash
rails generate rails_kindeditor:migration
or
rails generate rails_kindeditor:migration -o mongoid
+```
-运行下面的代码:
+### 运行下面的代码:
+```bash
rake db:migrate
+```
-== License
+## License
MIT License.
Please sign in to comment.
Something went wrong with that request. Please try again.