ueditor_rails4 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.markdown +45 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/images/ueditor/themes/default/anchor.gif +0 -0
  6. data/app/assets/images/ueditor/themes/default/arrow.png +0 -0
  7. data/app/assets/images/ueditor/themes/default/button-bg.gif +0 -0
  8. data/app/assets/images/ueditor/themes/default/cancelbutton.gif +0 -0
  9. data/app/assets/images/ueditor/themes/default/cursor_h.gif +0 -0
  10. data/app/assets/images/ueditor/themes/default/cursor_h.png +0 -0
  11. data/app/assets/images/ueditor/themes/default/cursor_v.gif +0 -0
  12. data/app/assets/images/ueditor/themes/default/cursor_v.png +0 -0
  13. data/app/assets/images/ueditor/themes/default/dialog-title-bg.png +0 -0
  14. data/app/assets/images/ueditor/themes/default/filescan.png +0 -0
  15. data/app/assets/images/ueditor/themes/default/highlighted.gif +0 -0
  16. data/app/assets/images/ueditor/themes/default/icons-all.gif +0 -0
  17. data/app/assets/images/ueditor/themes/default/icons.gif +0 -0
  18. data/app/assets/images/ueditor/themes/default/icons.png +0 -0
  19. data/app/assets/images/ueditor/themes/default/lock.gif +0 -0
  20. data/app/assets/images/ueditor/themes/default/neweditor-tab-bg.png +0 -0
  21. data/app/assets/images/ueditor/themes/default/pagebreak.gif +0 -0
  22. data/app/assets/images/ueditor/themes/default/scale.png +0 -0
  23. data/app/assets/images/ueditor/themes/default/spacer.gif +0 -0
  24. data/app/assets/images/ueditor/themes/default/sparator_v.png +0 -0
  25. data/app/assets/images/ueditor/themes/default/toolbar_bg.png +0 -0
  26. data/app/assets/images/ueditor/themes/default/unhighlighted.gif +0 -0
  27. data/app/assets/images/ueditor/themes/default/upload.png +0 -0
  28. data/app/assets/images/ueditor/themes/default/videologo.gif +0 -0
  29. data/app/assets/images/ueditor/themes/default/word.gif +0 -0
  30. data/app/assets/images/ueditor/themes/default/wordpaste.png +0 -0
  31. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_chm.gif +0 -0
  32. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_default.png +0 -0
  33. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_doc.gif +0 -0
  34. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_exe.gif +0 -0
  35. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_mp3.gif +0 -0
  36. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_mv.gif +0 -0
  37. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_pdf.gif +0 -0
  38. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_ppt.gif +0 -0
  39. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_psd.gif +0 -0
  40. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_rar.gif +0 -0
  41. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_txt.gif +0 -0
  42. data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_xls.gif +0 -0
  43. data/app/assets/images/ueditor_rails/dialogs/image/center_focus.jpg +0 -0
  44. data/app/assets/images/ueditor_rails/dialogs/image/left_focus.jpg +0 -0
  45. data/app/assets/images/ueditor_rails/dialogs/image/none_focus.jpg +0 -0
  46. data/app/assets/images/ueditor_rails/dialogs/image/right_focus.jpg +0 -0
  47. data/app/assets/images/ueditor_rails/dialogs/scrawl/addimg.png +0 -0
  48. data/app/assets/images/ueditor_rails/dialogs/scrawl/brush.png +0 -0
  49. data/app/assets/images/ueditor_rails/dialogs/scrawl/delimg.png +0 -0
  50. data/app/assets/images/ueditor_rails/dialogs/scrawl/delimgH.png +0 -0
  51. data/app/assets/images/ueditor_rails/dialogs/scrawl/empty.png +0 -0
  52. data/app/assets/images/ueditor_rails/dialogs/scrawl/emptyH.png +0 -0
  53. data/app/assets/images/ueditor_rails/dialogs/scrawl/eraser.png +0 -0
  54. data/app/assets/images/ueditor_rails/dialogs/scrawl/redo.png +0 -0
  55. data/app/assets/images/ueditor_rails/dialogs/scrawl/redoH.png +0 -0
  56. data/app/assets/images/ueditor_rails/dialogs/scrawl/scale.png +0 -0
  57. data/app/assets/images/ueditor_rails/dialogs/scrawl/scaleH.png +0 -0
  58. data/app/assets/images/ueditor_rails/dialogs/scrawl/size.png +0 -0
  59. data/app/assets/images/ueditor_rails/dialogs/scrawl/undo.png +0 -0
  60. data/app/assets/images/ueditor_rails/dialogs/scrawl/undoH.png +0 -0
  61. data/app/assets/javascripts/ueditor_rails/_config.js.erb +211 -0
  62. data/app/assets/javascripts/ueditor_rails/dialogs/attachment.js +5 -0
  63. data/app/assets/javascripts/ueditor_rails/dialogs/attachment/_callbacks.js +166 -0
  64. data/app/assets/javascripts/ueditor_rails/dialogs/attachment/_file_type_maps.js.erb +14 -0
  65. data/app/assets/javascripts/ueditor_rails/dialogs/image.js.erb +724 -0
  66. data/app/assets/javascripts/ueditor_rails/dialogs/scrawl.js +655 -0
  67. data/app/assets/javascripts/ueditor_rails/dialogs/wordimage.js +154 -0
  68. data/app/assets/javascripts/ueditor_rails/init.js +12 -0
  69. data/app/assets/stylesheets/ueditor/themes/default/dialogbase.css.erb +100 -0
  70. data/app/assets/stylesheets/ueditor/themes/default/ueditor.css +1582 -0
  71. data/app/assets/stylesheets/ueditor/themes/iframe.css +1 -0
  72. data/app/assets/stylesheets/ueditor_rails/dialogs/attachment.css.erb +161 -0
  73. data/app/assets/stylesheets/ueditor_rails/dialogs/image.css.erb +69 -0
  74. data/app/assets/stylesheets/ueditor_rails/dialogs/scrawl.css.erb +72 -0
  75. data/app/controllers/ueditor_rails/application_controller.rb +5 -0
  76. data/app/controllers/ueditor_rails/dialogs_controller.rb +21 -0
  77. data/app/controllers/ueditor_rails/libs_controller.rb +33 -0
  78. data/app/helpers/ueditor_rails/application_helper.rb +27 -0
  79. data/app/views/ueditor_rails/dialogs/attachment.html.erb +124 -0
  80. data/app/views/ueditor_rails/dialogs/image.html.erb +203 -0
  81. data/app/views/ueditor_rails/dialogs/scrawl.html.erb +96 -0
  82. data/app/views/ueditor_rails/dialogs/wordimage.html.erb +155 -0
  83. data/config/routes.rb +11 -0
  84. data/lib/generators/ueditor_rails/USAGE +8 -0
  85. data/lib/generators/ueditor_rails/install_generator.rb +15 -0
  86. data/lib/generators/ueditor_rails/templates/ueditor_config.js.erb +216 -0
  87. data/lib/tasks/ueditor_rails_tasks.rake +4 -0
  88. data/lib/ueditor_rails/engine.rb +17 -0
  89. data/lib/ueditor_rails/helpers/form_builder.rb +11 -0
  90. data/lib/ueditor_rails/helpers/form_helper.rb +37 -0
  91. data/lib/ueditor_rails/helpers/view_helper.rb +21 -0
  92. data/lib/ueditor_rails/util.rb +42 -0
  93. data/lib/ueditor_rails/version.rb +3 -0
  94. data/lib/ueditor_rails4.rb +32 -0
  95. data/test/dummy/README.rdoc +261 -0
  96. data/test/dummy/Rakefile +7 -0
  97. data/test/dummy/app/assets/javascripts/application.js +16 -0
  98. data/test/dummy/app/assets/javascripts/posts.js +2 -0
  99. data/test/dummy/app/assets/javascripts/ueditor_config.js.erb +208 -0
  100. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  101. data/test/dummy/app/assets/stylesheets/posts.css +4 -0
  102. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  103. data/test/dummy/app/controllers/application_controller.rb +3 -0
  104. data/test/dummy/app/controllers/posts_controller.rb +83 -0
  105. data/test/dummy/app/helpers/application_helper.rb +2 -0
  106. data/test/dummy/app/helpers/posts_helper.rb +2 -0
  107. data/test/dummy/app/models/post.rb +3 -0
  108. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  109. data/test/dummy/app/views/posts/_form.html.erb +25 -0
  110. data/test/dummy/app/views/posts/edit.html.erb +6 -0
  111. data/test/dummy/app/views/posts/index.html.erb +29 -0
  112. data/test/dummy/app/views/posts/new.html.erb +5 -0
  113. data/test/dummy/app/views/posts/show.html.erb +14 -0
  114. data/test/dummy/config.ru +4 -0
  115. data/test/dummy/config/application.rb +61 -0
  116. data/test/dummy/config/boot.rb +10 -0
  117. data/test/dummy/config/database.yml +25 -0
  118. data/test/dummy/config/environment.rb +5 -0
  119. data/test/dummy/config/environments/development.rb +37 -0
  120. data/test/dummy/config/environments/production.rb +67 -0
  121. data/test/dummy/config/environments/test.rb +37 -0
  122. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  123. data/test/dummy/config/initializers/inflections.rb +15 -0
  124. data/test/dummy/config/initializers/mime_types.rb +5 -0
  125. data/test/dummy/config/initializers/secret_token.rb +7 -0
  126. data/test/dummy/config/initializers/session_store.rb +8 -0
  127. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  128. data/test/dummy/config/locales/en.yml +5 -0
  129. data/test/dummy/config/routes.rb +8 -0
  130. data/test/dummy/db/migrate/20130327173045_create_posts.rb +10 -0
  131. data/test/dummy/db/schema.rb +23 -0
  132. data/test/dummy/public/404.html +26 -0
  133. data/test/dummy/public/422.html +26 -0
  134. data/test/dummy/public/500.html +25 -0
  135. data/test/dummy/public/favicon.ico +0 -0
  136. data/test/dummy/script/rails +6 -0
  137. data/test/dummy/test/fixtures/posts.yml +9 -0
  138. data/test/dummy/test/functional/posts_controller_test.rb +49 -0
  139. data/test/dummy/test/unit/helpers/posts_helper_test.rb +4 -0
  140. data/test/dummy/test/unit/post_test.rb +7 -0
  141. data/test/functional/ueditor_rails/dialogs_controller_test.rb +16 -0
  142. data/test/functional/ueditor_rails/libs_controller_test.rb +21 -0
  143. data/test/integration/navigation_test.rb +10 -0
  144. data/test/test_helper.rb +15 -0
  145. data/test/ueditor_rails_test.rb +7 -0
  146. data/vendor/assets/javascripts/ueditor/dialogs/anchor/anchor.html.erb +57 -0
  147. data/vendor/assets/javascripts/ueditor/dialogs/background/background.css +24 -0
  148. data/vendor/assets/javascripts/ueditor/dialogs/background/background.html.erb +55 -0
  149. data/vendor/assets/javascripts/ueditor/dialogs/background/background.js +348 -0
  150. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.css.erb +43 -0
  151. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.html.erb +54 -0
  152. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.js +186 -0
  153. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/0.gif +0 -0
  154. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/bface.gif +0 -0
  155. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/cface.gif +0 -0
  156. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/fface.gif +0 -0
  157. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/jxface2.gif +0 -0
  158. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
  159. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/tface.gif +0 -0
  160. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/wface.gif +0 -0
  161. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/yface.gif +0 -0
  162. data/vendor/assets/javascripts/ueditor/dialogs/gmap/gmap.html.erb +89 -0
  163. data/vendor/assets/javascripts/ueditor/dialogs/help/help.css +7 -0
  164. data/vendor/assets/javascripts/ueditor/dialogs/help/help.html.erb +84 -0
  165. data/vendor/assets/javascripts/ueditor/dialogs/help/help.js +54 -0
  166. data/vendor/assets/javascripts/ueditor/dialogs/highlightcode/highlightcode.html.erb +131 -0
  167. data/vendor/assets/javascripts/ueditor/dialogs/insertframe/insertframe.html.erb +98 -0
  168. data/vendor/assets/javascripts/ueditor/dialogs/internal.js +79 -0
  169. data/vendor/assets/javascripts/ueditor/dialogs/link/link.html.erb +141 -0
  170. data/vendor/assets/javascripts/ueditor/dialogs/map/map.html.erb +105 -0
  171. data/vendor/assets/javascripts/ueditor/dialogs/music/music.css +30 -0
  172. data/vendor/assets/javascripts/ueditor/dialogs/music/music.html.erb +32 -0
  173. data/vendor/assets/javascripts/ueditor/dialogs/music/music.js +192 -0
  174. data/vendor/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.html.erb +74 -0
  175. data/vendor/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.js +160 -0
  176. data/vendor/assets/javascripts/ueditor/dialogs/snapscreen/snapscreen.html.erb +91 -0
  177. data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.html.erb +21 -0
  178. data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.js +56 -0
  179. data/vendor/assets/javascripts/ueditor/dialogs/table/dragicon.png +0 -0
  180. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.css +75 -0
  181. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.html.erb +57 -0
  182. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.js +182 -0
  183. data/vendor/assets/javascripts/ueditor/dialogs/table/edittd.html.erb +51 -0
  184. data/vendor/assets/javascripts/ueditor/dialogs/table/edittip.html.erb +33 -0
  185. data/vendor/assets/javascripts/ueditor/dialogs/tangram.js +1238 -0
  186. data/vendor/assets/javascripts/ueditor/dialogs/template/config.js +42 -0
  187. data/vendor/assets/javascripts/ueditor/dialogs/template/images/bg.gif +0 -0
  188. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre0.png +0 -0
  189. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre1.png +0 -0
  190. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre2.png +0 -0
  191. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre3.png +0 -0
  192. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre4.png +0 -0
  193. data/vendor/assets/javascripts/ueditor/dialogs/template/template.css +18 -0
  194. data/vendor/assets/javascripts/ueditor/dialogs/template/template.html.erb +26 -0
  195. data/vendor/assets/javascripts/ueditor/dialogs/template/template.js +53 -0
  196. data/vendor/assets/javascripts/ueditor/dialogs/video/images/center_focus.jpg +0 -0
  197. data/vendor/assets/javascripts/ueditor/dialogs/video/images/left_focus.jpg +0 -0
  198. data/vendor/assets/javascripts/ueditor/dialogs/video/images/none_focus.jpg +0 -0
  199. data/vendor/assets/javascripts/ueditor/dialogs/video/images/right_focus.jpg +0 -0
  200. data/vendor/assets/javascripts/ueditor/dialogs/video/video.css +59 -0
  201. data/vendor/assets/javascripts/ueditor/dialogs/video/video.html.erb +78 -0
  202. data/vendor/assets/javascripts/ueditor/dialogs/video/video.js.erb +409 -0
  203. data/vendor/assets/javascripts/ueditor/dialogs/webapp/webapp.html.erb +64 -0
  204. data/vendor/assets/javascripts/ueditor/editor_all.js.erb +19133 -0
  205. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/copy.png +0 -0
  206. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/imglabel.png +0 -0
  207. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/localimage.png +0 -0
  208. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/music.png +0 -0
  209. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/upload.png +0 -0
  210. data/vendor/assets/javascripts/ueditor/lang/zh-cn/zh-cn.js +492 -0
  211. data/vendor/assets/javascripts/ueditor/third-party/SyntaxHighlighter/shCore.js +3655 -0
  212. data/vendor/assets/javascripts/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css +316 -0
  213. data/vendor/assets/javascripts/ueditor/third-party/codemirror/codemirror.css +104 -0
  214. data/vendor/assets/javascripts/ueditor/third-party/codemirror/codemirror.js +3581 -0
  215. data/vendor/assets/javascripts/ueditor/third-party/fClipboard_ueditor.swf +0 -0
  216. data/vendor/assets/javascripts/ueditor/third-party/imageUploader.swf +0 -0
  217. data/vendor/assets/javascripts/ueditor/third-party/snapscreen/UEditorSnapscreen.exe +0 -0
  218. data/vendor/assets/javascripts/ueditor/third-party/swfupload/fileprogress.js +215 -0
  219. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.cookies.js +53 -0
  220. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.js +1132 -0
  221. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.proxy.js +96 -0
  222. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.queue.js +98 -0
  223. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.speed.js +346 -0
  224. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.swf +0 -0
  225. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload_fp9.swf +0 -0
  226. data/vendor/assets/javascripts/ueditor/uparse.js +348 -0
  227. metadata +363 -0
@@ -0,0 +1,11 @@
1
+ UeditorRails::Engine.routes.draw do
2
+
3
+ %w(swf_image_uploader swf_upload swf_upload_fp9 fclipboard_ueditor).each do |lib|
4
+ get "libs/#{lib}"
5
+ end
6
+
7
+ %w(attachment image wordimage scrawl).each do |dialog|
8
+ get "dialogs/#{dialog}"
9
+ end
10
+
11
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate ueditor Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,15 @@
1
+ module UeditorRails
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ desc "Mount Engine and copy config file to Rails app."
6
+
7
+ def copy_config_file
8
+ template "ueditor_config.js.erb", "app/assets/javascripts/ueditor_config.js.erb"
9
+ end
10
+
11
+ def mount_engine
12
+ route "mount UeditorRails::Engine => '/ueditor'"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,216 @@
1
+ //= require_self
2
+ //= require ueditor_rails/init
3
+
4
+ window.MY_UEDITOR_CONFIG = {
5
+ imageUrl: "" //图片上传提交地址
6
+ , imagePath: "" //图片修正地址,引用了fixedImagePath,如有特殊需求,可自行配置
7
+ //,imageFieldName:"upfile" //图片数据的key,若此处修改,需要在后台对应文件修改对应参数
8
+ //,compressSide:0 //等比压缩的基准,确定maxImageSideLength参数的参照对象。0为按照最长边,1为按照宽度,2为按照高度
9
+ //,maxImageSideLength:900 //上传图片最大允许的边长,超过会自动等比缩放,不缩放就设置一个比较大的值,更多设置在image.html中
10
+
11
+ //涂鸦图片配置区
12
+ , scrawlUrl: "" //涂鸦上传地址
13
+ , scrawlPath: "" //图片修正地址,同imagePath
14
+
15
+ //附件上传配置区
16
+ , fileUrl: "" //附件上传提交地址
17
+ , filePath: "" //附件修正地址,同imagePath
18
+ //,fileFieldName:"upfile" //附件提交的表单名,若此处修改,需要在后台对应文件修改对应参数
19
+ //远程抓取配置区
20
+ //,catchRemoteImageEnable:true //是否开启远程图片抓取,默认开启
21
+ , catcherUrl: "" //处理远程图片抓取的地址
22
+ , catcherPath: "" //图片修正地址,同imagePath
23
+ //,catchFieldName:"upfile" //提交到后台远程图片uri合集,若此处修改,需要在后台对应文件修改对应参数
24
+ //,separater:'ue_separate_ue' //提交至后台的远程图片地址字符串分隔符
25
+ //,localDomain:[] //本地顶级域名,当开启远程图片抓取时,除此之外的所有其它域名下的图片都将被抓取到本地,默认不抓取127.0.0.1和localhost
26
+
27
+ //图片在线管理配置区
28
+ , imageManagerUrl: "" //图片在线管理的处理地址
29
+ , imageManagerPath: "" //图片修正地址,同imagePath
30
+
31
+ //屏幕截图配置区
32
+ , snapscreenHost: "" //屏幕截图的server端文件所在的网站地址或者ip,请不要加http://
33
+ , snapscreenServerUrl: "" //屏幕截图的server端保存程序,UEditor的范例代码为“URL +"server/upload/php/snapImgUp.php"”
34
+ , snapscreenPath: ""
35
+ //,snapscreenServerPort: 80 //屏幕截图的server端端口
36
+ //,snapscreenImgAlign: 'center' //截图的图片默认的排版方式
37
+
38
+ //word转存配置区
39
+ , wordImageUrl: "" //word转存提交地址
40
+ , wordImagePath: "" //
41
+ //,wordImageFieldName:"upfile" //word转存表单名若此处修改,需要在后台对应文件修改对应参数
42
+
43
+ //获取视频数据的地址
44
+ , getMovieUrl: "" //视频数据获取地址
45
+
46
+ //工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义
47
+ , toolbars: [
48
+ ['fullscreen', 'source', '|', 'undo', 'redo', '|',
49
+ 'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
50
+ 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
51
+ 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
52
+ 'directionalityltr', 'directionalityrtl', 'indent', '|',
53
+ 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
54
+ 'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
55
+ 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', 'map', 'gmap', 'insertframe', 'highlightcode', 'webapp', 'pagebreak', 'template', 'background', '|',
56
+ 'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|',
57
+ 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|',
58
+ 'print', 'preview', 'searchreplace', 'help']
59
+ ]
60
+ //当鼠标放在工具栏上时显示的tooltip提示,留空支持自动多语言配置,否则以配置值为准
61
+ , labelMap: {
62
+ 'anchor': '', 'undo': ''
63
+ }
64
+ //webAppKey
65
+ //百度应用的APIkey,每个站长必须首先去百度官网注册一个key后方能正常使用app功能
66
+ , webAppKey: ""
67
+
68
+
69
+ //语言配置项,默认是zh-cn。有需要的话也可以使用如下这样的方式来自动多语言切换,当然,前提条件是lang文件夹下存在对应的语言文件:
70
+ //lang值也可以通过自动获取 (navigator.language||navigator.browserLanguage ||navigator.userLanguage).toLowerCase()
71
+ //,lang:'zh-cn'
72
+
73
+ //,langPath:URL +"lang/"
74
+
75
+ //主题配置项,默认是default。有需要的话也可以使用如下这样的方式来自动多主题切换,当然,前提条件是themes文件夹下存在对应的主题文件:
76
+ //现有如下皮肤:default,modern,gorgeous
77
+ //,theme:'default'
78
+ //,themePath:URL +"themes/"
79
+
80
+ //若实例化编辑器的页面手动修改的domain,此处需要设置为true
81
+ //,customDomain:false
82
+
83
+ //针对getAllHtml方法,会在对应的head标签中增加该编码设置。
84
+ //,charset:"utf-8"
85
+
86
+ //常用配置项目
87
+ //,isShow : true //默认显示编辑器
88
+
89
+ , initialContent: '' //初始化编辑器的内容,也可以通过textarea/script给值,看官网例子
90
+
91
+ //,initialFrameWidth:1000 //初始化编辑器宽度,默认1000
92
+ //,initialFrameHeight:320 //初始化编辑器高度,默认320
93
+
94
+ //,autoClearinitialContent:true //是否自动清除编辑器初始内容,注意:如果focus属性设置为true,这个也为真,那么编辑器一上来就会触发导致初始化的内容看不到了
95
+
96
+ //,iframeCssUrl: URL + '/themes/iframe.css' //给编辑器内部引入一个css文件
97
+ //,textarea:'editorValue' // 提交表单时,服务器获取编辑器提交内容的所用的参数,多实例时可以给容器name属性,会将name给定的值最为每个实例的键值,不用每次实例化的时候都设置这个值
98
+ //,focus:true //初始化时,是否让编辑器获得焦点true或false
99
+
100
+ //,autoClearEmptyNode : true //getContent时,是否删除空的inlineElement节点(包括嵌套的情况)
101
+
102
+ //,fullscreen : false //是否开启初始化时即全屏,默认关闭
103
+
104
+ //,readonly : false /编辑器初始化结束后,编辑区域是否是只读的,默认是false
105
+
106
+ //,zIndex : 900 //编辑器层级的基数,默认是900
107
+
108
+ //,imagePopup:true //图片操作的浮层开关,默认打开
109
+
110
+ //,initialStyle:'body{font-size:18px}' //编辑器内部样式,可以用来改变字体等
111
+
112
+ //,emotionLocalization:false //是否开启表情本地化,默认关闭。若要开启请确保emotion文件夹下包含官网提供的images表情文件夹
113
+
114
+ //,pasteplain:false //是否纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
115
+
116
+ //,allHtmlEnabled:false //提交到后台的数据是否包含整个html字符串
117
+ //iframeUrlMap
118
+ //dialog内容的路径 ~会被替换成URL,垓属性一旦打开,将覆盖所有的dialog的默认路径
119
+ //,iframeUrlMap:{
120
+ // 'anchor':'~/dialogs/anchor/anchor.html',
121
+ // }
122
+ //insertorderedlist
123
+ //有序列表的下拉配置,值留空时支持多语言自动识别,若配置值,则以此值为准
124
+ // ,'insertorderedlist':{
125
+ // 'decimal' : '' , //'1,2,3...'
126
+ // 'lower-alpha' : '' , // 'a,b,c...'
127
+ // 'lower-roman' : '' , //'i,ii,iii...'
128
+ // 'upper-alpha' : '' , lang //'A,B,C'
129
+ // 'upper-roman' : '' //'I,II,III...'
130
+ // }
131
+ //insertunorderedlist
132
+ //无序列表的下拉配置,值留空时支持多语言自动识别,若配置值,则以此值为准
133
+ //,insertunorderedlist : {
134
+ // 'circle' : '', // '○ 小圆圈'
135
+ // 'disc' : '', // '● 小圆点'
136
+ // 'square' : '' //'■ 小方块'
137
+ //}
138
+
139
+ //customstyle
140
+ //自定义样式,不支持国际化,此处配置值即可最后显示值
141
+ //block的元素是依据设置段落的逻辑设置的,inline的元素依据BIU的逻辑设置
142
+ //尽量使用一些常用的标签
143
+ //参数说明
144
+ //tag 使用的标签名字
145
+ //label 显示的名字也是用来标识不同类型的标识符,注意这个值每个要不同,
146
+ //style 添加的样式
147
+ //每一个对象就是一个自定义的样式
148
+ //,'customstyle':[
149
+ // {tag:'h1', name:'tc', label:'', style:'border-bottom:#ccc 2px solid;padding:0 4px 0 0;text-align:center;margin:0 0 20px 0;'},
150
+ // {tag:'h1', name:'tl',label:'', style:'border-bottom:#ccc 2px solid;padding:0 4px 0 0;margin:0 0 10px 0;'},
151
+ // {tag:'span',name:'im', label:'', style:'font-style:italic;font-weight:bold'},
152
+ // {tag:'span',name:'hi', label:'', style:'font-style:italic;font-weight:bold;color:rgb(51, 153, 204)'}
153
+ // ]
154
+
155
+ //右键菜单的内容,可以参考plugins/contextmenu.js里边的默认菜单的例子,label留空支持国际化,否则以此配置为准
156
+ // ,contextMenu:[
157
+ // {
158
+ // label:'', //显示的名称
159
+ // cmdName:'selectall',//执行的command命令,当点击这个右键菜单时
160
+ // //exec可选,有了exec就会在点击时执行这个function,优先级高于cmdName
161
+ // exec:function () {
162
+ // //this是当前编辑器的实例
163
+ // //this.ui._dialogs['inserttableDialog'].open();
164
+ // }
165
+ // }
166
+ // ]
167
+ //wordCount
168
+ //,wordCount:1 //是否开启字数统计
169
+ //,maximumWords:10000 //允许的最大字符数
170
+ //字数统计提示,{#count}代表当前字数,{#leave}代表还可以输入多少字符数,留空支持多语言自动切换,否则按此配置显示
171
+ //,wordCountMsg:'' //当前已输入 {#count} 个字符,您还可以输入{#leave} 个字符
172
+ //超出字数限制提示 留空支持多语言自动切换,否则按此配置显示
173
+ //,wordOverFlowMsg:'' //<span style="color:red;">你输入的字符个数已经超出最大允许值,服务器可能会拒绝保存!</span>
174
+
175
+ //elementPathEnabled
176
+ //是否启用元素路径,默认是显示
177
+ //,elementPathEnabled : true
178
+ //removeFormat
179
+ //清除格式时可以删除的标签和属性
180
+ //removeForamtTags标签
181
+ //,removeFormatTags:'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var'
182
+ //removeFormatAttributes属性
183
+ //,removeFormatAttributes:'class,style,lang,width,height,align,hspace,valign'
184
+ //autoHeightEnabled
185
+ // 是否自动长高,默认true
186
+ //,autoHeightEnabled:true
187
+ //,minFrameWidth:800 //编辑器拖动时最小宽度,默认800
188
+ //,minFrameHeight:220 //编辑器拖动时最小高度,默认220
189
+ //autoFloatEnabled
190
+ //是否保持toolbar的位置不动,默认true
191
+ //,autoFloatEnabled:true
192
+ //浮动时工具栏距离浏览器顶部的高度,用于某些具有固定头部的页面
193
+ //,topOffset:30
194
+ //indentValue
195
+ //首行缩进距离,默认是2em
196
+ //,indentValue:'2em'
197
+
198
+ //autotypeset
199
+ // //自动排版参数
200
+ // ,autotypeset:{
201
+ // mergeEmptyline : true, //合并空行
202
+ // removeClass : true, //去掉冗余的class
203
+ // removeEmptyline : false, //去掉空行
204
+ // textAlign : "left" , //段落的排版方式,可以是 left,right,center,justify 去掉这个属性表示不执行排版
205
+ // imageBlockLine : 'center', //图片的浮动方式,独占一行剧中,左右浮动,默认: center,left,right,none 去掉这个属性表示不执行排版
206
+ // pasteFilter : false, //根据规则过滤没事粘贴进来的内容
207
+ // clearFontSize : false, //去掉所有的内嵌字号,使用编辑器默认的字号
208
+ // clearFontFamily : false, //去掉所有的内嵌字体,使用编辑器默认的字体
209
+ // removeEmptyNode : false , // 去掉空节点
210
+ // //可以去掉的标签
211
+ // removeTagNames : {标签名字:1},
212
+ // indent : false, // 行首缩进
213
+ // indentValue : '2em' //行首缩进的大小
214
+ // }
215
+
216
+ };
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :ueditor_rails do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,17 @@
1
+ module UeditorRails
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace UeditorRails
4
+
5
+ initializer "ueditor_rails.assets_precompile", :group => :all do |app|
6
+ app.config.assets.precompile += UeditorRails.assets
7
+ end
8
+
9
+ initializer "ueditor_rails.helpers" do
10
+ ActiveSupport.on_load :action_view do
11
+ ActionView::Base.send :include, UeditorRails::Helpers::ViewHelper
12
+ ActionView::Base.send :include, UeditorRails::Helpers::FormHelper
13
+ ActionView::Helpers::FormBuilder.send :include, UeditorRails::Helpers::FormBuilder
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ module UeditorRails
2
+ module Helpers
3
+ module FormBuilder
4
+ extend ActiveSupport::Concern
5
+
6
+ def ueditor_text(method, options = {})
7
+ @template.send('ueditor_text', @object_name, method, objectify_options(options))
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,37 @@
1
+ module UeditorRails
2
+ module Helpers
3
+ module FormHelper
4
+ extend ActiveSupport::Concern
5
+
6
+ include ActionView::Helpers::TagHelper
7
+ include ActionView::Helpers::JavaScriptHelper
8
+ include ActionView::Helpers::Tags
9
+
10
+ def ueditor_text(object_name, method = nil, options = {})
11
+ if defined?(ActionView::Base::InstanceTag)
12
+ instance_tag = ActionView::Base::InstanceTag.new(object_name, method, self, options.delete('object'))
13
+ else
14
+ instance_tag = ActionView::Helpers::Tags::TextArea.new(object_name, method, self, options)
15
+ end
16
+ # instance_tag = ActionView::Helpers::Tags::TextArea.new(object_name, method, self, options)
17
+ instance_tag.send(:add_default_name_and_id, options) if options[:id].blank?
18
+
19
+ element_id = options.delete('id')
20
+ ue_tag_attributes = {:type => 'text/plain', :id => element_id, :name => options.delete('name')}
21
+ options[:initialFrameWidth] = options.delete(:width) unless options[:width].blank?
22
+ options[:initialFrameHeight] = options.delete(:height) unless options[:height].blank?
23
+
24
+ output_buffer = ActiveSupport::SafeBuffer.new
25
+ #output_buffer << instance_tag.to_content_tag(:script, ue_tag_attributes)
26
+ if defined?(ActionView::Base::InstanceTag)
27
+ output_buffer << instance_tag.to_text_area_tag(ue_tag_attributes)
28
+ else
29
+ output_buffer << instance_tag.render
30
+ end
31
+ # output_buffer << instance_tag.to_text_area_tag(ue_tag_attributes)
32
+ output_buffer << javascript_tag {Util.js_replace(element_id, options.stringify_keys)}
33
+ output_buffer
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,21 @@
1
+ module UeditorRails
2
+ module Helpers
3
+ module ViewHelper
4
+ extend ActiveSupport::Concern
5
+
6
+ def ueditor_text_tag(name, content = nil, options = {})
7
+ element_id = sanitize_to_id(options.delete(:id) || name)
8
+ input_html = { :id => element_id, :name => name, :type => 'text/plain' }
9
+
10
+ options['initialFrameWidth'] = options.delete(:width) unless options[:width].blank?
11
+ options['initialFrameHeight'] = options.delete(:height) unless options[:height].blank?
12
+
13
+ output_buffer = ActiveSupport::SafeBuffer.new
14
+ #output_buffer << content_tag(:script, content, input_html.stringify_keys)
15
+ output_buffer << content_tag(:script, content, input_html.stringify_keys)
16
+ output_buffer << javascript_tag { Util.js_replace(element_id, options.stringify_keys) }
17
+ output_buffer
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+ require 'active_support/json/encoding'
3
+
4
+ module UeditorRails
5
+ module Util
6
+ class << self
7
+ ASSET_FORMAT = '*.{coffee,scss,sass,png,jpeg,jpg,gif,js,css,erb,swf,exe}'
8
+ NEED_TO_COMPILE_STYLESHEET_EXT = %w(.scss .sass .coffee .erb)
9
+
10
+ def js_replace(dom_id, options = nil)
11
+ js_options = (options && !options.keys.empty?)? ActiveSupport::JSON.encode(options) : '{}'
12
+ js = <<-JS
13
+ if(window.UEDITOR_FIELDS === undefined) {
14
+ window.UEDITOR_FIELDS = [];
15
+ }
16
+ window.UEDITOR_FIELDS.push({id: '#{dom_id}', opt: #{js_options}})
17
+ JS
18
+ js.html_safe
19
+ end
20
+
21
+ def precompile_assets
22
+ assets = []
23
+
24
+ %w(app vendor).each do |source|
25
+ %w(images javascripts stylesheets).each do |kind|
26
+ Dir[UeditorRails.root_path.join("#{source}/assets/#{kind}/**", ASSET_FORMAT)].each do |path|
27
+ next if File.basename(path)[0] == '_'
28
+
29
+ ext = File.extname(path)
30
+ path = path[0..-ext.length-1] if NEED_TO_COMPILE_STYLESHEET_EXT.include? ext
31
+
32
+ assets << Pathname.new(path).relative_path_from(UeditorRails.root_path.join("#{source}/assets/#{kind}"))
33
+ end
34
+ end
35
+ end
36
+
37
+ assets
38
+ end
39
+
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,3 @@
1
+ module UeditorRails
2
+ VERSION = '0.0.5'
3
+ end
@@ -0,0 +1,32 @@
1
+ require "ueditor_rails/engine"
2
+
3
+ module UeditorRails
4
+ autoload :Util, 'ueditor_rails/util'
5
+
6
+ module Helpers
7
+ autoload :ViewHelper, 'ueditor_rails/helpers/view_helper'
8
+ autoload :FormHelper, 'ueditor_rails/helpers/form_helper'
9
+ autoload :FormBuilder, 'ueditor_rails/helpers/form_builder'
10
+ end
11
+
12
+ mattr_accessor :enable_cross_domain
13
+
14
+ class<< self
15
+
16
+ def enable_cross_domain
17
+ @@enable_cross_domain ||= false
18
+ end
19
+
20
+ def root_path
21
+ @root_path ||= Pathname.new(File.dirname(File.expand_path('../', __FILE__)))
22
+ end
23
+
24
+ def assets
25
+ @assets ||= Util.precompile_assets
26
+ end
27
+
28
+ def ueditor_base_path
29
+ @ueditor_base_path ||= self.root_path.join('vendor/assets/javascripts/ueditor')
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,261 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application framework that includes everything needed to create
4
+ database-backed web applications according to the Model-View-Control pattern.
5
+
6
+ This pattern splits the view (also called the presentation) into "dumb"
7
+ templates that are primarily responsible for inserting pre-built data in between
8
+ HTML tags. The model contains the "smart" domain objects (such as Account,
9
+ Product, Person, Post) that holds all the business logic and knows how to
10
+ persist themselves to a database. The controller handles the incoming requests
11
+ (such as Save New Account, Update Product, Show Post) by manipulating the model
12
+ and directing data to the view.
13
+
14
+ In Rails, the model is handled by what's called an object-relational mapping
15
+ layer entitled Active Record. This layer allows you to present the data from
16
+ database rows as objects and embellish these data objects with business logic
17
+ methods. You can read more about Active Record in
18
+ link:files/vendor/rails/activerecord/README.html.
19
+
20
+ The controller and view are handled by the Action Pack, which handles both
21
+ layers by its two parts: Action View and Action Controller. These two layers
22
+ are bundled in a single package due to their heavy interdependence. This is
23
+ unlike the relationship between the Active Record and Action Pack that is much
24
+ more separate. Each of these packages can be used independently outside of
25
+ Rails. You can read more about Action Pack in
26
+ link:files/vendor/rails/actionpack/README.html.
27
+
28
+
29
+ == Getting Started
30
+
31
+ 1. At the command prompt, create a new Rails application:
32
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
+
34
+ 2. Change directory to <tt>myapp</tt> and start the web server:
35
+ <tt>cd myapp; rails server</tt> (run with --help for options)
36
+
37
+ 3. Go to http://localhost:3000/ and you'll see:
38
+ "Welcome aboard: You're riding Ruby on Rails!"
39
+
40
+ 4. Follow the guidelines to start developing your application. You can find
41
+ the following resources handy:
42
+
43
+ * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
+ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
+
46
+
47
+ == Debugging Rails
48
+
49
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
+ will help you debug it and get it back on the rails.
51
+
52
+ First area to check is the application log files. Have "tail -f" commands
53
+ running on the server.log and development.log. Rails will automatically display
54
+ debugging and runtime information to these files. Debugging info will also be
55
+ shown in the browser on requests from 127.0.0.1.
56
+
57
+ You can also log your own messages directly into the log file from your code
58
+ using the Ruby logger class from inside your controllers. Example:
59
+
60
+ class WeblogController < ActionController::Base
61
+ def destroy
62
+ @weblog = Weblog.find(params[:id])
63
+ @weblog.destroy
64
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
+ end
66
+ end
67
+
68
+ The result will be a message in your log file along the lines of:
69
+
70
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
+
72
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
73
+
74
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
+ several books available online as well:
76
+
77
+ * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
+
80
+ These two books will bring you up to speed on the Ruby language and also on
81
+ programming in general.
82
+
83
+
84
+ == Debugger
85
+
86
+ Debugger support is available through the debugger command when you start your
87
+ Mongrel or WEBrick server with --debugger. This means that you can break out of
88
+ execution at any point in the code, investigate and change the model, and then,
89
+ resume execution! You need to install ruby-debug to run the server in debugging
90
+ mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
+
92
+ class WeblogController < ActionController::Base
93
+ def index
94
+ @posts = Post.all
95
+ debugger
96
+ end
97
+ end
98
+
99
+ So the controller will accept the action, run the first line, then present you
100
+ with a IRB prompt in the server window. Here you can do things like:
101
+
102
+ >> @posts.inspect
103
+ => "[#<Post:0x14a6be8
104
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
+ #<Post:0x14a6620
106
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
+ >> @posts.first.title = "hello from a debugger"
108
+ => "hello from a debugger"
109
+
110
+ ...and even better, you can examine how your runtime objects actually work:
111
+
112
+ >> f = @posts.first
113
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
+ >> f.
115
+ Display all 152 possibilities? (y or n)
116
+
117
+ Finally, when you're ready to resume execution, you can enter "cont".
118
+
119
+
120
+ == Console
121
+
122
+ The console is a Ruby shell, which allows you to interact with your
123
+ application's domain model. Here you'll have all parts of the application
124
+ configured, just like it is when the application is running. You can inspect
125
+ domain models, change values, and save to the database. Starting the script
126
+ without arguments will launch it in the development environment.
127
+
128
+ To start the console, run <tt>rails console</tt> from the application
129
+ directory.
130
+
131
+ Options:
132
+
133
+ * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
+ made to the database.
135
+ * Passing an environment name as an argument will load the corresponding
136
+ environment. Example: <tt>rails console production</tt>.
137
+
138
+ To reload your controllers and models after launching the console run
139
+ <tt>reload!</tt>
140
+
141
+ More information about irb can be found at:
142
+ link:http://www.rubycentral.org/pickaxe/irb.html
143
+
144
+
145
+ == dbconsole
146
+
147
+ You can go to the command line of your database directly through <tt>rails
148
+ dbconsole</tt>. You would be connected to the database with the credentials
149
+ defined in database.yml. Starting the script without arguments will connect you
150
+ to the development database. Passing an argument will connect you to a different
151
+ database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
+ PostgreSQL and SQLite 3.
153
+
154
+ == Description of Contents
155
+
156
+ The default directory structure of a generated Ruby on Rails application:
157
+
158
+ |-- app
159
+ | |-- assets
160
+ | | |-- images
161
+ | | |-- javascripts
162
+ | | `-- stylesheets
163
+ | |-- controllers
164
+ | |-- helpers
165
+ | |-- mailers
166
+ | |-- models
167
+ | `-- views
168
+ | `-- layouts
169
+ |-- config
170
+ | |-- environments
171
+ | |-- initializers
172
+ | `-- locales
173
+ |-- db
174
+ |-- doc
175
+ |-- lib
176
+ | |-- assets
177
+ | `-- tasks
178
+ |-- log
179
+ |-- public
180
+ |-- script
181
+ |-- test
182
+ | |-- fixtures
183
+ | |-- functional
184
+ | |-- integration
185
+ | |-- performance
186
+ | `-- unit
187
+ |-- tmp
188
+ | `-- cache
189
+ | `-- assets
190
+ `-- vendor
191
+ |-- assets
192
+ | |-- javascripts
193
+ | `-- stylesheets
194
+ `-- plugins
195
+
196
+ app
197
+ Holds all the code that's specific to this particular application.
198
+
199
+ app/assets
200
+ Contains subdirectories for images, stylesheets, and JavaScript files.
201
+
202
+ app/controllers
203
+ Holds controllers that should be named like weblogs_controller.rb for
204
+ automated URL mapping. All controllers should descend from
205
+ ApplicationController which itself descends from ActionController::Base.
206
+
207
+ app/models
208
+ Holds models that should be named like post.rb. Models descend from
209
+ ActiveRecord::Base by default.
210
+
211
+ app/views
212
+ Holds the template files for the view that should be named like
213
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
214
+ eRuby syntax by default.
215
+
216
+ app/views/layouts
217
+ Holds the template files for layouts to be used with views. This models the
218
+ common header/footer method of wrapping views. In your views, define a layout
219
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
220
+ Inside default.html.erb, call <% yield %> to render the view using this
221
+ layout.
222
+
223
+ app/helpers
224
+ Holds view helpers that should be named like weblogs_helper.rb. These are
225
+ generated for you automatically when using generators for controllers.
226
+ Helpers can be used to wrap functionality for your views into methods.
227
+
228
+ config
229
+ Configuration files for the Rails environment, the routing map, the database,
230
+ and other dependencies.
231
+
232
+ db
233
+ Contains the database schema in schema.rb. db/migrate contains all the
234
+ sequence of Migrations for your schema.
235
+
236
+ doc
237
+ This directory is where your application documentation will be stored when
238
+ generated using <tt>rake doc:app</tt>
239
+
240
+ lib
241
+ Application specific libraries. Basically, any kind of custom code that
242
+ doesn't belong under controllers, models, or helpers. This directory is in
243
+ the load path.
244
+
245
+ public
246
+ The directory available for the web server. Also contains the dispatchers and the
247
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
+ server.
249
+
250
+ script
251
+ Helper scripts for automation and generation.
252
+
253
+ test
254
+ Unit and functional tests along with fixtures. When using the rails generate
255
+ command, template test files will be generated for you and placed in this
256
+ directory.
257
+
258
+ vendor
259
+ External libraries that the application depends on. Also includes the plugins
260
+ subdirectory. If the app has frozen rails, those gems also go here, under
261
+ vendor/rails/. This directory is in the load path.