rails_kindeditor 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. data/README.rdoc +115 -16
  2. data/app/controllers/kindeditor/assets_controller.rb +119 -42
  3. data/app/uploaders/kindeditor/asset_uploader.rb +68 -0
  4. data/app/uploaders/kindeditor/file_uploader.rb +3 -58
  5. data/app/uploaders/kindeditor/flash_uploader.rb +14 -0
  6. data/app/uploaders/kindeditor/image_uploader.rb +3 -58
  7. data/app/uploaders/kindeditor/media_uploader.rb +14 -0
  8. data/lib/generators/rails_kindeditor/install/install_generator.rb +1 -2
  9. data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor-init.js +9 -8
  10. data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor-min.js +158 -0
  11. data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/en.js +208 -0
  12. data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/zh_CN.js +210 -0
  13. data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/zh_TW.js +210 -0
  14. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/clearhtml/clearhtml.js +28 -0
  15. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/code/code.js +57 -0
  16. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/code/prettify.css +13 -0
  17. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/code/prettify.js +28 -0
  18. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/emoticons.js +129 -0
  19. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{0.gif → images/0.gif} +0 -0
  20. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{1.gif → images/1.gif} +0 -0
  21. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{10.gif → images/10.gif} +0 -0
  22. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{100.gif → images/100.gif} +0 -0
  23. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{101.gif → images/101.gif} +0 -0
  24. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{102.gif → images/102.gif} +0 -0
  25. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{103.gif → images/103.gif} +0 -0
  26. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{104.gif → images/104.gif} +0 -0
  27. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{105.gif → images/105.gif} +0 -0
  28. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{106.gif → images/106.gif} +0 -0
  29. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{107.gif → images/107.gif} +0 -0
  30. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{108.gif → images/108.gif} +0 -0
  31. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{109.gif → images/109.gif} +0 -0
  32. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{11.gif → images/11.gif} +0 -0
  33. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{110.gif → images/110.gif} +0 -0
  34. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{111.gif → images/111.gif} +0 -0
  35. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{112.gif → images/112.gif} +0 -0
  36. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{113.gif → images/113.gif} +0 -0
  37. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{114.gif → images/114.gif} +0 -0
  38. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{115.gif → images/115.gif} +0 -0
  39. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{116.gif → images/116.gif} +0 -0
  40. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{117.gif → images/117.gif} +0 -0
  41. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{118.gif → images/118.gif} +0 -0
  42. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{119.gif → images/119.gif} +0 -0
  43. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{12.gif → images/12.gif} +0 -0
  44. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{120.gif → images/120.gif} +0 -0
  45. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{121.gif → images/121.gif} +0 -0
  46. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{122.gif → images/122.gif} +0 -0
  47. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{123.gif → images/123.gif} +0 -0
  48. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{124.gif → images/124.gif} +0 -0
  49. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{125.gif → images/125.gif} +0 -0
  50. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{126.gif → images/126.gif} +0 -0
  51. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{127.gif → images/127.gif} +0 -0
  52. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{128.gif → images/128.gif} +0 -0
  53. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{129.gif → images/129.gif} +0 -0
  54. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{13.gif → images/13.gif} +0 -0
  55. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{130.gif → images/130.gif} +0 -0
  56. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{131.gif → images/131.gif} +0 -0
  57. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{132.gif → images/132.gif} +0 -0
  58. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{133.gif → images/133.gif} +0 -0
  59. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{134.gif → images/134.gif} +0 -0
  60. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{14.gif → images/14.gif} +0 -0
  61. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{15.gif → images/15.gif} +0 -0
  62. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{16.gif → images/16.gif} +0 -0
  63. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{17.gif → images/17.gif} +0 -0
  64. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{18.gif → images/18.gif} +0 -0
  65. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{19.gif → images/19.gif} +0 -0
  66. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{2.gif → images/2.gif} +0 -0
  67. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{20.gif → images/20.gif} +0 -0
  68. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{21.gif → images/21.gif} +0 -0
  69. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{22.gif → images/22.gif} +0 -0
  70. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{23.gif → images/23.gif} +0 -0
  71. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{24.gif → images/24.gif} +0 -0
  72. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{25.gif → images/25.gif} +0 -0
  73. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{26.gif → images/26.gif} +0 -0
  74. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{27.gif → images/27.gif} +0 -0
  75. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{28.gif → images/28.gif} +0 -0
  76. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{29.gif → images/29.gif} +0 -0
  77. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{3.gif → images/3.gif} +0 -0
  78. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{30.gif → images/30.gif} +0 -0
  79. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{31.gif → images/31.gif} +0 -0
  80. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{32.gif → images/32.gif} +0 -0
  81. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{33.gif → images/33.gif} +0 -0
  82. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{34.gif → images/34.gif} +0 -0
  83. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{35.gif → images/35.gif} +0 -0
  84. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{36.gif → images/36.gif} +0 -0
  85. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{37.gif → images/37.gif} +0 -0
  86. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{38.gif → images/38.gif} +0 -0
  87. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{39.gif → images/39.gif} +0 -0
  88. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{4.gif → images/4.gif} +0 -0
  89. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{40.gif → images/40.gif} +0 -0
  90. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{41.gif → images/41.gif} +0 -0
  91. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{42.gif → images/42.gif} +0 -0
  92. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{43.gif → images/43.gif} +0 -0
  93. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{44.gif → images/44.gif} +0 -0
  94. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{45.gif → images/45.gif} +0 -0
  95. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{46.gif → images/46.gif} +0 -0
  96. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{47.gif → images/47.gif} +0 -0
  97. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{48.gif → images/48.gif} +0 -0
  98. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{49.gif → images/49.gif} +0 -0
  99. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{5.gif → images/5.gif} +0 -0
  100. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{50.gif → images/50.gif} +0 -0
  101. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{51.gif → images/51.gif} +0 -0
  102. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{52.gif → images/52.gif} +0 -0
  103. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{53.gif → images/53.gif} +0 -0
  104. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{54.gif → images/54.gif} +0 -0
  105. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{55.gif → images/55.gif} +0 -0
  106. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{56.gif → images/56.gif} +0 -0
  107. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{57.gif → images/57.gif} +0 -0
  108. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{58.gif → images/58.gif} +0 -0
  109. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{59.gif → images/59.gif} +0 -0
  110. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{6.gif → images/6.gif} +0 -0
  111. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{60.gif → images/60.gif} +0 -0
  112. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{61.gif → images/61.gif} +0 -0
  113. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{62.gif → images/62.gif} +0 -0
  114. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{63.gif → images/63.gif} +0 -0
  115. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{64.gif → images/64.gif} +0 -0
  116. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{65.gif → images/65.gif} +0 -0
  117. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{66.gif → images/66.gif} +0 -0
  118. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{67.gif → images/67.gif} +0 -0
  119. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{68.gif → images/68.gif} +0 -0
  120. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{69.gif → images/69.gif} +0 -0
  121. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{7.gif → images/7.gif} +0 -0
  122. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{70.gif → images/70.gif} +0 -0
  123. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{71.gif → images/71.gif} +0 -0
  124. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{72.gif → images/72.gif} +0 -0
  125. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{73.gif → images/73.gif} +0 -0
  126. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{74.gif → images/74.gif} +0 -0
  127. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{75.gif → images/75.gif} +0 -0
  128. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{76.gif → images/76.gif} +0 -0
  129. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{77.gif → images/77.gif} +0 -0
  130. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{78.gif → images/78.gif} +0 -0
  131. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{79.gif → images/79.gif} +0 -0
  132. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{8.gif → images/8.gif} +0 -0
  133. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{80.gif → images/80.gif} +0 -0
  134. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{81.gif → images/81.gif} +0 -0
  135. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{82.gif → images/82.gif} +0 -0
  136. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{83.gif → images/83.gif} +0 -0
  137. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{84.gif → images/84.gif} +0 -0
  138. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{85.gif → images/85.gif} +0 -0
  139. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{86.gif → images/86.gif} +0 -0
  140. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{87.gif → images/87.gif} +0 -0
  141. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{88.gif → images/88.gif} +0 -0
  142. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{89.gif → images/89.gif} +0 -0
  143. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{9.gif → images/9.gif} +0 -0
  144. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{90.gif → images/90.gif} +0 -0
  145. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{91.gif → images/91.gif} +0 -0
  146. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{92.gif → images/92.gif} +0 -0
  147. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{93.gif → images/93.gif} +0 -0
  148. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{94.gif → images/94.gif} +0 -0
  149. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{95.gif → images/95.gif} +0 -0
  150. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{96.gif → images/96.gif} +0 -0
  151. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{97.gif → images/97.gif} +0 -0
  152. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{98.gif → images/98.gif} +0 -0
  153. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{99.gif → images/99.gif} +0 -0
  154. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{qq.gif → images/static.gif} +0 -0
  155. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/filemanager/filemanager.js +189 -0
  156. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/file-16.gif +0 -0
  157. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/file-64.gif +0 -0
  158. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/folder-16.gif +0 -0
  159. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/folder-64.gif +0 -0
  160. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/go-up.gif +0 -0
  161. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/flash/flash.js +128 -0
  162. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/image.js +226 -0
  163. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/insertfile/insertfile.js +104 -0
  164. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/lineheight/lineheight.js +38 -0
  165. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/link/link.js +59 -0
  166. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/map/map.html +57 -0
  167. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/map/map.js +135 -0
  168. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/media/media.js +136 -0
  169. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/pagebreak/pagebreak.js +26 -0
  170. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/plainpaste/plainpaste.js +41 -0
  171. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/preview/preview.js +31 -0
  172. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/quickformat/quickformat.js +71 -0
  173. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/table/table.js +661 -0
  174. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/html/1.html +14 -0
  175. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/html/2.html +42 -0
  176. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/html/3.html +36 -0
  177. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/template.js +58 -0
  178. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/wordpaste/wordpaste.js +57 -0
  179. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/blank.gif +0 -0
  180. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/flash.gif +0 -0
  181. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/loading.gif +0 -0
  182. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/media.gif +0 -0
  183. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/rm.gif +0 -0
  184. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/default/bg.gif +0 -0
  185. data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes/default}/default.css +427 -396
  186. data/lib/generators/rails_kindeditor/install/templates/kindeditor/themes/default/default.gif +0 -0
  187. data/lib/generators/rails_kindeditor/install/templates/kindeditor/themes/simple/simple.css +148 -0
  188. data/lib/generators/rails_kindeditor/migration/migration_generator.rb +16 -3
  189. data/{app/models → lib/generators/rails_kindeditor/migration/templates/models/active_record}/kindeditor/asset.rb +2 -5
  190. data/{app/models → lib/generators/rails_kindeditor/migration/templates/models/active_record}/kindeditor/file.rb +1 -2
  191. data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/flash.rb +3 -0
  192. data/{app/models → lib/generators/rails_kindeditor/migration/templates/models/active_record}/kindeditor/image.rb +1 -2
  193. data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/media.rb +3 -0
  194. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/asset.rb +20 -0
  195. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/file.rb +3 -0
  196. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/flash.rb +3 -0
  197. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/image.rb +3 -0
  198. data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/media.rb +3 -0
  199. data/lib/rails_kindeditor/helper.rb +14 -2
  200. data/lib/rails_kindeditor/version.rb +1 -1
  201. data/rails_kindeditor.gemspec +3 -3
  202. metadata +199 -182
  203. data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor.js +0 -4688
  204. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/about.html +0 -52
  205. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/accessory.html +0 -74
  206. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/advtable/advtable.html +0 -235
  207. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/advtable/cell.html +0 -201
  208. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.css +0 -64
  209. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.html +0 -31
  210. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.js +0 -221
  211. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/flash.html +0 -69
  212. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/image.html +0 -305
  213. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/link/link.html +0 -82
  214. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/media.html +0 -73
  215. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/plainpaste.html +0 -44
  216. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/wordpaste.html +0 -50
  217. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/doc.gif +0 -0
  218. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/editor.css +0 -47
  219. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/mp3.gif +0 -0
  220. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/pdf.gif +0 -0
  221. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/rar.gif +0 -0
  222. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/xls.gif +0 -0
  223. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/default/default.gif +0 -0
data/README.rdoc CHANGED
@@ -1,27 +1,23 @@
1
- == kindeditor for rails3
1
+ == Kindeditor(4.x) for Rails3
2
+
3
+ Kindeditor for Rails3, including image and file upload with carrierwave.
2
4
 
3
5
  == Installation
4
6
 
5
- add this to your Gemfile
7
+ Add this to your Gemfile
6
8
 
7
- gem "carrierwave", "~> 0.5.4"
9
+ gem "carrierwave"
8
10
  gem "rails_kindeditor"
9
11
 
10
12
  Run "bundle" command.
11
13
 
12
14
  bundle
13
15
 
14
- After you install rails_kindeditor and add it to your Gemfile, you need to run the generator:
16
+ Run install generator:
15
17
 
16
18
  rails generate rails_kindeditor:install
17
-
18
- The generator will copy kindeditor to your application. When you are done, you are ready to add migration using the generator:
19
-
20
- rails generate rails_kindeditor:migration
21
-
22
- The generator will copy migration to your application. When you are done, remember run rake db:migrate:
23
-
24
- rake db:migrate
19
+
20
+ That's all! By default, rails_kindeditor do not save upload file information into database.
25
21
 
26
22
  == Usage
27
23
 
@@ -33,20 +29,123 @@ In your controller, use include_kindeditor method to load kindeditor javascript:
33
29
 
34
30
  include_kindeditor
35
31
 
32
+ Assign your textarea with id
33
+
34
+ :id => "kindeditor_id"
35
+
36
+ That's all.
37
+
38
+ == Save upload file information into database(optional)
39
+
40
+ rails_kindeditor can save upload file information into database.
41
+
42
+ Just run migration generate, there are two ORM options for you: 1.active_record 2.mongoid, default is active_record.
43
+
44
+ rails generate rails_kindeditor:migration
45
+ or
46
+ rails generate rails_kindeditor:migration -o mongoid
47
+
48
+ The generator will copy model and migration to your application. When you are done, remember run rake db:migrate:
49
+
50
+ rake db:migrate
51
+
52
+ That's all.
53
+
54
+ == Configuration options
55
+
56
+ When you use include_kindeditor_if_needed function, you can set :lang and :cache options like this:
57
+
58
+ <%= include_kindeditor_if_needed :lang => :en %>
59
+ <%= include_kindeditor_if_needed :lang => :zh_CN %>
60
+ <%= include_kindeditor_if_needed :cache => true %>
61
+ <%= include_kindeditor_if_needed :cache => "my-cache-name" %>
62
+ <%= include_kindeditor_if_needed :lang => :zh_CN, :cache => true %>
63
+
36
64
  You can load kindeditor javascript only in some action if you needed:
37
65
 
38
66
  include_kindeditor :only => [:new, :edit]
39
67
  include_kindeditor :except => [:index, :show, :destroy, :create]
68
+
69
+ You can config kindeditor by rails_kindeditor-init.js file, please read Kindeditor's documents:
40
70
 
41
- Assign your textarea with id
71
+ public/javascripts/kindeditor/kindeditor-init.js
72
+
73
+ == License
74
+
75
+ MIT License. Copyright 2011
76
+
77
+ == Kindeditor(4.x) for Rails3 中文文档
78
+
79
+ 可供Rails3使用的gem, 包括了图片和附件上传功能,文件按照类型、日期进行存储。上传采用了Carrierwave。
80
+
81
+ == 安装
82
+
83
+ 将下面代码加入Gemfile:
84
+
85
+ gem "carrierwave"
86
+ gem "rails_kindeditor"
87
+
88
+ 运行"bundle"命令:
89
+
90
+ bundle
91
+
92
+ 安装Kindeditor,运行下面的代码:
93
+
94
+ rails generate rails_kindeditor:install
95
+
96
+ 完毕!默认情况下,rails_kindeditor在上传文件时不会把文件信息记录入数据库。
97
+
98
+ == 使用
99
+
100
+ 在你的layout文件中的<head></head>内包含下面代码:
101
+
102
+ <%= include_kindeditor_if_needed %>
103
+
104
+ 在你需要使用的controller里面,包含下面代码来控制加载javascript:
105
+
106
+ include_kindeditor
107
+
108
+ 把需要转换的textarea赋予下列id值:
42
109
 
43
110
  :id => "kindeditor_id"
44
111
 
45
- You can config kindeditor by rails_kindeditor-init.js file:
112
+ 完毕!
113
+
114
+ == 将上传文件信息记录入数据库(可选)
115
+
116
+ rails_kindeditor 可以将上传文件信息记录入数据库,以便扩展应用.
117
+
118
+ 运行下面的代码,有两项选项:1.active_record 2.mongoid,默认是active_record。
119
+
120
+ rails generate rails_kindeditor:migration
121
+ or
122
+ rails generate rails_kindeditor:migration -o mongoid
123
+
124
+ 运行下面的代码:
125
+
126
+ rake db:migrate
127
+
128
+ 完毕!
129
+
130
+ == 配置选项
131
+
132
+ 当你使用include_kindeditor_if_needed时,你可以像下面一样设置:lang和:cache:
133
+
134
+ <%= include_kindeditor_if_needed :lang => :en %>
135
+ <%= include_kindeditor_if_needed :lang => :zh_CN %>
136
+ <%= include_kindeditor_if_needed :cache => true %>
137
+ <%= include_kindeditor_if_needed :cache => "my-cache-name" %>
138
+ <%= include_kindeditor_if_needed :lang => :zh_CN, :cache => true %>
139
+
140
+ 你可以有选择性地加载kindeditor的javascript:
141
+
142
+ include_kindeditor :only => [:new, :edit]
143
+ include_kindeditor :except => [:index, :show, :destroy, :create]
144
+
145
+ 你可以通过修改rails_kindeditor-init.js来配置kindeditor,详细配置方法可以阅读Kindeditor的文档:
46
146
 
47
147
  public/javascripts/kindeditor/kindeditor-init.js
48
148
 
49
149
  == License
50
150
 
51
- MIT License. Copyright 2011
52
-
151
+ MIT License. Copyright 2011
@@ -1,50 +1,127 @@
1
+ #coding: utf-8
2
+ require "find"
1
3
  class Kindeditor::AssetsController < ApplicationController
2
-
3
4
  def create
4
- @asset_params = params[:imgFile]
5
- case @asset_params.content_type.gsub(/\/[a-z]*/, "")
6
- when 'image'
7
- @asset = Kindeditor::Image.new(:asset => @asset_params)
8
- if @asset.save
9
- render :text => ({:error => 0, :url => @asset.asset.url}.to_json)
10
- else
11
- render :text => ({:error => 1, :message => @asset.errors.full_messages}.to_json)
12
- end
13
- else # other type files
14
- @asset = Kindeditor::File.new(:asset => params[:imgFile])
15
- if @asset.save
16
- str = "<script type='text/javascript'>parent.KE.plugin['accessory'].insert('" \
17
- + request[:id] + "', '" + @asset.asset.url + "','" + @asset.asset.filename \
18
- + "','" + File.extname(@asset.asset.to_s).gsub(".","") + "');</script>"
19
- render :text => str
20
- else
21
- render :nothing => true
5
+ @imgFile = params[:imgFile]
6
+ @dir = params[:dir]
7
+ unless @imgFile.nil?
8
+ if save_upload_info? # save upload info into database
9
+ begin
10
+ @asset = "Kindeditor::#{@dir.camelize}".constantize.new(:asset => @imgFile)
11
+ if @asset.save
12
+ render :text => ({:error => 0, :url => @asset.asset.url}.to_json)
13
+ else
14
+ show_error(@asset.errors.full_messages)
15
+ end
16
+ rescue
17
+ show_error("Internal Error!")
18
+ end
19
+ else # do not touch database
20
+ begin
21
+ uploader = "Kindeditor::#{@dir.camelize}Uploader".constantize.new
22
+ uploader.store!(@imgFile)
23
+ render :text => ({:error => 0, :url => uploader.url}.to_json)
24
+ rescue CarrierWave::UploadError => e
25
+ show_error(e.message)
26
+ rescue
27
+ show_error("Internal Error!")
28
+ end
22
29
  end
30
+ else
31
+ show_error("No File Selected!")
23
32
  end
24
33
  end
25
34
 
26
35
  def list
27
- order = case params[:order]
28
- when "NAME"
29
- "asset"
30
- when "TYPE"
31
- "file_type"
32
- when "SIZE"
33
- "file_size"
34
- else
35
- "id"
36
- end
37
- @images = Kindeditor::Image.where("file_type LIKE '%image%'").order(order).all
38
- @json = []
39
- for image in @images
40
- temp = %Q{{"filesize":#{image.file_size},
41
- "filename":"#{image.asset.to_s}",
42
- "dir_path":"#{image.asset.url}",
43
- "datetime":"#{image.created_at.to_date}"}}
44
- @json << temp
45
- end
46
- render :text => ("{\"file_list\":[" << @json.join(",") << "]}")
47
- end
48
-
49
- end
36
+ @root_path = Rails.public_path + "/uploads/"
37
+ @root_url = "/uploads/"
38
+ @img_ext = Kindeditor::AssetUploader::EXT_NAMES[:image]
39
+ @dir = params[:dir].strip || ""
40
+ unless Kindeditor::AssetUploader::EXT_NAMES.keys.map(&:to_s).push("").include?(@dir)
41
+ render :text => "Invalid Directory name."
42
+ return
43
+ end
44
+ unless @dir.empty?
45
+ @root_path += @dir + "/"
46
+ @root_url += @dir + "/"
47
+ Dir.mkdir(@root_path) unless File.exist?(@root_path)
48
+ end
49
+
50
+ @path = params[:path].strip || ""
51
+ if @path.empty?
52
+ @current_path = @root_path
53
+ @current_url = @root_url
54
+ @current_dir_path = ""
55
+ @moveup_dir_path = ""
56
+ else
57
+ @current_path = @root_path + @path + "/"
58
+ @current_url = @root_url + @path + "/"
59
+ @current_dir_path = @path
60
+ @moveup_dir_path = @current_dir_path.gsub(/(.*?)[^\/]+\/$/, "")
61
+ end
62
+ @order = %w(name size type).include?(params[:order].downcase) ? params[:order].downcase : "name"
63
+ if !@current_path.match(/\.\./).nil?
64
+ render :text => "Access is not allowed."
65
+ return
66
+ end
67
+ if @current_path.match(/\/$/).nil?
68
+ render :text => "Parameter is not valid."
69
+ return
70
+ end
71
+ if !File.exist?(@current_path) || !File.directory?(@current_path)
72
+ render :text => "Directory does not exist."
73
+ return
74
+ end
75
+ @file_list = []
76
+ Dir.foreach(@current_path) do |filename|
77
+ hash = {}
78
+ if filename != "." and filename != ".." and filename != ".DS_Store"
79
+ file = @current_path + filename
80
+ if File.directory?(file)
81
+ hash[:is_dir] = true
82
+ hash[:has_file] = (Dir.foreach(file).count > 2)
83
+ hash[:filesize] = 0
84
+ hash[:is_photo] = false
85
+ hash[:filetype] = ""
86
+ else
87
+ hash[:is_dir] = false
88
+ hash[:has_file] = false
89
+ hash[:filesize] = File.size(file)
90
+ hash[:dir_path] = ""
91
+ file_ext = file.gsub(/.*\./,"")
92
+ hash[:is_photo] = @img_ext.include?(file_ext)
93
+ hash[:filetype] = file_ext
94
+ end
95
+ hash[:filename] = filename
96
+ hash[:datetime] = File.mtime(file).to_s(:db)
97
+ @file_list << hash
98
+ end
99
+ end
50
100
 
101
+ @file_list.sort! {|a, b| a["file#{@order}".to_sym] <=> b["file#{@order}".to_sym]}
102
+
103
+ @result = {}
104
+ @result[:moveup_dir_path] = @moveup_dir_path
105
+ @result[:current_dir_path] = @current_dir_path
106
+ @result[:current_url] = @current_url
107
+ @result[:total_count] = @file_list.count
108
+ @result[:file_list] = @file_list
109
+ render :text => @result.to_json
110
+ end
111
+
112
+ private
113
+ def show_error(msg)
114
+ render :text => ({:error => 1, :message => msg}.to_json)
115
+ end
116
+
117
+ def save_upload_info?
118
+ begin
119
+ %w(asset file flash image media).each do |s|
120
+ "Kindeditor::#{s.camelize}".constantize
121
+ end
122
+ return true
123
+ rescue
124
+ return false
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,68 @@
1
+ # encoding: utf-8
2
+
3
+ class Kindeditor::AssetUploader < CarrierWave::Uploader::Base
4
+
5
+ EXT_NAMES = {:image => %w[gif jpg jpeg png bmp],
6
+ :flash => %w[swf flv],
7
+ :media => %w[swf flv mp3 wav wma wmv mid avi mpg asf rm rmvb],
8
+ :file => %w[doc docx xls xlsx ppt htm html txt zip rar gz bz2]}
9
+
10
+ # Include RMagick or ImageScience support:
11
+ # include CarrierWave::RMagick
12
+ # include CarrierWave::ImageScience
13
+
14
+ # Choose what kind of storage to use for this uploader:
15
+ storage :file
16
+ # storage :fog
17
+
18
+ # Override the directory where uploaded files will be stored.
19
+ # This is a sensible default for uploaders that are meant to be mounted:
20
+
21
+ def cache_dir
22
+ "#{Rails.root}/tmp/uploads"
23
+ end
24
+
25
+ # Provide a default URL as a default if there hasn't been a file uploaded:
26
+ # def default_url
27
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
28
+ # end
29
+
30
+ # Process files as they are uploaded:
31
+ # process :scale => [200, 300]
32
+ #
33
+ # def scale(width, height)
34
+ # # do something
35
+ # end
36
+
37
+ # Create different versions of your uploaded files:
38
+ # version :thumb do
39
+ # process :scale => [50, 50]
40
+ # end
41
+
42
+ # Add a white list of extensions which are allowed to be uploaded.
43
+ # For images you might use something like this:
44
+
45
+ # Override the filename of the uploaded files:
46
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
47
+ before :store, :remember_cache_id
48
+ after :store, :delete_tmp_dir
49
+
50
+ # store! nil's the cache_id after it finishes so we need to remember it for deletition
51
+ def remember_cache_id(new_file)
52
+ @cache_id_was = cache_id
53
+ end
54
+
55
+ def delete_tmp_dir(new_file)
56
+ # make sure we don't delete other things accidentally by checking the name pattern
57
+ if @cache_id_was.present? && @cache_id_was =~ /\A[\d]{8}\-[\d]{4}\-[\d]+\-[\d]{4}\z/
58
+ FileUtils.rm_rf(File.join(cache_dir, @cache_id_was))
59
+ end
60
+ end
61
+
62
+ def filename
63
+ @name ||= Time.now.to_s(:number)
64
+ "#{@name}#{File.extname(original_filename).downcase}" if original_filename
65
+ end
66
+
67
+ end
68
+
@@ -1,68 +1,13 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Kindeditor::FileUploader < CarrierWave::Uploader::Base
3
+ class Kindeditor::FileUploader < Kindeditor::AssetUploader
4
4
 
5
- # Include RMagick or ImageScience support:
6
- # include CarrierWave::RMagick
7
- # include CarrierWave::ImageScience
8
-
9
- # Choose what kind of storage to use for this uploader:
10
- storage :file
11
- # storage :fog
12
-
13
- # Override the directory where uploaded files will be stored.
14
- # This is a sensible default for uploaders that are meant to be mounted:
15
5
  def store_dir
16
- "uploads/File/#{Time.now.strftime("%Y-%m")}"
17
- end
18
-
19
- def cache_dir
20
- "#{Rails.root}/tmp/uploads"
6
+ "uploads/file/#{Time.now.strftime("%Y%m")}"
21
7
  end
22
8
 
23
- # Provide a default URL as a default if there hasn't been a file uploaded:
24
- # def default_url
25
- # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
26
- # end
27
-
28
- # Process files as they are uploaded:
29
- # process :scale => [200, 300]
30
- #
31
- # def scale(width, height)
32
- # # do something
33
- # end
34
-
35
- # Create different versions of your uploaded files:
36
- # version :thumb do
37
- # process :scale => [50, 50]
38
- # end
39
-
40
- # Add a white list of extensions which are allowed to be uploaded.
41
- # For images you might use something like this:
42
9
  def extension_white_list
43
- %w(doc xls ppt docx xlsx pptx pdf txt rar zip mp3)
44
- end
45
-
46
- # Override the filename of the uploaded files:
47
- # Avoid using model.id or version_name here, see uploader/store.rb for details.
48
- before :store, :remember_cache_id
49
- after :store, :delete_tmp_dir
50
-
51
- # store! nil's the cache_id after it finishes so we need to remember it for deletition
52
- def remember_cache_id(new_file)
53
- @cache_id_was = cache_id
54
- end
55
-
56
- def delete_tmp_dir(new_file)
57
- # make sure we don't delete other things accidentally by checking the name pattern
58
- if @cache_id_was.present? && @cache_id_was =~ /\A[\d]{8}\-[\d]{4}\-[\d]+\-[\d]{4}\z/
59
- FileUtils.rm_rf(File.join(cache_dir, @cache_id_was))
60
- end
61
- end
62
-
63
- def filename
64
- @name ||= Time.now.to_s(:number)
65
- "#{@name}#{File.extname(original_filename).downcase}" if original_filename
10
+ EXT_NAMES[:file]
66
11
  end
67
12
 
68
13
  end
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+
3
+ class Kindeditor::FlashUploader < Kindeditor::AssetUploader
4
+
5
+ def store_dir
6
+ "uploads/flash/#{Time.now.strftime("%Y%m")}"
7
+ end
8
+
9
+ def extension_white_list
10
+ EXT_NAMES[:flash]
11
+ end
12
+
13
+ end
14
+
@@ -1,68 +1,13 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Kindeditor::ImageUploader < CarrierWave::Uploader::Base
3
+ class Kindeditor::ImageUploader < Kindeditor::AssetUploader
4
4
 
5
- # Include RMagick or ImageScience support:
6
- # include CarrierWave::RMagick
7
- # include CarrierWave::ImageScience
8
-
9
- # Choose what kind of storage to use for this uploader:
10
- storage :file
11
- # storage :fog
12
-
13
- # Override the directory where uploaded files will be stored.
14
- # This is a sensible default for uploaders that are meant to be mounted:
15
5
  def store_dir
16
- "uploads/Image/#{Time.now.strftime("%Y-%m")}"
17
- end
18
-
19
- def cache_dir
20
- "#{Rails.root}/tmp/uploads"
6
+ "uploads/image/#{Time.now.strftime("%Y%m")}"
21
7
  end
22
8
 
23
- # Provide a default URL as a default if there hasn't been a file uploaded:
24
- # def default_url
25
- # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
26
- # end
27
-
28
- # Process files as they are uploaded:
29
- # process :scale => [200, 300]
30
- #
31
- # def scale(width, height)
32
- # # do something
33
- # end
34
-
35
- # Create different versions of your uploaded files:
36
- # version :thumb do
37
- # process :scale => [50, 50]
38
- # end
39
-
40
- # Add a white list of extensions which are allowed to be uploaded.
41
- # For images you might use something like this:
42
9
  def extension_white_list
43
- %w(jpg gif png bmp)
44
- end
45
-
46
- # Override the filename of the uploaded files:
47
- # Avoid using model.id or version_name here, see uploader/store.rb for details.
48
- before :store, :remember_cache_id
49
- after :store, :delete_tmp_dir
50
-
51
- # store! nil's the cache_id after it finishes so we need to remember it for deletition
52
- def remember_cache_id(new_file)
53
- @cache_id_was = cache_id
54
- end
55
-
56
- def delete_tmp_dir(new_file)
57
- # make sure we don't delete other things accidentally by checking the name pattern
58
- if @cache_id_was.present? && @cache_id_was =~ /\A[\d]{8}\-[\d]{4}\-[\d]+\-[\d]{4}\z/
59
- FileUtils.rm_rf(File.join(cache_dir, @cache_id_was))
60
- end
61
- end
62
-
63
- def filename
64
- @name ||= Time.now.to_s(:number)
65
- "#{@name}#{File.extname(original_filename).downcase}" if original_filename
10
+ EXT_NAMES[:image]
66
11
  end
67
12
 
68
13
  end
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+
3
+ class Kindeditor::MediaUploader < Kindeditor::AssetUploader
4
+
5
+ def store_dir
6
+ "uploads/media/#{Time.now.strftime("%Y%m")}"
7
+ end
8
+
9
+ def extension_white_list
10
+ EXT_NAMES[:media]
11
+ end
12
+
13
+ end
14
+
@@ -7,5 +7,4 @@ module RailsKindeditor
7
7
  directory "kindeditor", "public/javascripts/kindeditor"
8
8
  end
9
9
  end
10
- end
11
-
10
+ end
@@ -1,8 +1,9 @@
1
- KE.show({
2
- id : 'kindeditor_id',
3
- width: "100%",
4
- allowFileManager: true,
5
- imageUploadJson : '/kindeditor/upload',
6
- fileManagerJson: '/kindeditor/filemanager'
7
- });
8
-
1
+ KindEditor.ready(function(K) {
2
+ K.create('#kindeditor_id', {
3
+ width: "100%",
4
+ allowFileManager: true,
5
+ langType: "zh_CN",
6
+ uploadJson: '/kindeditor/upload',
7
+ fileManagerJson: '/kindeditor/filemanager'
8
+ });
9
+ });