rails_kindeditor_upyun 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/Gemfile +6 -0
  4. data/README.md +523 -0
  5. data/Rakefile +2 -0
  6. data/app/assets/javascripts/kindeditor.js +1 -0
  7. data/app/controllers/kindeditor/assets_controller.rb +126 -0
  8. data/app/uploaders/kindeditor/asset_uploader.rb +91 -0
  9. data/app/uploaders/kindeditor/file_uploader.rb +10 -0
  10. data/app/uploaders/kindeditor/flash_uploader.rb +10 -0
  11. data/app/uploaders/kindeditor/image_uploader.rb +10 -0
  12. data/app/uploaders/kindeditor/media_uploader.rb +10 -0
  13. data/config/routes.rb +6 -0
  14. data/lib/generators/rails_kindeditor/install/USAGE +10 -0
  15. data/lib/generators/rails_kindeditor/install/install_generator.rb +23 -0
  16. data/lib/generators/rails_kindeditor/install/templates/application.js +17 -0
  17. data/lib/generators/rails_kindeditor/install/templates/rails_kindeditor.rb +29 -0
  18. data/lib/generators/rails_kindeditor/migration/USAGE +14 -0
  19. data/lib/generators/rails_kindeditor/migration/migration_generator.rb +36 -0
  20. data/lib/generators/rails_kindeditor/migration/templates/migration/migration.rb +17 -0
  21. data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/asset.rb +14 -0
  22. data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/file.rb +3 -0
  23. data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/flash.rb +3 -0
  24. data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/image.rb +3 -0
  25. data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/media.rb +3 -0
  26. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/asset.rb +27 -0
  27. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/file.rb +3 -0
  28. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/flash.rb +3 -0
  29. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/image.rb +3 -0
  30. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/media.rb +3 -0
  31. data/lib/rails_kindeditor.rb +61 -0
  32. data/lib/rails_kindeditor/active_record.rb +14 -0
  33. data/lib/rails_kindeditor/engine.rb +34 -0
  34. data/lib/rails_kindeditor/formtastic.rb +12 -0
  35. data/lib/rails_kindeditor/helper.rb +96 -0
  36. data/lib/rails_kindeditor/simple_form.rb +11 -0
  37. data/lib/rails_kindeditor/version.rb +4 -0
  38. data/lib/tasks/assets.rake +9 -0
  39. data/rails_kindeditor.gemspec +25 -0
  40. data/screenshots/rails_kindeditor.png +0 -0
  41. data/screenshots/simple_mode.png +0 -0
  42. data/vendor/assets/javascripts/kindeditor/kindeditor.js +5963 -0
  43. data/vendor/assets/javascripts/kindeditor/lang/ar.js +233 -0
  44. data/vendor/assets/javascripts/kindeditor/lang/en.js +232 -0
  45. data/vendor/assets/javascripts/kindeditor/lang/ko.js +237 -0
  46. data/vendor/assets/javascripts/kindeditor/lang/zh_CN.js +237 -0
  47. data/vendor/assets/javascripts/kindeditor/lang/zh_TW.js +235 -0
  48. data/vendor/assets/javascripts/kindeditor/plugins/anchor/anchor.js +46 -0
  49. data/vendor/assets/javascripts/kindeditor/plugins/autoheight/autoheight.js +54 -0
  50. data/vendor/assets/javascripts/kindeditor/plugins/baidumap/baidumap.js +93 -0
  51. data/vendor/assets/javascripts/kindeditor/plugins/baidumap/index.html +83 -0
  52. data/vendor/assets/javascripts/kindeditor/plugins/baidumap/map.html +43 -0
  53. data/vendor/assets/javascripts/kindeditor/plugins/clearhtml/clearhtml.js +29 -0
  54. data/vendor/assets/javascripts/kindeditor/plugins/code/code.js +62 -0
  55. data/vendor/assets/javascripts/kindeditor/plugins/code/prettify.css +13 -0
  56. data/vendor/assets/javascripts/kindeditor/plugins/code/prettify.js +28 -0
  57. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/emoticons.js +129 -0
  58. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/0.gif +0 -0
  59. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/1.gif +0 -0
  60. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/10.gif +0 -0
  61. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/100.gif +0 -0
  62. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/101.gif +0 -0
  63. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/102.gif +0 -0
  64. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/103.gif +0 -0
  65. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/104.gif +0 -0
  66. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/105.gif +0 -0
  67. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/106.gif +0 -0
  68. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/107.gif +0 -0
  69. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/108.gif +0 -0
  70. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/109.gif +0 -0
  71. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/11.gif +0 -0
  72. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/110.gif +0 -0
  73. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/111.gif +0 -0
  74. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/112.gif +0 -0
  75. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/113.gif +0 -0
  76. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/114.gif +0 -0
  77. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/115.gif +0 -0
  78. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/116.gif +0 -0
  79. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/117.gif +0 -0
  80. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/118.gif +0 -0
  81. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/119.gif +0 -0
  82. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/12.gif +0 -0
  83. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/120.gif +0 -0
  84. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/121.gif +0 -0
  85. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/122.gif +0 -0
  86. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/123.gif +0 -0
  87. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/124.gif +0 -0
  88. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/125.gif +0 -0
  89. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/126.gif +0 -0
  90. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/127.gif +0 -0
  91. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/128.gif +0 -0
  92. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/129.gif +0 -0
  93. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/13.gif +0 -0
  94. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/130.gif +0 -0
  95. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/131.gif +0 -0
  96. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/132.gif +0 -0
  97. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/133.gif +0 -0
  98. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/134.gif +0 -0
  99. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/14.gif +0 -0
  100. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/15.gif +0 -0
  101. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/16.gif +0 -0
  102. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/17.gif +0 -0
  103. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/18.gif +0 -0
  104. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/19.gif +0 -0
  105. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/2.gif +0 -0
  106. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/20.gif +0 -0
  107. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/21.gif +0 -0
  108. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/22.gif +0 -0
  109. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/23.gif +0 -0
  110. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/24.gif +0 -0
  111. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/25.gif +0 -0
  112. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/26.gif +0 -0
  113. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/27.gif +0 -0
  114. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/28.gif +0 -0
  115. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/29.gif +0 -0
  116. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/3.gif +0 -0
  117. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/30.gif +0 -0
  118. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/31.gif +0 -0
  119. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/32.gif +0 -0
  120. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/33.gif +0 -0
  121. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/34.gif +0 -0
  122. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/35.gif +0 -0
  123. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/36.gif +0 -0
  124. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/37.gif +0 -0
  125. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/38.gif +0 -0
  126. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/39.gif +0 -0
  127. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/4.gif +0 -0
  128. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/40.gif +0 -0
  129. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/41.gif +0 -0
  130. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/42.gif +0 -0
  131. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/43.gif +0 -0
  132. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/44.gif +0 -0
  133. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/45.gif +0 -0
  134. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/46.gif +0 -0
  135. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/47.gif +0 -0
  136. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/48.gif +0 -0
  137. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/49.gif +0 -0
  138. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/5.gif +0 -0
  139. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/50.gif +0 -0
  140. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/51.gif +0 -0
  141. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/52.gif +0 -0
  142. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/53.gif +0 -0
  143. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/54.gif +0 -0
  144. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/55.gif +0 -0
  145. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/56.gif +0 -0
  146. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/57.gif +0 -0
  147. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/58.gif +0 -0
  148. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/59.gif +0 -0
  149. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/6.gif +0 -0
  150. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/60.gif +0 -0
  151. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/61.gif +0 -0
  152. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/62.gif +0 -0
  153. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/63.gif +0 -0
  154. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/64.gif +0 -0
  155. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/65.gif +0 -0
  156. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/66.gif +0 -0
  157. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/67.gif +0 -0
  158. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/68.gif +0 -0
  159. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/69.gif +0 -0
  160. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/7.gif +0 -0
  161. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/70.gif +0 -0
  162. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/71.gif +0 -0
  163. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/72.gif +0 -0
  164. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/73.gif +0 -0
  165. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/74.gif +0 -0
  166. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/75.gif +0 -0
  167. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/76.gif +0 -0
  168. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/77.gif +0 -0
  169. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/78.gif +0 -0
  170. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/79.gif +0 -0
  171. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/8.gif +0 -0
  172. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/80.gif +0 -0
  173. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/81.gif +0 -0
  174. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/82.gif +0 -0
  175. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/83.gif +0 -0
  176. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/84.gif +0 -0
  177. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/85.gif +0 -0
  178. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/86.gif +0 -0
  179. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/87.gif +0 -0
  180. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/88.gif +0 -0
  181. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/89.gif +0 -0
  182. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/9.gif +0 -0
  183. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/90.gif +0 -0
  184. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/91.gif +0 -0
  185. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/92.gif +0 -0
  186. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/93.gif +0 -0
  187. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/94.gif +0 -0
  188. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/95.gif +0 -0
  189. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/96.gif +0 -0
  190. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/97.gif +0 -0
  191. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/98.gif +0 -0
  192. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/99.gif +0 -0
  193. data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/static.gif +0 -0
  194. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/filemanager.js +189 -0
  195. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/file-16.gif +0 -0
  196. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/file-64.gif +0 -0
  197. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/folder-16.gif +0 -0
  198. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/folder-64.gif +0 -0
  199. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/go-up.gif +0 -0
  200. data/vendor/assets/javascripts/kindeditor/plugins/flash/flash.js +161 -0
  201. data/vendor/assets/javascripts/kindeditor/plugins/image/image.js +328 -0
  202. data/vendor/assets/javascripts/kindeditor/plugins/image/images/align_left.gif +0 -0
  203. data/vendor/assets/javascripts/kindeditor/plugins/image/images/align_right.gif +0 -0
  204. data/vendor/assets/javascripts/kindeditor/plugins/image/images/align_top.gif +0 -0
  205. data/vendor/assets/javascripts/kindeditor/plugins/image/images/refresh.png +0 -0
  206. data/vendor/assets/javascripts/kindeditor/plugins/insertfile/insertfile.js +144 -0
  207. data/vendor/assets/javascripts/kindeditor/plugins/lineheight/lineheight.js +38 -0
  208. data/vendor/assets/javascripts/kindeditor/plugins/link/link.js +66 -0
  209. data/vendor/assets/javascripts/kindeditor/plugins/map/map.html +57 -0
  210. data/vendor/assets/javascripts/kindeditor/plugins/map/map.js +137 -0
  211. data/vendor/assets/javascripts/kindeditor/plugins/media/media.js +170 -0
  212. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/image.png +0 -0
  213. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/select-files-en.png +0 -0
  214. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/select-files-zh_CN.png +0 -0
  215. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/swfupload.swf +0 -0
  216. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/multiimage.js +1384 -0
  217. data/vendor/assets/javascripts/kindeditor/plugins/pagebreak/pagebreak.js +27 -0
  218. data/vendor/assets/javascripts/kindeditor/plugins/plainpaste/plainpaste.js +41 -0
  219. data/vendor/assets/javascripts/kindeditor/plugins/preview/preview.js +31 -0
  220. data/vendor/assets/javascripts/kindeditor/plugins/quickformat/quickformat.js +81 -0
  221. data/vendor/assets/javascripts/kindeditor/plugins/table/table.js +712 -0
  222. data/vendor/assets/javascripts/kindeditor/plugins/template/html/1.html +14 -0
  223. data/vendor/assets/javascripts/kindeditor/plugins/template/html/2.html +42 -0
  224. data/vendor/assets/javascripts/kindeditor/plugins/template/html/3.html +36 -0
  225. data/vendor/assets/javascripts/kindeditor/plugins/template/template.js +58 -0
  226. data/vendor/assets/javascripts/kindeditor/plugins/wordpaste/wordpaste.js +51 -0
  227. data/vendor/assets/javascripts/kindeditor/themes/common/anchor.gif +0 -0
  228. data/vendor/assets/javascripts/kindeditor/themes/common/blank.gif +0 -0
  229. data/vendor/assets/javascripts/kindeditor/themes/common/flash.gif +0 -0
  230. data/vendor/assets/javascripts/kindeditor/themes/common/loading.gif +0 -0
  231. data/vendor/assets/javascripts/kindeditor/themes/common/media.gif +0 -0
  232. data/vendor/assets/javascripts/kindeditor/themes/common/rm.gif +0 -0
  233. data/vendor/assets/javascripts/kindeditor/themes/default/background.png +0 -0
  234. data/vendor/assets/javascripts/kindeditor/themes/default/default.css +1149 -0
  235. data/vendor/assets/javascripts/kindeditor/themes/default/default.png +0 -0
  236. data/vendor/assets/javascripts/kindeditor/themes/qq/editor.gif +0 -0
  237. data/vendor/assets/javascripts/kindeditor/themes/qq/qq.css +143 -0
  238. data/vendor/assets/javascripts/kindeditor/themes/simple/simple.css +100 -0
  239. metadata +322 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 62a6ef63ac0224dbc574e2c418211d8313dbc66b
4
+ data.tar.gz: 674cffbf4b57c4c05ea8fdc1b477792fb59a531a
5
+ SHA512:
6
+ metadata.gz: 5195817dbd10b441b50317d474eea8229097a1d46ec6506661a6bd711be75417b820ba19175185e906bea169c38bbc4ebd3786fefefc7006ab0837f78f75eeea
7
+ data.tar.gz: 8fd9c2e4c16c4b77da185b16f92bd2687bbd9326ffb0a620267b05ed4b049ed5caf88a6ef1120894803f6dd9749992976fc2901ca64566d224d7c2244cb42447
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ *.DS_Store
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem 'carrierwave'
6
+ gem 'mini_magick'
data/README.md ADDED
@@ -0,0 +1,523 @@
1
+ # Kindeditor for Ruby on Rails [![Gem Version](https://badge.fury.io/rb/rails_kindeditor.png)](http://badge.fury.io/rb/rails_kindeditor)
2
+
3
+ Kindeditor is a WYSIWYG javascript editor, visit http://www.kindsoft.net for details.
4
+ rails_kindeditor will helps your rails app integrate with kindeditor, includes images and files uploading.
5
+
6
+ <img src="https://github.com/Macrow/rails_kindeditor/raw/master/screenshots/rails_kindeditor.png" alt="rails_indeditor">
7
+
8
+ ## Installation and usage
9
+
10
+ ### Add this to your Gemfile
11
+
12
+ ```ruby
13
+ gem 'rails_kindeditor'
14
+ ```
15
+
16
+ ### Run "bundle" command.
17
+
18
+ ```bash
19
+ bundle
20
+ ```
21
+
22
+ ### Run install generator:
23
+
24
+ ```bash
25
+ rails generate rails_kindeditor:install
26
+ ```
27
+ notice: rails_kindeditor needs applications.js in your project.
28
+
29
+ ### Rails4 in production mode
30
+
31
+ In Rails 4.0, precompiling assets no longer automatically copies non-JS/CSS assets from vendor/assets and lib/assets. see https://github.com/rails/rails/pull/7968
32
+ In Rails 4.0's production mode, please run 'rake kindeditor:assets', this method just copy kindeditor into public folder.
33
+
34
+ ```bash
35
+ rake kindeditor:assets
36
+ ```
37
+
38
+ ### Usage:
39
+
40
+ ```ruby
41
+ 1. <%= kindeditor_tag :content, 'default content value' %>
42
+ # or <%= kindeditor_tag :content, 'default content value', :width => 800, :height => 300 %>
43
+ # or <%= kindeditor_tag :content, 'default content value', :allowFileManager => false %>
44
+ ```
45
+
46
+ ```ruby
47
+ 2. <%= form_for @article do |f| %>
48
+ ...
49
+ <%= f.kindeditor :content %>
50
+ # or <%= f.kindeditor :content, :width => 800, :height => 300 %>
51
+ # or <%= f.kindeditor :content, :allowFileManager => false %>
52
+ ...
53
+ <% end %>
54
+ ```
55
+ You can use kindeditor's initial parameters as usual, please visit http://www.kindsoft.net/docs/option.html for details.
56
+
57
+ additionally, rails_kindeditor provides one "simple_mode" parameter for render simple mode quickly.
58
+
59
+ <img src="https://github.com/Macrow/rails_kindeditor/raw/master/screenshots/simple_mode.png" alt="simple mode">
60
+
61
+ ```ruby
62
+ kindeditor_tag :content, 'default content value', :simple_mode => true
63
+ f.kindeditor :content, :simple_mode => true
64
+ f.input :content, :as => :kindeditor, :input_html => { :simple_mode => true } # simple_form & formtastic
65
+ ```
66
+
67
+ That's all.
68
+
69
+ ### Work with turbolinks
70
+
71
+ rails_kindeditor will not load the scripts under the turbolinks, there's two way to solve this problem:
72
+
73
+ 1.use "'data-no-turbolink' => true" when we need to load kindeditor,this will shut down the turbolinks in this page
74
+
75
+ ```ruby
76
+ <%= link_to 'Edit', edit_article_path(article), 'data-no-turbolink' => true %>
77
+ ```
78
+
79
+ 2.load kindeditor manually, but you should specify the parameters again, include the textarea's id.
80
+
81
+ ```coffeescript
82
+ # coffeescript code
83
+ $(document).on 'page:load', ->
84
+ if $('#article_content').length > 0
85
+ KindEditor.create '#article_content', "width":"100%", "height":300, "allowFileManager":true, "uploadJson":"/kindeditor/upload", "fileManagerJson":"/kindeditor/filemanager"
86
+ ```
87
+
88
+ simple mode
89
+ ```coffeescript
90
+ # coffeescript code
91
+ $(document).on 'page:load', ->
92
+ if $('#article_content').length > 0
93
+ KindEditor.create '#article_content',
94
+ "width":"100%",
95
+ "height":300,
96
+ "allowFileManager":true,
97
+ "uploadJson":"/kindeditor/upload",
98
+ "fileManagerJson":"/kindeditor/filemanager",
99
+ "items":["fontname","fontsize","|","forecolor","hilitecolor","bold","italic","underline","removeformat","|","justifyleft","justifycenter","justifyright","insertorderedlist","insertunorderedlist","|","emoticons","image","link"]
100
+ ```
101
+
102
+ When you need to specify the owner_id:
103
+
104
+ ```ruby
105
+ f.kindeditor :content, owner_id: @article.id, data: {upload: kindeditor_upload_json_path(owner_id: @article.id), filemanager: kindeditor_file_manager_json_path}
106
+ ```
107
+
108
+ ```coffeescript
109
+ # coffeescript code
110
+ $(document).on 'page:load', ->
111
+ if $('#article_content').length > 0
112
+ KindEditor.create '#article_content',
113
+ "width" : "100%",
114
+ "height" : 300,
115
+ "allowFileManager" : true,
116
+ "uploadJson" : $('#article_content').data('upload'),
117
+ "fileManagerJson" : $('#article_content').data('filemanager')
118
+ ```
119
+
120
+ ### Include javascript files at bottom ? Not in the head tag ? How can I load kindeditor correctly ?
121
+
122
+ For some reasons, you includes javascript files at bottom in your template, rails_kindeditor provides a options for lazyload:
123
+
124
+ ```ruby
125
+ <%= f.kindeditor :content, :window_onload => true %>
126
+ ```
127
+
128
+ Warning: Kindeditor will load after all the objects loaded.
129
+
130
+ ## SimpleForm and Formtastic integration
131
+
132
+ ### simple_form:
133
+
134
+ ```ruby
135
+ <%= form.input :content, :as => :kindeditor %>
136
+ # or
137
+ <%= form.input :content, :as => :kindeditor, :label => false, :input_html => { :width => 800, :height => 300 } %>
138
+ ```
139
+
140
+ ### formtastic:
141
+
142
+ ```ruby
143
+ <%= form.input :content, :as => :kindeditor %>
144
+ # or
145
+ <%= form.input :content, :as => :kindeditor, :input_html => { :height => 300 } %>
146
+ ```
147
+
148
+ ## How to get kindeditor's content
149
+
150
+ ```ruby
151
+ <%= form_for @article do |f| %>
152
+ <%= f.kindeditor :content, :editor_id => 'my_editor' %>
153
+ <% end %>
154
+ ```
155
+
156
+ You can get content like this:
157
+
158
+ ```javascript
159
+ // Javascript code
160
+ my_editor.html();
161
+ ```
162
+
163
+ ## Upload options configuration
164
+
165
+ When you run "rails generate rails_kindeditor:install", installer will copy configuration files in config/initializers folder.
166
+ You can customize some option for uploading.
167
+
168
+ ```ruby
169
+ # Specify the subfolders in public directory.
170
+ # You can customize it , eg: config.upload_dir = 'this/is/my/folder'
171
+ config.upload_dir = 'uploads'
172
+
173
+ # Allowed file types for upload.
174
+ config.upload_image_ext = %w[gif jpg jpeg png bmp]
175
+ config.upload_flash_ext = %w[swf flv]
176
+ config.upload_media_ext = %w[swf flv mp3 wav wma wmv mid avi mpg asf rm rmvb]
177
+ config.upload_file_ext = %w[doc docx xls xlsx ppt htm html txt zip rar gz bz2]
178
+
179
+ # Porcess upload image size, need mini_magick
180
+ # before => after
181
+ # eg: 1600x1600 => 800x800
182
+ # 1600x800 => 800x400
183
+ # 400x400 => 400x400 # No Change
184
+ # config.image_resize_to_limit = [800, 800]
185
+ ```
186
+
187
+ ## Asset host options configuration
188
+
189
+ ```ruby
190
+ # if you have config in your rails application like this:
191
+ # /config/enviroments/production.rb
192
+ # # config.action_controller.asset_host = "http://asset.example.com"
193
+ # # config.assets.prefix = "assets_prefx"
194
+ # then you should:
195
+ #
196
+ config.asset_url_prefix = "http://asset.example.com/assets_prefx/" if Rails.env.production?
197
+ ```
198
+
199
+
200
+ ## Save upload file information into database(optional)
201
+
202
+ rails_kindeditor can save upload file information into database.
203
+
204
+ ### Just run migration generate, there are two ORM options for you: 1.active_record 2.mongoid, default is active_record.
205
+
206
+ ```bash
207
+ rails generate rails_kindeditor:migration
208
+ or
209
+ rails generate rails_kindeditor:migration -o mongoid
210
+ ```
211
+
212
+ ### The generator will copy model and migration to your application. When you are done, remember run rake db:migrate:
213
+
214
+ ```bash
215
+ rake db:migrate
216
+ ```
217
+
218
+ ### Delete uploaded files automatically (only for active_record)
219
+
220
+ You can specify the owner for uploaded files, when the owner was destroying, all the uploaded files(belongs to the owner) will be destroyed automatically.
221
+
222
+ ####1. specify the owner_id for kindeditor
223
+
224
+ ```ruby
225
+ <%= form_for @article do |f| %>
226
+ ...
227
+ <%= f.kindeditor :content, :owner_id => @article.id %>
228
+ ...
229
+ <% end %>
230
+ ```
231
+
232
+ ```ruby
233
+ Warnning: the @article must be created before this scene, the @article.id should not be empty.
234
+ ```
235
+
236
+ ####2. add has_many_kindeditor_assets in your own model
237
+
238
+ ```ruby
239
+ class Article < ActiveRecord::Base
240
+ has_many_kindeditor_assets :attachments, :dependent => :destroy
241
+ # has_many_kindeditor_assets :attachments, :dependent => :nullify
242
+ # has_many_kindeditor_assets :your_name, :dependent => :destroy
243
+ end
244
+ ```
245
+
246
+ ####3. relationship
247
+
248
+ ```ruby
249
+ article = Article.first
250
+ article.attachments # => the article's assets uploaded by kindeditor
251
+ asset = article.attachments.first
252
+ asset.owner # => aritcle
253
+ ```
254
+
255
+ ### If you're using mongoid, please add 'gem "carrierwave-mongoid"' in your Gemfile
256
+
257
+ ```ruby
258
+ gem 'carrierwave-mongoid'
259
+ ```
260
+
261
+ ## License
262
+
263
+ MIT License.
264
+
265
+
266
+
267
+ # Kindeditor for Ruby on Rails 中文文档
268
+
269
+ Kindeditor是国产的所见即所得javascript富文本编辑器, 访问 http://www.kindsoft.net 获取更多信息.
270
+ rails_kindeditor可以帮助你的rails程序集成kindeditor,包括了图片和附件上传功能,文件按照类型、日期进行存储。
271
+
272
+ ## 安装及使用
273
+
274
+ ### 将下面代码加入Gemfile:
275
+
276
+ ```ruby
277
+ gem 'rails_kindeditor'
278
+ ```
279
+
280
+ ### 运行"bundle"命令:
281
+
282
+ ```bash
283
+ bundle
284
+ ```
285
+
286
+ ### 安装Kindeditor,运行下面的代码:
287
+
288
+ ```bash
289
+ rails generate rails_kindeditor:install
290
+ ```
291
+ 注意: 在你的工程中需要有application.js文件。
292
+
293
+ ### Rails4 in production mode
294
+
295
+ 从Rails 4.0开始, precompiling assets不再自动从vendor/assets和lib/assets拷贝非JS/CSS文件. 参见 https://github.com/rails/rails/pull/7968
296
+ 如果要使用Rails 4.0的生产模式,请运行'rake kindeditor:assets', 此方法可将kindeditor自动拷贝到你的public/assets目录.
297
+
298
+ ```bash
299
+ rake kindeditor:assets
300
+ ```
301
+
302
+ ### 使用方法:
303
+
304
+ ```ruby
305
+ 1. <%= kindeditor_tag :content, 'default content value' %>
306
+ # or <%= kindeditor_tag :content, 'default content value', :width => 800, :height => 300 %>
307
+ # or <%= kindeditor_tag :content, 'default content value', :allowFileManager => false %>
308
+ ```
309
+
310
+ ```ruby
311
+ 2. <%= form_for @article do |f| -%>
312
+ ...
313
+ <%= f.kindeditor :content %>
314
+ # or <%= f.kindeditor :content, :width => 800, :height => 300 %>
315
+ # or <%= f.kindeditor :content, :allowFileManager => false %>
316
+ ...
317
+ <% end -%>
318
+ ```
319
+ 你可以像往常那样使用kindeditor自身的初始化参数,请访问 http://www.kindsoft.net/docs/option.html 查看更多参数。
320
+
321
+ 另外,rails_kindeditor还额外提供一个"simple_mode"参数,以便快捷使用简单模式的kindeditor。
322
+
323
+ ```ruby
324
+ kindeditor_tag :content, 'default content value', :simple_mode => true
325
+ f.kindeditor :content, :simple_mode => true
326
+ f.input :content, :as => :kindeditor, :input_html => { :simple_mode => true } # simple_form & formtastic
327
+ ```
328
+
329
+ 完毕!
330
+
331
+ ### 如何在turbolinks下使用
332
+
333
+ rails_kindeditor在turbolinks下不会正常加载,只有当页面刷新时才正常。turbolinks的机制就是这样的,页面根本没刷新,这和pjax是一样的,所以kindeditor没加载很正常。
334
+
335
+ 有两个办法可以解决:
336
+
337
+ 1.在需要加载kindeditor的链接加入 'data-no-turbolink' => true ,此时相当在这个页面于关闭turbolinks。
338
+
339
+ ```ruby
340
+ <%= link_to 'Edit', edit_article_path(article), 'data-no-turbolink' => true %>
341
+ ```
342
+
343
+ 2.在turbolinks载入完毕后手动加载kindeditor,不过所有参数都要设置,而且需要知道并设定textarea的id。
344
+
345
+ ```coffeescript
346
+ # coffeescript code
347
+ $(document).on 'page:load', ->
348
+ if $('#article_content').length > 0
349
+ KindEditor.create '#article_content', "width":"100%", "height":300, "allowFileManager":true, "uploadJson":"/kindeditor/upload", "fileManagerJson":"/kindeditor/filemanager"
350
+ ```
351
+
352
+ simple模式也需要手动设定
353
+ ```coffeescript
354
+ # coffeescript code
355
+ $(document).on 'page:load', ->
356
+ if $('#article_content').length > 0
357
+ KindEditor.create '#article_content',
358
+ "width":"100%",
359
+ "height":300,
360
+ "allowFileManager":true,
361
+ "uploadJson":"/kindeditor/upload",
362
+ "fileManagerJson":"/kindeditor/filemanager",
363
+ "items":["fontname","fontsize","|","forecolor","hilitecolor","bold","italic","underline","removeformat","|","justifyleft","justifycenter","justifyright","insertorderedlist","insertunorderedlist","|","emoticons","image","link"]
364
+ ```
365
+
366
+ 需要指定owner_id的方法:
367
+
368
+ ```ruby
369
+ f.kindeditor :content, owner_id: @article.id, data: {upload: kindeditor_upload_json_path(owner_id: @article.id), filemanager: kindeditor_file_manager_json_path}
370
+ ```
371
+
372
+ ```coffeescript
373
+ # coffeescript code
374
+ $(document).on 'page:load', ->
375
+ if $('#article_content').length > 0
376
+ KindEditor.create '#article_content',
377
+ "width" : "100%",
378
+ "height" : 300,
379
+ "allowFileManager" : true,
380
+ "uploadJson" : $('#article_content').data('upload'),
381
+ "fileManagerJson" : $('#article_content').data('filemanager')
382
+ ```
383
+
384
+ ### 把javascript放在模板最下方,不放在head里面,如何正确加载kindeditor?
385
+
386
+ 有时候,为了加快页面载入速度,也许你会把javascript引用放在template的底部,rails_kindeditor提供了一个参数可以确保正常加载:
387
+
388
+ ```ruby
389
+ <%= f.kindeditor :content, :window_onload => true %>
390
+ ```
391
+
392
+ 警告:Kindeditor会在页面所有的内容加载完毕后才进行加载,所以需谨慎使用
393
+
394
+ ## SimpleForm与Formtastic集成:
395
+
396
+ ### simple_form:
397
+
398
+ ```ruby
399
+ <%= form.input :content, :as => :kindeditor, :label => false, :input_html => { :width => 800, :height => 300 } %>
400
+ ```
401
+
402
+ ### formtastic:
403
+
404
+ ```ruby
405
+ <%= form.input :content, :as => :kindeditor %>
406
+ <%= form.input :content, :as => :kindeditor, :input_html => { :height => 300 } %>
407
+ ```
408
+ ## 如何获取kindeditor的内容
409
+
410
+ ```ruby
411
+ <%= form_for @article do |f| %>
412
+ <%= f.kindeditor :content, :editor_id => 'my_editor' %>
413
+ <% end %>
414
+ ```
415
+
416
+ 可通过下面的Javascript代码获取内容:
417
+
418
+ ```javascript
419
+ // Javascript code
420
+ my_editor.html();
421
+ ```
422
+
423
+ ## 上传图片及文件配置
424
+
425
+ 当你运行"rails generate rails_kindeditor:install"的时候,安装器会将配置文件拷贝到config/initializers文件夹。
426
+ 你可以配置以下上传选项:
427
+
428
+ ```ruby
429
+ # 指定上传目录,目录可以指定多级,都存储在public目录下.
430
+ # You can customize it , eg: config.upload_dir = 'this/is/my/folder'
431
+ config.upload_dir = 'uploads'
432
+
433
+ # 指定允许上传的文件类型.
434
+ config.upload_image_ext = %w[gif jpg jpeg png bmp]
435
+ config.upload_flash_ext = %w[swf flv]
436
+ config.upload_media_ext = %w[swf flv mp3 wav wma wmv mid avi mpg asf rm rmvb]
437
+ config.upload_file_ext = %w[doc docx xls xlsx ppt htm html txt zip rar gz bz2]
438
+
439
+ # 处理上传文件,需要mini_magick
440
+ # 处理以前 => 处理以后
441
+ # eg: 1600x1600 => 800x800
442
+ # 1600x800 => 800x400
443
+ # 400x400 => 400x400 # 图片小于该限制尺寸则不作处理
444
+ # config.image_resize_to_limit = [800, 800]
445
+ ```
446
+
447
+ ## 静态资源地址配置
448
+
449
+ ```ruby
450
+ # if you have config in your rails application like this:
451
+ # /config/enviroments/production.rb
452
+ # # config.action_controller.asset_host = "http://asset.example.com"
453
+ # # config.assets.prefix = "assets_prefx"
454
+ # then you should:
455
+ #
456
+ config.asset_url_prefix = "http://asset.example.com/assets_prefx/" if Rails.env.production?
457
+ ```
458
+
459
+
460
+ ## 将上传文件信息记录入数据库(可选)
461
+
462
+ rails_kindeditor 可以将上传文件信息记录入数据库,以便扩展应用.
463
+
464
+ ### 运行下面的代码,有两项选项:1.active_record 2.mongoid,默认是active_record。
465
+
466
+ ```bash
467
+ rails generate rails_kindeditor:migration
468
+ or
469
+ rails generate rails_kindeditor:migration -o mongoid
470
+ ```
471
+
472
+ ### 运行下面的代码:
473
+
474
+ ```bash
475
+ rake db:migrate
476
+ ```
477
+
478
+ ### 自动删除上传的文件(仅在active_record下工作)
479
+
480
+ 你可以为上传的文件指定归属,比如一名用户,或者一篇文章,当用户或者文章被删除时,所有属于该用户或者该文章的上传文件将会被自动删除。
481
+
482
+ ####1. 为kindeditor指定owner_id
483
+
484
+ ```ruby
485
+ <%= form_for @article do |f| %>
486
+ ...
487
+ <%= f.kindeditor :content, :owner_id => @article.id %>
488
+ ...
489
+ <% end %>
490
+ ```
491
+
492
+ ```ruby
493
+ 警告: @article应该事先被创建,@article.id不应该是空的。
494
+ ```
495
+
496
+ ####2. 在你自己的模型里加入has_many_kindeditor_assets
497
+
498
+ ```ruby
499
+ class Article < ActiveRecord::Base
500
+ has_many_kindeditor_assets :attachments, :dependent => :destroy
501
+ # has_many_kindeditor_assets :attachments, :dependent => :nullify
502
+ # has_many_kindeditor_assets :your_name, :dependent => :destroy
503
+ end
504
+ ```
505
+
506
+ ####3. 相互关系
507
+
508
+ ```ruby
509
+ article = Article.first
510
+ article.attachments # => the article's assets uploaded by kindeditor
511
+ asset = article.attachments.first
512
+ asset.owner # => aritcle
513
+ ```
514
+
515
+ ### 如果你使用的是mongoid, 请在你的Gemfile里加入'gem "carrierwave-mongoid"'
516
+
517
+ ```ruby
518
+ gem 'carrierwave-mongoid'
519
+ ```
520
+
521
+ ## License
522
+
523
+ MIT License.