glebtv-ckeditor 4.11.1 → 4.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (364) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +13 -12
  3. data/README.md +358 -2
  4. data/Rakefile +17 -8
  5. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/fileuploader.js +313 -317
  6. data/app/controllers/ckeditor/application_controller.rb +3 -0
  7. data/app/controllers/ckeditor/attachment_files_controller.rb +2 -2
  8. data/app/controllers/ckeditor/pictures_controller.rb +2 -2
  9. data/app/helpers/ckeditor/application_helper.rb +2 -0
  10. data/app/views/ckeditor/shared/_asset.html.erb +1 -3
  11. data/app/views/ckeditor/shared/_asset_tmpl.html.erb +0 -2
  12. data/config/locales/da.ckeditor.yml +9 -0
  13. data/config/routes.rb +2 -0
  14. data/lib/ckeditor.rb +13 -19
  15. data/lib/ckeditor/asset_response.rb +17 -10
  16. data/lib/ckeditor/backend/active_storage.rb +68 -0
  17. data/lib/ckeditor/backend/carrierwave.rb +2 -12
  18. data/lib/ckeditor/backend/dragonfly.rb +2 -0
  19. data/lib/ckeditor/backend/paperclip.rb +2 -15
  20. data/lib/ckeditor/backend/shrine.rb +29 -0
  21. data/lib/ckeditor/helpers/controllers.rb +2 -0
  22. data/lib/ckeditor/helpers/form_builder.rb +2 -0
  23. data/lib/ckeditor/helpers/form_helper.rb +2 -0
  24. data/lib/ckeditor/helpers/view_helper.rb +2 -0
  25. data/lib/ckeditor/hooks/cancan.rb +4 -1
  26. data/lib/ckeditor/hooks/formtastic.rb +2 -0
  27. data/lib/ckeditor/hooks/pundit.rb +2 -0
  28. data/lib/ckeditor/hooks/simple_form.rb +2 -0
  29. data/lib/ckeditor/http.rb +14 -9
  30. data/lib/ckeditor/orm/active_record.rb +2 -0
  31. data/lib/ckeditor/orm/base.rb +11 -2
  32. data/lib/ckeditor/orm/mongoid.rb +2 -0
  33. data/lib/ckeditor/paginatable.rb +2 -0
  34. data/lib/ckeditor/rails.rb +2 -0
  35. data/lib/ckeditor/rails_admin/field.rb +16 -3
  36. data/lib/ckeditor/text_area.rb +2 -0
  37. data/lib/ckeditor/utils.rb +3 -16
  38. data/lib/ckeditor/utils/javascript_code.rb +1 -1
  39. data/lib/ckeditor/version.rb +4 -2
  40. data/lib/generators/ckeditor/install_generator.rb +16 -19
  41. data/lib/generators/ckeditor/pundit_policy_generator.rb +2 -0
  42. data/lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/asset.rb +10 -0
  43. data/lib/generators/ckeditor/templates/active_record/{refile → active_storage}/ckeditor/attachment_file.rb +3 -1
  44. data/lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/picture.rb +13 -0
  45. data/lib/generators/ckeditor/templates/active_record/{carrierwave/migration_versioned.rb → active_storage/migration.rb} +8 -5
  46. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/asset.rb +2 -0
  47. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/attachment_file.rb +2 -0
  48. data/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/picture.rb +2 -0
  49. data/lib/generators/ckeditor/templates/active_record/carrierwave/migration.rb +7 -5
  50. data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/asset.rb +2 -0
  51. data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/attachment_file.rb +2 -0
  52. data/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/picture.rb +2 -0
  53. data/lib/generators/ckeditor/templates/active_record/dragonfly/migration.rb +7 -5
  54. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/asset.rb +2 -0
  55. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/attachment_file.rb +2 -0
  56. data/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/picture.rb +2 -0
  57. data/lib/generators/ckeditor/templates/active_record/paperclip/migration.rb +8 -6
  58. data/lib/generators/ckeditor/templates/active_record/{refile → shrine}/ckeditor/asset.rb +3 -1
  59. data/lib/generators/ckeditor/templates/active_record/shrine/ckeditor/attachment_file.rb +21 -0
  60. data/lib/generators/ckeditor/templates/active_record/shrine/ckeditor/picture.rb +49 -0
  61. data/lib/generators/ckeditor/templates/active_record/shrine/migration.rb +22 -0
  62. data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_attachment_file_uploader.rb +2 -1
  63. data/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_picture_uploader.rb +2 -3
  64. data/lib/generators/ckeditor/templates/base/dragonfly/initializer.rb +2 -0
  65. data/lib/generators/ckeditor/templates/base/shrine/initializer.rb +25 -0
  66. data/lib/generators/ckeditor/templates/ckeditor.rb +3 -6
  67. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/asset.rb +2 -0
  68. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/attachment_file.rb +2 -0
  69. data/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/picture.rb +2 -0
  70. data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/asset.rb +2 -0
  71. data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/attachment_file.rb +2 -0
  72. data/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/picture.rb +2 -0
  73. data/lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/asset.rb +8 -0
  74. data/lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/attachment_file.rb +21 -0
  75. data/lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/picture.rb +47 -0
  76. data/lib/generators/ckeditor/templates/pundit_policy/attachment_file_policy.rb +2 -0
  77. data/lib/generators/ckeditor/templates/pundit_policy/picture_policy.rb +2 -0
  78. data/lib/tasks/ckeditor.rake +2 -0
  79. data/test/controllers/attachment_files_controller_test.rb +17 -15
  80. data/test/controllers/pictures_controller_test.rb +17 -15
  81. data/test/dummy/Rakefile +2 -0
  82. data/test/dummy/app/assets/javascripts/application.js +0 -2
  83. data/test/dummy/app/controllers/application_controller.rb +2 -0
  84. data/test/dummy/app/controllers/posts_controller.rb +2 -0
  85. data/test/dummy/app/helpers/application_helper.rb +2 -0
  86. data/test/dummy/app/helpers/posts_helper.rb +2 -0
  87. data/test/dummy/app/models/post.rb +2 -0
  88. data/test/dummy/app/views/posts/index.html.erb +0 -3
  89. data/test/dummy/app/views/posts/show.html.erb +3 -0
  90. data/test/dummy/config.ru +2 -0
  91. data/test/dummy/config/application.rb +5 -1
  92. data/test/dummy/config/boot.rb +2 -0
  93. data/test/dummy/config/environment.rb +2 -0
  94. data/test/dummy/config/environments/development.rb +2 -0
  95. data/test/dummy/config/environments/production.rb +2 -0
  96. data/test/dummy/config/environments/test.rb +5 -3
  97. data/test/dummy/config/initializers/assets.rb +2 -0
  98. data/test/dummy/config/initializers/backtrace_silencers.rb +2 -0
  99. data/test/dummy/config/initializers/ckeditor.rb +2 -0
  100. data/test/dummy/config/initializers/cookies_serializer.rb +2 -0
  101. data/test/dummy/config/initializers/inflections.rb +2 -0
  102. data/test/dummy/config/initializers/mime_types.rb +2 -0
  103. data/test/dummy/config/initializers/paperclip.rb +2 -0
  104. data/test/dummy/config/initializers/session_store.rb +2 -0
  105. data/test/dummy/config/initializers/wrap_parameters.rb +2 -0
  106. data/test/dummy/config/routes.rb +2 -0
  107. data/test/dummy/config/storage.yml +3 -0
  108. data/test/dummy/db/migrate/20110623120047_create_posts.rb +5 -3
  109. data/test/dummy/db/migrate/20170806125915_create_active_storage_tables.rb +26 -0
  110. data/test/dummy/script/rails +2 -0
  111. data/test/functional/posts_controller_test.rb +18 -16
  112. data/test/generators/install_generator_test.rb +58 -56
  113. data/test/integration/navigation_test.rb +2 -0
  114. data/test/models/attachment_file_test.rb +4 -4
  115. data/test/models/ckeditor_test.rb +3 -21
  116. data/test/models/picture_test.rb +12 -10
  117. data/test/models/utils_test.rb +2 -0
  118. data/test/orm/active_record.rb +11 -1
  119. data/test/orm/mongoid.rb +2 -0
  120. data/test/support/helpers.rb +2 -0
  121. data/test/support/integration_case.rb +2 -0
  122. data/test/test_helper.rb +15 -9
  123. data/vendor/assets/javascripts/ckeditor/CHANGES.md +178 -2
  124. data/vendor/assets/javascripts/ckeditor/LICENSE.md +3 -2
  125. data/vendor/assets/javascripts/ckeditor/README.md +6 -6
  126. data/vendor/assets/javascripts/ckeditor/adapters/jquery.js +6 -6
  127. data/vendor/assets/javascripts/ckeditor/build-config.js +3 -4
  128. data/vendor/assets/javascripts/ckeditor/ckeditor.js +851 -816
  129. data/vendor/assets/javascripts/ckeditor/config.js +1 -1
  130. data/vendor/assets/javascripts/ckeditor/contents.css +1 -1
  131. data/vendor/assets/javascripts/ckeditor/lang/en.js +1 -1
  132. data/vendor/assets/javascripts/ckeditor/lang/ru.js +1 -1
  133. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +1 -1
  134. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +1 -1
  135. data/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +1 -1
  136. data/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +1 -1
  137. data/vendor/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +1 -1
  138. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -1
  139. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +4 -2
  140. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.search.min.js +1 -1
  141. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +1 -1
  142. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcodemixed.min.js +1 -1
  143. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.handlebars.min.js +1 -1
  144. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +2 -2
  145. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js +1 -1
  146. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js +3 -3
  147. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.twig.min.js +1 -1
  148. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +7 -3
  149. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/3024-day.css +41 -41
  150. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/3024-night.css +39 -39
  151. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/abcdef.css +32 -32
  152. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance-mobile.css +5 -5
  153. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance.css +74 -74
  154. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-dark.css +38 -38
  155. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-light.css +38 -38
  156. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/bespin.css +34 -34
  157. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/blackboard.css +32 -32
  158. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/cobalt.css +25 -25
  159. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/colorforth.css +33 -33
  160. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/darcula.css +51 -46
  161. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/dracula.css +40 -40
  162. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-dark.css +35 -35
  163. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-light.css +36 -36
  164. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/eclipse.css +23 -23
  165. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/elegant.css +13 -13
  166. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/erlang-dark.css +34 -34
  167. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/gruvbox-dark.css +37 -34
  168. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/hopscotch.css +34 -34
  169. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/icecoder.css +43 -43
  170. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/idea.css +41 -41
  171. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/isotope.css +34 -34
  172. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +47 -47
  173. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/liquibyte.css +95 -95
  174. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/lucario.css +37 -37
  175. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/material.css +53 -53
  176. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/mbo.css +37 -37
  177. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/mdn-like.css +46 -46
  178. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/midnight.css +43 -43
  179. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +41 -41
  180. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/neat.css +12 -12
  181. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/neo.css +43 -43
  182. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/night.css +27 -27
  183. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/nord.css +42 -0
  184. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/oceanic-next.css +44 -44
  185. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/panda-syntax.css +85 -85
  186. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/paraiso-dark.css +38 -38
  187. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/paraiso-light.css +38 -38
  188. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/pastel-on-dark.css +52 -52
  189. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/railscasts.css +34 -34
  190. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/rubyblue.css +25 -25
  191. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/seti.css +44 -44
  192. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/shadowfox.css +52 -52
  193. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +168 -168
  194. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ssms.css +16 -16
  195. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/the-matrix.css +30 -30
  196. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/tomorrow-night-bright.css +35 -35
  197. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/tomorrow-night-eighties.css +38 -38
  198. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/ttcn.css +64 -64
  199. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/twilight.css +32 -32
  200. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/vibrant-ink.css +34 -34
  201. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-dark.css +53 -53
  202. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-light.css +43 -43
  203. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/yeti.css +44 -44
  204. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/yonce.css +59 -0
  205. data/vendor/assets/javascripts/ckeditor/plugins/codemirror/theme/zenburn.css +37 -37
  206. data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.css +1 -1
  207. data/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +11 -11
  208. data/vendor/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +1 -1
  209. data/vendor/assets/javascripts/ckeditor/plugins/dialog/styles/dialog.css +18 -0
  210. data/vendor/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +9 -8
  211. data/vendor/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +4 -4
  212. data/vendor/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +16 -16
  213. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +5 -5
  214. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +3 -3
  215. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +2 -2
  216. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +4 -4
  217. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +2 -2
  218. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +16 -16
  219. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +6 -5
  220. data/vendor/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +8 -8
  221. data/vendor/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +8 -7
  222. data/vendor/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +13 -1
  223. data/vendor/assets/javascripts/ckeditor/plugins/image/lang/en.js +1 -1
  224. data/vendor/assets/javascripts/ckeditor/plugins/image/lang/ru.js +1 -1
  225. data/vendor/assets/javascripts/ckeditor/plugins/image/plugin.js +2 -2
  226. data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/contents.css +1 -1
  227. data/vendor/assets/javascripts/ckeditor/plugins/image2/dev/image2.html +2 -2
  228. data/vendor/assets/javascripts/ckeditor/plugins/image2/dialogs/image2.js +2 -2
  229. data/vendor/assets/javascripts/ckeditor/plugins/image2/lang/en.js +1 -1
  230. data/vendor/assets/javascripts/ckeditor/plugins/image2/lang/ru.js +1 -1
  231. data/vendor/assets/javascripts/ckeditor/plugins/image2/plugin.js +95 -32
  232. data/vendor/assets/javascripts/ckeditor/plugins/image2/samples/image2.html +3 -3
  233. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +4 -4
  234. data/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +25 -25
  235. data/vendor/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +7 -7
  236. data/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +40 -52
  237. data/vendor/assets/javascripts/ckeditor/plugins/pastetools/filter/common.js +19 -0
  238. data/vendor/assets/javascripts/ckeditor/plugins/scayt/README.md +63 -7
  239. data/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +32 -32
  240. data/vendor/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +1 -1
  241. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +1 -1
  242. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ru.js +1 -1
  243. data/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +1 -1
  244. data/vendor/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +19 -18
  245. data/vendor/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +15 -15
  246. data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +1 -1
  247. data/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +1 -1
  248. data/vendor/assets/javascripts/ckeditor/plugins/templates/templates/default.js +1 -1
  249. data/vendor/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +13 -7
  250. data/vendor/assets/javascripts/ckeditor/plugins/wsc/README.md +62 -7
  251. data/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +4 -4
  252. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor.css +1 -123
  253. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_gecko.css +1 -1
  254. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie.css +1 -1
  255. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie7.css +1 -1
  256. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_ie8.css +1 -1
  257. data/vendor/assets/javascripts/ckeditor/skins/minimalist/editor_iequirks.css +1 -1
  258. data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons.png +0 -0
  259. data/vendor/assets/javascripts/ckeditor/skins/minimalist/icons_hidpi.png +0 -0
  260. data/vendor/assets/javascripts/ckeditor/skins/minimalist/skin.js +10 -0
  261. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog.css +1 -1
  262. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie.css +1 -1
  263. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_ie8.css +1 -1
  264. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/dialog_iequirks.css +1 -1
  265. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor.css +2 -2
  266. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_gecko.css +2 -2
  267. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie.css +2 -2
  268. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_ie8.css +2 -2
  269. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/editor_iequirks.css +2 -2
  270. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/readme.md +1 -1
  271. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/skin.js +1 -1
  272. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog.css +1 -1
  273. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie.css +1 -1
  274. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie7.css +1 -1
  275. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_ie8.css +1 -1
  276. data/vendor/assets/javascripts/ckeditor/skins/moono/dialog_iequirks.css +1 -1
  277. data/vendor/assets/javascripts/ckeditor/skins/moono/editor.css +2 -2
  278. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_gecko.css +2 -2
  279. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie.css +2 -2
  280. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie7.css +2 -2
  281. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_ie8.css +2 -2
  282. data/vendor/assets/javascripts/ckeditor/skins/moono/editor_iequirks.css +2 -2
  283. data/vendor/assets/javascripts/ckeditor/skins/moono/readme.md +2 -2
  284. data/vendor/assets/javascripts/ckeditor/skins/moono/skin.js +1 -1
  285. data/vendor/assets/javascripts/ckeditor/styles.js +1 -1
  286. data/vendor/assets/javascripts/ckeditor/vendor/promise.js +13 -0
  287. metadata +65 -121
  288. data/lib/ckeditor/backend/refile.rb +0 -39
  289. data/lib/ckeditor/utils/content_type_detector.rb +0 -38
  290. data/lib/generators/ckeditor/templates/active_record/dragonfly/migration_versioned.rb +0 -23
  291. data/lib/generators/ckeditor/templates/active_record/paperclip/migration_versioned.rb +0 -23
  292. data/lib/generators/ckeditor/templates/active_record/refile/ckeditor/picture.rb +0 -11
  293. data/lib/generators/ckeditor/templates/active_record/refile/migration.rb +0 -23
  294. data/lib/generators/ckeditor/templates/active_record/refile/migration_versioned.rb +0 -23
  295. data/test/support/raw_post.rb +0 -9
  296. data/vendor/assets/javascripts/ckeditor/samples/css/samples.css +0 -1637
  297. data/vendor/assets/javascripts/ckeditor/samples/img/github-top.png +0 -0
  298. data/vendor/assets/javascripts/ckeditor/samples/img/header-bg.png +0 -0
  299. data/vendor/assets/javascripts/ckeditor/samples/img/header-separator.png +0 -0
  300. data/vendor/assets/javascripts/ckeditor/samples/img/logo.png +0 -0
  301. data/vendor/assets/javascripts/ckeditor/samples/img/logo.svg +0 -13
  302. data/vendor/assets/javascripts/ckeditor/samples/img/navigation-tip.png +0 -0
  303. data/vendor/assets/javascripts/ckeditor/samples/index.html +0 -128
  304. data/vendor/assets/javascripts/ckeditor/samples/js/sample.js +0 -53
  305. data/vendor/assets/javascripts/ckeditor/samples/js/sf.js +0 -17
  306. data/vendor/assets/javascripts/ckeditor/samples/old/ajax.html +0 -85
  307. data/vendor/assets/javascripts/ckeditor/samples/old/api.html +0 -210
  308. data/vendor/assets/javascripts/ckeditor/samples/old/appendto.html +0 -59
  309. data/vendor/assets/javascripts/ckeditor/samples/old/assets/inlineall/logo.png +0 -0
  310. data/vendor/assets/javascripts/ckeditor/samples/old/assets/outputxhtml/outputxhtml.css +0 -204
  311. data/vendor/assets/javascripts/ckeditor/samples/old/assets/posteddata.php +0 -59
  312. data/vendor/assets/javascripts/ckeditor/samples/old/assets/sample.jpg +0 -0
  313. data/vendor/assets/javascripts/ckeditor/samples/old/assets/uilanguages/languages.js +0 -7
  314. data/vendor/assets/javascripts/ckeditor/samples/old/datafiltering.html +0 -508
  315. data/vendor/assets/javascripts/ckeditor/samples/old/dialog/assets/my_dialog.js +0 -48
  316. data/vendor/assets/javascripts/ckeditor/samples/old/dialog/dialog.html +0 -190
  317. data/vendor/assets/javascripts/ckeditor/samples/old/divreplace.html +0 -144
  318. data/vendor/assets/javascripts/ckeditor/samples/old/enterkey/enterkey.html +0 -106
  319. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/outputforflash.fla +0 -0
  320. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/outputforflash.swf +0 -0
  321. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/assets/outputforflash/swfobject.js +0 -19
  322. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/outputforflash.html +0 -283
  323. data/vendor/assets/javascripts/ckeditor/samples/old/htmlwriter/outputhtml.html +0 -224
  324. data/vendor/assets/javascripts/ckeditor/samples/old/index.html +0 -134
  325. data/vendor/assets/javascripts/ckeditor/samples/old/inlineall.html +0 -314
  326. data/vendor/assets/javascripts/ckeditor/samples/old/inlinebycode.html +0 -124
  327. data/vendor/assets/javascripts/ckeditor/samples/old/inlinetextarea.html +0 -113
  328. data/vendor/assets/javascripts/ckeditor/samples/old/jquery.html +0 -103
  329. data/vendor/assets/javascripts/ckeditor/samples/old/magicline/magicline.html +0 -209
  330. data/vendor/assets/javascripts/ckeditor/samples/old/readonly.html +0 -76
  331. data/vendor/assets/javascripts/ckeditor/samples/old/replacebyclass.html +0 -60
  332. data/vendor/assets/javascripts/ckeditor/samples/old/replacebycode.html +0 -59
  333. data/vendor/assets/javascripts/ckeditor/samples/old/sample.css +0 -357
  334. data/vendor/assets/javascripts/ckeditor/samples/old/sample.js +0 -50
  335. data/vendor/assets/javascripts/ckeditor/samples/old/sample_posteddata.php +0 -16
  336. data/vendor/assets/javascripts/ckeditor/samples/old/stylesheetparser/assets/sample.css +0 -70
  337. data/vendor/assets/javascripts/ckeditor/samples/old/stylesheetparser/stylesheetparser.html +0 -85
  338. data/vendor/assets/javascripts/ckeditor/samples/old/tabindex.html +0 -78
  339. data/vendor/assets/javascripts/ckeditor/samples/old/toolbar/toolbar.html +0 -235
  340. data/vendor/assets/javascripts/ckeditor/samples/old/uicolor.html +0 -72
  341. data/vendor/assets/javascripts/ckeditor/samples/old/uilanguages.html +0 -122
  342. data/vendor/assets/javascripts/ckeditor/samples/old/wysiwygarea/fullpage.html +0 -80
  343. data/vendor/assets/javascripts/ckeditor/samples/old/xhtmlstyle.html +0 -234
  344. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/css/fontello.css +0 -55
  345. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/LICENSE.txt +0 -10
  346. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/config.json +0 -28
  347. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.eot +0 -0
  348. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.svg +0 -14
  349. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.ttf +0 -0
  350. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/font/fontello.woff +0 -0
  351. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/index.html +0 -446
  352. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/abstracttoolbarmodifier.js +0 -13
  353. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/fulltoolbareditor.js +0 -9
  354. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/toolbarmodifier.js +0 -33
  355. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/js/toolbartextmodifier.js +0 -14
  356. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/LICENSE +0 -19
  357. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css +0 -325
  358. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.js +0 -288
  359. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/javascript.js +0 -25
  360. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/neo.css +0 -36
  361. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.css +0 -38
  362. data/vendor/assets/javascripts/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.js +0 -16
  363. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/icons.png +0 -0
  364. data/vendor/assets/javascripts/ckeditor/skins/moono-lisa/icons_hidpi.png +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0603cf877f654ef3b6b8a03a9ab39000688a79e968340d4a0366dbc0e991062a
4
- data.tar.gz: cd8fd5bebce7098578a6f0d0c5acbb6bdc34be7d5e0da0261a1abf0dac76dd13
3
+ metadata.gz: 881f253d2e0e32b89e8e76a07418a2a4eddea2afc47f3d9d2fdceed0aa31beca
4
+ data.tar.gz: 1303bc2e529ea50c3373f22341036a6a7f7b1f06852bb3dbc42f5883e0716e58
5
5
  SHA512:
6
- metadata.gz: 2283617d51ccc0e7a93563980223917b2166a65f5e3976caadcf515f9a461b6a9cdc4cd0cfbc3571f316b76a1796216ddc8d44ceda9a396f5c703e48029fc189
7
- data.tar.gz: cc9fd7bdeb7229799b319e95416d5ad1896a4af07c6359ad7d8b0ccf63f21cedf3ed7b5d0349c999ad1366d5b24e05ece10200cbdb4989ae9f70a0fb9d07a974
6
+ metadata.gz: bd1e56487215d54355ec48449cc368e76a81611a638c13ab4a5bbf4930cafb6f53d110cd15a1625c1730a25376d7c38c432cf8187c46d97b1e4ea9cd180004e5
7
+ data.tar.gz: 1fb70e818b8e4b4e16a43ac25c47a38aaadb421aa4185034347ae14231ed91ff759d8924b000f0989ad92364ba5236cb8672c9e8603ed523e33789b6b8baf21a
data/Gemfile CHANGED
@@ -1,35 +1,36 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'http://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
- gem 'rails', '4.2.10'
7
+ gem 'rails', '5.2.2.1'
6
8
 
7
9
  platforms :ruby do
8
- gem 'sqlite3'
9
10
  gem 'sass'
10
-
11
- group :development do
12
- gem 'unicorn', '~> 4.0.1'
13
- end
11
+ gem 'sqlite3', '~> 1.3.6'
14
12
 
15
13
  group :development, :test do
16
- gem 'jquery-rails', '~> 4.0.4'
17
14
  gem 'capybara', '>= 0.4.0'
15
+ gem 'jquery-rails', '~> 4.3.3'
18
16
  gem 'mynyml-redgreen', '~> 0.7.1', require: 'redgreen'
17
+ gem 'rails-controller-testing'
19
18
  end
20
19
 
21
20
  group :active_record do
22
- gem 'paperclip'
23
21
  gem 'carrierwave'
24
22
  gem 'dragonfly'
25
23
  gem 'mini_magick'
26
- gem 'refile', require: 'refile/rails'
27
- gem 'refile-mini_magick'
24
+ gem 'paperclip', '~> 6.1.0'
28
25
  end
29
26
 
30
27
  group :mongoid do
31
- gem 'mongoid', '~> 5.0.0'
32
- gem 'mongoid-paperclip', require: 'mongoid_paperclip'
28
+ gem 'bson_ext'
33
29
  gem 'carrierwave-mongoid', require: 'carrierwave/mongoid'
30
+ gem 'mongoid', '~> 7.0.2'
31
+ gem 'mongoid-paperclip', require: 'mongoid_paperclip'
32
+ gem 'shrine'
33
+ gem 'shrine-mongoid'
34
+ gem 'image_processing'
34
35
  end
35
36
  end
data/README.md CHANGED
@@ -1,3 +1,359 @@
1
- # glebtv-ckeditor
1
+ # Ckeditor
2
2
 
3
- This is a fork https://github.com/galetahub/ckeditor preconfigured for our needs.
3
+ [![Build Status](https://semaphoreci.com/api/v1/igor-galeta/ckeditor/branches/master/shields_badge.svg)](https://semaphoreci.com/igor-galeta/ckeditor)
4
+ [![Code Climate](https://codeclimate.com/github/galetahub/ckeditor/badges/gpa.svg)](https://codeclimate.com/github/galetahub/ckeditor)
5
+
6
+ CKEditor is a WYSIWYG text editor designed to simplify web content creation. It brings common word processing features directly to your web pages. Enhance your website experience with our community maintained editor. Currently this gem supports [ckeditor 4](https://ckeditor.com/ckeditor-4/) only.
7
+
8
+ ## Features
9
+
10
+ * CKEditor version 4.x (https://ckeditor.com/ckeditor-4/)
11
+ * Rails 5.x, 4.2.x integration
12
+ * Files browser
13
+ * HTML5 file uploader
14
+ * Hooks for formtastic and simple_form forms generators
15
+ * Integrated with authorization frameworks [CanCanCan](https://github.com/CanCanCommunity/cancancan) and [Pundit](https://github.com/varvet/pundit)
16
+
17
+ ## Installation
18
+
19
+ For basic usage just include the ckeditor gem:
20
+
21
+ ```
22
+ gem 'ckeditor'
23
+ ```
24
+
25
+ or if you'd like to use the latest version from Github:
26
+
27
+ ```
28
+ gem 'ckeditor', github: 'galetahub/ckeditor'
29
+ ```
30
+
31
+ The last version works with Rails 3.2.x is 4.1.3
32
+
33
+ ```ruby
34
+ gem 'ckeditor', '4.1.3'
35
+ ```
36
+
37
+ Include this inside your `config/initializers/assets.rb`:
38
+
39
+ ```
40
+ Rails.application.config.assets.precompile += %w[ckeditor/config.js]
41
+ ```
42
+
43
+ For file upload support, you must generate the necessary file storage models.
44
+ The currently supported backends are:
45
+
46
+ * ActiveRecord (paperclip, carrierwave, dragonfly)
47
+ * Mongoid (paperclip, carrierwave, dragonfly)
48
+
49
+ ### How to generate models to store uploaded files
50
+
51
+ #### ActiveRecord + paperclip
52
+
53
+ To use the active_record orm with paperclip (i.e. the default settings):
54
+
55
+ ```
56
+ gem 'paperclip'
57
+
58
+ rails generate ckeditor:install --orm=active_record --backend=paperclip
59
+ ```
60
+
61
+ #### ActiveRecord + active_storage
62
+
63
+ ```
64
+ gem "mini_magick"
65
+
66
+ rails active_storage:install # if you not install active_storage yet
67
+ rails generate ckeditor:install --orm=active_record --backend=active_storage
68
+ ```
69
+
70
+ #### ActiveRecord + carrierwave
71
+
72
+ ```
73
+ gem 'carrierwave'
74
+ gem 'mini_magick'
75
+
76
+ rails generate ckeditor:install --orm=active_record --backend=carrierwave
77
+ ```
78
+
79
+ #### ActiveRecord + dragonfly
80
+
81
+ Requires Dragonfly 1.0 or greater.
82
+
83
+ ```
84
+ gem 'dragonfly'
85
+
86
+ rails generate ckeditor:install --orm=active_record --backend=dragonfly
87
+ ```
88
+
89
+ #### Mongoid + paperclip
90
+
91
+ ```
92
+ gem 'mongoid-paperclip', require: 'mongoid_paperclip'
93
+
94
+ rails generate ckeditor:install --orm=mongoid --backend=paperclip
95
+ ```
96
+
97
+ #### Mongoid + active_storage
98
+
99
+ Active Storage support **only** Active Record, see for [more info](https://github.com/rails/rails/issues/31408#issuecomment-351128111)
100
+
101
+ #### Mongoid + carrierwave
102
+
103
+ ```
104
+ gem 'carrierwave-mongoid', require: 'carrierwave/mongoid'
105
+ gem 'mini_magick'
106
+
107
+ rails generate ckeditor:install --orm=mongoid --backend=carrierwave
108
+ ```
109
+
110
+ #### Load generated models
111
+
112
+ All ckeditor models will be generated in the app/models/ckeditor directory.
113
+ Models are autoloaded in Rails 4. For earlier Rails versions, you need to add them to the autoload path (in application.rb):
114
+
115
+ ```ruby
116
+ config.autoload_paths += %w(#{config.root}/app/models/ckeditor)
117
+ ```
118
+
119
+ Mount the Ckeditor::Engine in your routes (config/routes.rb):
120
+
121
+ ```ruby
122
+ mount Ckeditor::Engine => '/ckeditor'
123
+ ```
124
+
125
+ ## Usage
126
+
127
+ ### Load editor via CKEditor CDN
128
+
129
+ Setup editor version to load (more info here http://cdn.ckeditor.com/)
130
+
131
+ ```ruby
132
+ # in config/initializers/ckeditor.rb
133
+
134
+ Ckeditor.setup do |config|
135
+ # //cdn.ckeditor.com/<version.number>/<distribution>/ckeditor.js
136
+ config.cdn_url = "//cdn.ckeditor.com/4.6.1/basic/ckeditor.js"
137
+ end
138
+ ```
139
+
140
+ In view template include ckeditor CDN:
141
+
142
+ ```slim
143
+ = javascript_include_tag Ckeditor.cdn_url
144
+ ```
145
+
146
+ Precompile ckeditor/config.js:
147
+
148
+ ```ruby
149
+ # in config/initializers/assets.rb
150
+
151
+ Rails.application.config.assets.precompile += %w[ckeditor/config.js]
152
+ ```
153
+
154
+ ### Form helpers
155
+
156
+ ```slim
157
+ = form_for @page do |form|
158
+ = form.cktext_area :notes, class: 'someclass', ckeditor: { language: 'uk'}
159
+ = form.cktext_area :content, value: 'Default value', id: 'sometext'
160
+ = cktext_area :page, :info, cols: 40, ckeditor: { uiColor: '#AADC6E', toolbar: 'mini' }
161
+ ```
162
+
163
+ *It also works with bootstrap-form*
164
+
165
+ ```slim
166
+ = bootstrap_form_for resource do |form|
167
+ = form.cktext_area :text, ckeditor: { language: 'uk'}
168
+ ```
169
+
170
+ ### Customize ckeditor
171
+
172
+ All ckeditor options can be found [here](http://docs.ckeditor.com/#!/api/CKEDITOR.config)
173
+
174
+ In order to configure the ckeditor default options, create the following files:
175
+
176
+ ```
177
+ app/assets/javascripts/ckeditor/config.js
178
+
179
+ app/assets/javascripts/ckeditor/contents.css
180
+ ```
181
+
182
+ #### Custom toolbars example
183
+
184
+ Adding a custom toolbar:
185
+
186
+ ```javascript
187
+ # in app/assets/javascripts/ckeditor/config.js
188
+
189
+ CKEDITOR.editorConfig = function (config) {
190
+ // ... other configuration ...
191
+
192
+ config.toolbar_mini = [
193
+ ["Bold", "Italic", "Underline", "Strike", "-", "Subscript", "Superscript"],
194
+ ];
195
+ config.toolbar = "mini";
196
+
197
+ // ... rest of the original config.js ...
198
+ }
199
+ ```
200
+
201
+ When overriding the default `config.js` file, you must set all configuration options yourself as the bundled `config.js` will not be loaded. To see the default configuration, run `bundle open ckeditor`, copy `app/assets/javascripts/ckeditor/config.js` into your project and customize it to your needs.
202
+
203
+ #### Install additional plugins
204
+
205
+ You should download necessary plugins with all dependencies and extract them in `app/assets/javascripts/ckeditor/plugins/`.
206
+ After that you can include your plugins in `app/assets/javascripts/ckeditor/config.js` in this way:
207
+
208
+ ```javascript
209
+ CKEDITOR.editorConfig = function (config) {
210
+ config.extraPlugins = 'eqneditor,autosave,';
211
+ }
212
+ ```
213
+
214
+ ### AJAX
215
+
216
+ jQuery sample:
217
+
218
+ ```html
219
+ <script type='text/javascript' charset='UTF-8'>
220
+ $(document).ready(function(){
221
+ $('form[data-remote]').bind('ajax:before', function(){
222
+ for (instance in CKEDITOR.instances){
223
+ CKEDITOR.instances[instance].updateElement();
224
+ }
225
+ });
226
+ });
227
+ </script>
228
+ ```
229
+
230
+ ### Formtastic integration
231
+
232
+ ```slim
233
+ = form.input :content, as: :ckeditor
234
+ = form.input :content, as: :ckeditor, input_html: { ckeditor: { height: 400 } }
235
+ ```
236
+
237
+ ### SimpleForm integration
238
+ Note that the toolbar option should match the case specified in the config. If the config is not found it defaults to all available toolbar items.
239
+
240
+ i.e. config.toolbar_mini becomes {toolbar: 'mini'} in the form.
241
+
242
+ ```slim
243
+ = form.input :content, as: :ckeditor, input_html: { ckeditor: { toolbar: 'Full' } }
244
+ ```
245
+
246
+ ### Turbolink integration
247
+ Create a file app/assets/javascripts/init_ckeditor.coffee
248
+
249
+ ```coffee
250
+ ready = ->
251
+ $('.ckeditor').each ->
252
+ CKEDITOR.replace $(this).attr('id')
253
+
254
+ $(document).ready(ready)
255
+ $(document).on('page:load', ready)
256
+ ```
257
+ Make sure the file is loaded from your app/assets/javascripts/application.js
258
+
259
+ ### CanCanCan integration
260
+
261
+ To use cancan with Ckeditor, add this to an initializer:
262
+
263
+ ```ruby
264
+ # in config/initializers/ckeditor.rb
265
+
266
+ Ckeditor.setup do |config|
267
+ config.authorize_with :cancancan
268
+ end
269
+ ```
270
+
271
+ At this point, all authorization will fail and no one will be able to access the filebrowser pages.
272
+ To grant access, add the following abilities (usually `ability.rb`)
273
+
274
+ ```ruby
275
+ # Always performed
276
+ can :access, :ckeditor # needed to access Ckeditor filebrowser
277
+
278
+ # Performed checks for actions:
279
+ can [:read, :create, :destroy], Ckeditor::Picture
280
+ can [:read, :create, :destroy], Ckeditor::AttachmentFile
281
+ ```
282
+
283
+ ### Pundit integration
284
+
285
+ Just like CanCanCan, you can write this code in your config/initializers/ckeditor.rb file:
286
+
287
+ ```ruby
288
+ Ckeditor.setup do |config|
289
+ config.authorize_with :pundit
290
+ end
291
+ ```
292
+
293
+ Then, generate the policy files for model **Picture** and **AttachmentFile**
294
+
295
+ ```
296
+ $ rails g ckeditor:pundit_policy
297
+ ```
298
+ By this command, you will got two files:
299
+ > app/policies/ckeditor/picture_policy.rb
300
+ app/policies/ckeditor/attachment_file_policy.rb
301
+
302
+ By default, only the user that logged in can access the models (with actions *index* and *create*) and only the owner of the asset can **destroy** the resource.
303
+
304
+ You can customize these two policy files as you like.
305
+
306
+ ## Engine configuration
307
+
308
+ * To override the default CKEditor routes create a [config.js](https://github.com/galetahub/ckeditor/blob/master/app/assets/javascripts/ckeditor/config.js) file within the host application at `app/assets/javascripts/ckeditor/config.js`
309
+
310
+ * By default, the engine inherits from `ApplicationController`. To override the default parent controller:
311
+ ```
312
+ # in config/initializers/ckeditor.rb
313
+
314
+ Ckeditor.setup do |config|
315
+ config.parent_controller = 'MyCKEditorBaseController'
316
+ end
317
+ ```
318
+
319
+ Based on this, if you want to secure CKEditor controller actions and you can't authenticate in ApplicationController, you could do so with a custom controller after configuring the override above, like so:
320
+
321
+ ```
322
+ class MyCKEditorBaseController < ActionController::Base
323
+
324
+ before_action :authenticate_user! # or some other auth/permission logic here, like Pundit
325
+
326
+ end
327
+ ```
328
+
329
+ ## I18n
330
+
331
+ ```yml
332
+ en:
333
+ ckeditor:
334
+ page_title: 'CKEditor Files Manager'
335
+ confirm_delete: 'Delete file?'
336
+ buttons:
337
+ cancel: 'Cancel'
338
+ upload: 'Upload'
339
+ delete: 'Delete'
340
+ next: 'Next'
341
+ ```
342
+
343
+ ## Tests
344
+
345
+ ```bash
346
+ $> rake test CKEDITOR_BACKEND=paperclip
347
+ $> rake test CKEDITOR_BACKEND=active_storage
348
+ $> rake test CKEDITOR_BACKEND=carrierwave
349
+ $> rake test CKEDITOR_BACKEND=dragonfly
350
+ $> rake test CKEDITOR_BACKEND=shrine
351
+ $> rake test CKEDITOR_ORM=mongoid
352
+
353
+ $> rake test:controllers
354
+ $> rake test:generators
355
+ $> rake test:integration
356
+ $> rake test:models
357
+ ```
358
+
359
+ This project rocks and uses the MIT-LICENSE.
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
+
2
3
  require 'rubygems'
3
4
  begin
4
5
  require 'bundler/setup'
@@ -7,49 +8,57 @@ rescue LoadError
7
8
  end
8
9
 
9
10
  require 'rake'
10
- require 'bundler/gem_tasks'
11
11
  require 'rake/testtask'
12
12
 
13
+ require 'bundler/gem_tasks'
14
+
15
+ task default: :test
16
+
13
17
  Rake::TestTask.new(:test) do |t|
14
18
  t.libs << 'lib'
15
19
  t.libs << 'test'
16
20
  t.pattern = 'test/**/*_test.rb'
17
21
  t.verbose = false
22
+ t.warning = false
18
23
  end
19
24
 
20
- Rake::TestTask.new("test:controllers") do |t|
25
+ Rake::TestTask.new('test:controllers') do |t|
21
26
  t.libs << 'lib'
22
27
  t.libs << 'test'
23
28
  t.pattern = 'test/controllers/*_test.rb'
24
29
  t.verbose = false
30
+ t.warning = false
25
31
  end
26
32
 
27
- Rake::TestTask.new("test:generators") do |t|
33
+ Rake::TestTask.new('test:generators') do |t|
28
34
  t.libs << 'lib'
29
35
  t.libs << 'test'
30
36
  t.pattern = 'test/generators/*_test.rb'
31
37
  t.verbose = false
38
+ t.warning = false
32
39
  end
33
40
 
34
- Rake::TestTask.new("test:integration") do |t|
41
+ Rake::TestTask.new('test:integration') do |t|
35
42
  t.libs << 'lib'
36
43
  t.libs << 'test'
37
44
  t.pattern = 'test/integration/*_test.rb'
38
45
  t.verbose = false
46
+ t.warning = false
39
47
  end
40
48
 
41
- Rake::TestTask.new("test:models") do |t|
49
+ Rake::TestTask.new('test:models') do |t|
42
50
  t.libs << 'lib'
43
51
  t.libs << 'test'
44
52
  t.pattern = 'test/models/*_test.rb'
45
53
  t.verbose = false
54
+ t.warning = false
46
55
  end
47
56
 
48
- Rake::TestTask.new("test:functional") do |t|
57
+ Rake::TestTask.new('test:functional') do |t|
49
58
  t.libs << 'lib'
50
59
  t.libs << 'test'
51
60
  t.pattern = 'test/functional/*_test.rb'
52
61
  t.verbose = false
62
+ t.warning = false
53
63
  end
54
64
 
55
- task :default => :test