refinerycms-core 2.1.5 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (449) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/refinery/add.png +0 -0
  3. data/app/assets/images/refinery/admin_bg.png +0 -0
  4. data/app/assets/images/refinery/ajax-loader.gif +0 -0
  5. data/app/assets/images/refinery/branch-end.gif +0 -0
  6. data/app/assets/images/refinery/branch.gif +0 -0
  7. data/app/assets/images/refinery/cross.png +0 -0
  8. data/app/assets/images/refinery/dialogLoadingAnimation.gif +0 -0
  9. data/app/assets/images/refinery/header_background.png +0 -0
  10. data/app/assets/images/refinery/hover-gradient.jpg +0 -0
  11. data/app/assets/images/refinery/icons/accept.png +0 -0
  12. data/app/assets/images/refinery/icons/add.png +0 -0
  13. data/app/assets/images/refinery/icons/ajax-loader.gif +0 -0
  14. data/app/assets/images/refinery/icons/application_edit.png +0 -0
  15. data/app/assets/images/refinery/icons/application_go.png +0 -0
  16. data/app/assets/images/refinery/icons/arrow_left.png +0 -0
  17. data/app/assets/images/refinery/icons/arrow_left_right.png +0 -0
  18. data/app/assets/images/refinery/icons/arrow_switch.png +0 -0
  19. data/app/assets/images/refinery/icons/arrow_up.png +0 -0
  20. data/app/assets/images/refinery/icons/arrow_up_down.png +0 -0
  21. data/app/assets/images/refinery/icons/bin.png +0 -0
  22. data/app/assets/images/refinery/icons/bin_closed.png +0 -0
  23. data/app/assets/images/refinery/icons/cancel.png +0 -0
  24. data/app/assets/images/refinery/icons/cog_add.png +0 -0
  25. data/app/assets/images/refinery/icons/cog_edit.png +0 -0
  26. data/app/assets/images/refinery/icons/cross.png +0 -0
  27. data/app/assets/images/refinery/icons/delete.png +0 -0
  28. data/app/assets/images/refinery/icons/doc.png +0 -0
  29. data/app/assets/images/refinery/icons/down.gif +0 -0
  30. data/app/assets/images/refinery/icons/edit.png +0 -0
  31. data/app/assets/images/refinery/icons/email.png +0 -0
  32. data/app/assets/images/refinery/icons/email_edit.png +0 -0
  33. data/app/assets/images/refinery/icons/email_go.png +0 -0
  34. data/app/assets/images/refinery/icons/email_open.png +0 -0
  35. data/app/assets/images/refinery/icons/eye.png +0 -0
  36. data/app/assets/images/refinery/icons/folder.png +0 -0
  37. data/app/assets/images/refinery/icons/folder_open.png +0 -0
  38. data/app/assets/images/refinery/icons/folder_page_white.png +0 -0
  39. data/app/assets/images/refinery/icons/image_add.png +0 -0
  40. data/app/assets/images/refinery/icons/image_edit.png +0 -0
  41. data/app/assets/images/refinery/icons/img.png +0 -0
  42. data/app/assets/images/refinery/icons/information.png +0 -0
  43. data/app/assets/images/refinery/icons/layout_add.png +0 -0
  44. data/app/assets/images/refinery/icons/layout_edit.png +0 -0
  45. data/app/assets/images/refinery/icons/locale-blue.svg +15 -0
  46. data/app/assets/images/refinery/icons/locale.svg +11 -0
  47. data/app/assets/images/refinery/icons/music.png +0 -0
  48. data/app/assets/images/refinery/icons/page.png +0 -0
  49. data/app/assets/images/refinery/icons/page_add.png +0 -0
  50. data/app/assets/images/refinery/icons/page_edit.png +0 -0
  51. data/app/assets/images/refinery/icons/page_white_edit.png +0 -0
  52. data/app/assets/images/refinery/icons/page_white_gear.png +0 -0
  53. data/app/assets/images/refinery/icons/page_white_put.png +0 -0
  54. data/app/assets/images/refinery/icons/pdf.png +0 -0
  55. data/app/assets/images/refinery/icons/ppt.png +0 -0
  56. data/app/assets/images/refinery/icons/star.png +0 -0
  57. data/app/assets/images/refinery/icons/tick.png +0 -0
  58. data/app/assets/images/refinery/icons/up.gif +0 -0
  59. data/app/assets/images/refinery/icons/user_add.png +0 -0
  60. data/app/assets/images/refinery/icons/user_comment.png +0 -0
  61. data/app/assets/images/refinery/icons/user_edit.png +0 -0
  62. data/app/assets/images/refinery/icons/xls.png +0 -0
  63. data/app/assets/images/refinery/icons/zip.png +0 -0
  64. data/app/assets/images/refinery/icons/zoom.png +0 -0
  65. data/app/assets/images/refinery/logo-large.png +0 -0
  66. data/app/assets/images/refinery/logo-medium.png +0 -0
  67. data/app/assets/images/refinery/logo-site-bar.png +0 -0
  68. data/app/assets/images/refinery/logo-small-medium.png +0 -0
  69. data/app/assets/images/refinery/logo-small.png +0 -0
  70. data/app/assets/images/refinery/logo-tiny.png +0 -0
  71. data/app/assets/images/refinery/logo.png +0 -0
  72. data/app/assets/images/refinery/nav-3-background.gif +0 -0
  73. data/app/assets/images/refinery/nav_inactive_background.png +0 -0
  74. data/app/assets/images/refinery/orange_button.png +0 -0
  75. data/app/assets/images/refinery/page_bg.png +0 -0
  76. data/app/assets/images/refinery/text_field_background.png +0 -0
  77. data/app/assets/images/refinery/tooltip-nib.gif +0 -0
  78. data/app/assets/images/refinery/tooltip-nib.png +0 -0
  79. data/app/assets/javascripts/admin.js +7 -6
  80. data/app/assets/javascripts/refinery/admin.js.erb +99 -60
  81. data/app/assets/javascripts/refinery/ajaxy_pagination.js.coffee +2 -5
  82. data/app/assets/javascripts/refinery/application.js +8 -0
  83. data/app/assets/javascripts/refinery/core.js +4 -18
  84. data/app/assets/javascripts/refinery/interface.js.coffee.erb +5 -29
  85. data/app/assets/javascripts/refinery/modal_dialogs.js.erb +0 -105
  86. data/app/assets/javascripts/refinery/nestedsortables.js +183 -110
  87. data/app/assets/javascripts/refinery/refinery.js.erb +3 -9
  88. data/app/assets/javascripts/refinery/serializelist.js +1 -1
  89. data/app/assets/javascripts/refinery/site_bar.js +0 -5
  90. data/app/assets/javascripts/refinery/sortable_list.js +10 -11
  91. data/app/assets/javascripts/refinery/submit_continue.js.coffee.erb +1 -1
  92. data/app/assets/stylesheets/application.scss +2 -0
  93. data/app/assets/stylesheets/refinery/_colours.scss +18 -0
  94. data/app/assets/stylesheets/refinery/_icons.scss +85 -0
  95. data/app/assets/stylesheets/refinery/{layout.css.scss → _layout.scss} +306 -338
  96. data/app/assets/stylesheets/refinery/_mixins.scss +84 -0
  97. data/app/assets/stylesheets/refinery/{submenu.css.scss → _submenu.scss} +2 -2
  98. data/app/assets/stylesheets/refinery/{tooltips.css.scss → _tooltips.scss} +0 -0
  99. data/app/assets/stylesheets/refinery/_ui.scss +252 -0
  100. data/app/assets/stylesheets/refinery/{formatting.css.scss → formatting.scss} +0 -0
  101. data/app/assets/stylesheets/refinery/refinery.scss +10 -0
  102. data/app/assets/stylesheets/refinery/site_bar.scss +126 -0
  103. data/app/assets/stylesheets/refinery/{theme.css.scss → theme.scss} +0 -0
  104. data/app/controllers/refinery/admin/core_controller.rb +2 -7
  105. data/app/controllers/refinery/admin/dialogs_controller.rb +4 -3
  106. data/app/controllers/refinery/admin_controller.rb +0 -1
  107. data/app/controllers/refinery/fast_controller.rb +0 -4
  108. data/app/helpers/refinery/admin/visual_editor_helper.rb +13 -0
  109. data/app/helpers/refinery/admin_helper.rb +4 -0
  110. data/app/helpers/refinery/custom_assets_helper.rb +2 -2
  111. data/app/helpers/refinery/image_helper.rb +9 -8
  112. data/app/helpers/refinery/meta_helper.rb +1 -1
  113. data/app/helpers/refinery/site_bar_helper.rb +16 -2
  114. data/app/helpers/refinery/tag_helper.rb +38 -5
  115. data/app/models/refinery/core/base_model.rb +3 -1
  116. data/app/views/layouts/refinery/admin.html.erb +12 -10
  117. data/app/views/layouts/refinery/admin_dialog.html.erb +1 -4
  118. data/app/views/refinery/_content_page.html.erb +1 -1
  119. data/app/views/refinery/_google_analytics.html.erb +8 -9
  120. data/app/views/refinery/_head.html.erb +1 -1
  121. data/app/views/refinery/_javascripts.html.erb +0 -15
  122. data/app/views/refinery/_message.html.erb +1 -1
  123. data/app/views/refinery/_site_bar.html.erb +9 -6
  124. data/app/views/refinery/admin/_error_messages.html.erb +4 -4
  125. data/app/views/refinery/admin/_form_actions.html.erb +1 -0
  126. data/app/views/refinery/admin/_form_advanced_options_menu.html.erb +3 -4
  127. data/app/views/refinery/admin/_head.html.erb +3 -0
  128. data/app/views/refinery/admin/_image_picker.html.erb +4 -5
  129. data/app/views/refinery/admin/_javascripts.html.erb +4 -9
  130. data/app/views/refinery/admin/_locale_picker.html.erb +9 -2
  131. data/app/views/refinery/admin/_make_sortable.html.erb +8 -6
  132. data/app/views/refinery/admin/_menu.html.erb +2 -15
  133. data/app/views/refinery/admin/_menu_item.html.erb +3 -0
  134. data/app/views/refinery/admin/_resource_picker.html.erb +12 -22
  135. data/app/views/refinery/admin/_search.html.erb +1 -1
  136. data/app/views/refinery/admin/_tabbed_fields.html.erb +2 -2
  137. data/app/views/refinery/admin/_wysiwyg.html.erb +1 -1
  138. data/{lib/generators/refinery/cms/templates/app/decorators/controllers/refinery/.gitkeep → app/views/refinery/admin/dialog_success.html.erb} +0 -0
  139. data/app/views/refinery/admin/dialogs/show.html.erb +1 -19
  140. data/config/initializers/assets.rb +6 -0
  141. data/config/locales/ca.yml +84 -0
  142. data/config/locales/cs.yml +12 -5
  143. data/config/locales/en.yml +6 -2
  144. data/config/locales/fr.yml +15 -11
  145. data/config/locales/hu.yml +3 -1
  146. data/config/locales/it.yml +5 -1
  147. data/config/locales/ja.yml +2 -2
  148. data/config/locales/pt.yml +5 -3
  149. data/config/locales/ru.yml +7 -0
  150. data/config/locales/sl.yml +0 -3
  151. data/config/locales/tr.yml +43 -41
  152. data/config/routes.rb +1 -4
  153. data/lib/generators/refinery/cms/cms_generator.rb +68 -26
  154. data/lib/generators/refinery/cms/templates/app/decorators/{models/refinery/.gitkeep → controllers/refinery/.keep} +0 -0
  155. data/lib/generators/refinery/{form/templates/.gitkeep → cms/templates/app/decorators/models/refinery/.keep} +0 -0
  156. data/lib/generators/refinery/cms/templates/config/database.yml.mysql +3 -3
  157. data/lib/generators/refinery/cms/templates/config/database.yml.postgresql +3 -3
  158. data/lib/generators/refinery/core/templates/config/initializers/refinery/core.rb.erb +18 -5
  159. data/lib/generators/refinery/dummy/dummy_generator.rb +3 -1
  160. data/lib/generators/refinery/dummy/templates/rails/application.js +3 -0
  161. data/lib/generators/refinery/dummy/templates/rails/application.rb.erb +0 -2
  162. data/lib/generators/refinery/dummy/templates/rails/blank.png +0 -0
  163. data/lib/generators/refinery/dummy/templates/rails/routes.rb +1 -1
  164. data/lib/generators/refinery/engine/engine_generator.rb +3 -2
  165. data/lib/generators/refinery/engine/templates/Gemfile +9 -4
  166. data/lib/generators/refinery/engine/templates/Rakefile +3 -4
  167. data/lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb +11 -2
  168. data/lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb +2 -2
  169. data/lib/generators/refinery/engine/templates/app/models/refinery/namespace/singular_name.rb.erb +5 -5
  170. data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_actions.html.erb +7 -12
  171. data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_form.html.erb +8 -8
  172. data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_records.html.erb +3 -3
  173. data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_singular_name.html.erb +6 -11
  174. data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/index.html.erb +1 -1
  175. data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/plural_name/show.html.erb +4 -4
  176. data/lib/generators/refinery/engine/templates/db/migrate/1_create_namespace_plural_name.rb.erb +2 -9
  177. data/lib/generators/refinery/engine/templates/db/seeds.rb.erb +13 -19
  178. data/lib/generators/refinery/engine/templates/lib/refinery/plural_name/engine.rb.erb +0 -4
  179. data/lib/generators/refinery/engine/templates/readme.md +3 -3
  180. data/lib/generators/refinery/engine/templates/refinerycms-extension_plural_name.gemspec +1 -0
  181. data/lib/generators/refinery/engine/templates/spec/features/refinery/namespace/admin/plural_name_spec.rb.erb +25 -28
  182. data/lib/generators/refinery/engine/templates/spec/models/refinery/namespace/singular_name_spec.rb.erb +1 -1
  183. data/lib/generators/refinery/engine/templates/spec/spec_helper.rb +1 -1
  184. data/lib/refinery.rb +7 -9
  185. data/lib/refinery/admin/base_controller.rb +42 -32
  186. data/lib/refinery/application_controller.rb +25 -17
  187. data/lib/refinery/cli.rb +54 -19
  188. data/lib/refinery/core.rb +5 -0
  189. data/lib/refinery/core/authorisation_adapter.rb +11 -0
  190. data/lib/refinery/core/authorisation_manager.rb +14 -0
  191. data/lib/refinery/core/configuration.rb +25 -4
  192. data/lib/refinery/core/default_route.rb +16 -0
  193. data/lib/refinery/core/engine.rb +44 -25
  194. data/lib/refinery/core/nil_user.rb +42 -0
  195. data/lib/refinery/crud.rb +40 -29
  196. data/lib/refinery/extension_generation.rb +11 -22
  197. data/lib/refinery/generators/generated_attribute.rb +54 -0
  198. data/lib/refinery/generators/named_base.rb +16 -0
  199. data/lib/refinery/menu.rb +3 -2
  200. data/lib/refinery/menu_item.rb +1 -1
  201. data/lib/refinery/plugin.rb +27 -43
  202. data/lib/refinery/plugins.rb +22 -26
  203. data/lib/refinery/users_manager.rb +8 -0
  204. data/lib/refinery/version.rb +7 -3
  205. data/lib/tasks/refinery.rake +7 -0
  206. data/license.md +1 -1
  207. data/refinerycms-core.gemspec +11 -8
  208. data/spec/controllers/refinery/admin/dummy_controller_spec.rb +23 -11
  209. data/spec/controllers/refinery/sitemap_controller_spec.rb +2 -2
  210. data/spec/features/refinery/admin/custom_assets_spec.rb +12 -10
  211. data/spec/features/refinery/admin/dialogs_spec.rb +5 -5
  212. data/spec/features/refinery/admin/xhr_paging_spec.rb +24 -38
  213. data/spec/features/refinery/application_layout_spec.rb +3 -3
  214. data/spec/features/refinery/core_spec.rb +1 -1
  215. data/spec/features/refinery/site_bar_spec.rb +44 -23
  216. data/spec/helpers/refinery/admin_helper_spec.rb +15 -0
  217. data/spec/helpers/refinery/custom_assets_helper_spec.rb +15 -23
  218. data/spec/helpers/refinery/html_truncation_helper_spec.rb +10 -5
  219. data/spec/helpers/refinery/meta_helper_spec.rb +3 -3
  220. data/spec/helpers/refinery/pagination_helper_spec.rb +7 -7
  221. data/spec/helpers/refinery/tag_helper_spec.rb +4 -4
  222. data/spec/helpers/refinery/translation_helper_spec.rb +3 -3
  223. data/spec/lib/generators/refinery/cms/cms_generator_spec.rb +30 -25
  224. data/spec/lib/generators/refinery/core/core_generator_spec.rb +1 -1
  225. data/spec/lib/generators/refinery/engine/engine_generator_multiple_resources_spec.rb +7 -8
  226. data/spec/lib/generators/refinery/engine/engine_generator_sanity_check_spec.rb +15 -15
  227. data/spec/lib/generators/refinery/engine/engine_generator_spec.rb +9 -9
  228. data/spec/lib/generators/refinery/engine/engine_generator_with_i18n_spec.rb +1 -1
  229. data/spec/lib/generators/refinery/engine/engine_generator_without_frontend_spec.rb +1 -1
  230. data/spec/lib/refinery/application_controller_spec.rb +16 -16
  231. data/spec/lib/refinery/authorisation_manager_spec.rb +10 -0
  232. data/spec/lib/refinery/cli_spec.rb +83 -21
  233. data/spec/lib/refinery/core/configuration_spec.rb +5 -5
  234. data/spec/lib/refinery/core/nil_user_spec.rb +39 -0
  235. data/spec/lib/refinery/core_spec.rb +39 -30
  236. data/spec/lib/refinery/crud_spec.rb +70 -59
  237. data/spec/lib/refinery/menu_spec.rb +4 -4
  238. data/spec/lib/refinery/plugin_spec.rb +56 -45
  239. data/spec/lib/refinery/plugins_spec.rb +39 -87
  240. data/spec/lib/refinery/users_manager_spec.rb +9 -0
  241. data/spec/support/refinery.rb +3 -8
  242. data/vendor/assets/fonts/font-awesome/FontAwesome.otf +0 -0
  243. data/vendor/assets/fonts/font-awesome/fontawesome-webfont.eot +0 -0
  244. data/vendor/assets/fonts/font-awesome/fontawesome-webfont.svg +565 -0
  245. data/vendor/assets/fonts/font-awesome/fontawesome-webfont.ttf +0 -0
  246. data/vendor/assets/fonts/font-awesome/fontawesome-webfont.woff +0 -0
  247. data/vendor/assets/fonts/font-awesome/fontawesome-webfont.woff2 +0 -0
  248. data/vendor/assets/stylesheets/_font-awesome-compass.scss +5 -0
  249. data/vendor/assets/stylesheets/_font-awesome-sprockets.scss +5 -0
  250. data/vendor/assets/stylesheets/_font-awesome.scss +17 -0
  251. data/vendor/assets/stylesheets/font-awesome/_animated.scss +34 -0
  252. data/vendor/assets/stylesheets/font-awesome/_bordered-pulled.scss +16 -0
  253. data/vendor/assets/stylesheets/font-awesome/_core.scss +12 -0
  254. data/vendor/assets/stylesheets/font-awesome/_extras.scss +44 -0
  255. data/vendor/assets/stylesheets/font-awesome/_fixed-width.scss +6 -0
  256. data/vendor/assets/stylesheets/font-awesome/_icons.scss +596 -0
  257. data/vendor/assets/stylesheets/font-awesome/_larger.scss +13 -0
  258. data/vendor/assets/stylesheets/font-awesome/_list.scss +19 -0
  259. data/vendor/assets/stylesheets/font-awesome/_mixins.scss +26 -0
  260. data/vendor/assets/stylesheets/font-awesome/_path.scss +14 -0
  261. data/vendor/assets/stylesheets/font-awesome/_rotated-flipped.scss +20 -0
  262. data/vendor/assets/stylesheets/font-awesome/_stacked.scss +20 -0
  263. data/vendor/assets/stylesheets/font-awesome/_variables.scss +606 -0
  264. metadata +144 -441
  265. data/app/assets/images/refinery/carousel-left.png +0 -0
  266. data/app/assets/images/refinery/carousel-right.png +0 -0
  267. data/app/assets/images/wymeditor/skins/refinery/arrow_redo.png +0 -0
  268. data/app/assets/images/wymeditor/skins/refinery/arrow_undo.png +0 -0
  269. data/app/assets/images/wymeditor/skins/refinery/eye.png +0 -0
  270. data/app/assets/images/wymeditor/skins/refinery/html5/article.png +0 -0
  271. data/app/assets/images/wymeditor/skins/refinery/html5/aside.png +0 -0
  272. data/app/assets/images/wymeditor/skins/refinery/html5/blockquote.png +0 -0
  273. data/app/assets/images/wymeditor/skins/refinery/html5/command.png +0 -0
  274. data/app/assets/images/wymeditor/skins/refinery/html5/details.png +0 -0
  275. data/app/assets/images/wymeditor/skins/refinery/html5/figcaption.png +0 -0
  276. data/app/assets/images/wymeditor/skins/refinery/html5/figure.png +0 -0
  277. data/app/assets/images/wymeditor/skins/refinery/html5/footer.png +0 -0
  278. data/app/assets/images/wymeditor/skins/refinery/html5/h1.png +0 -0
  279. data/app/assets/images/wymeditor/skins/refinery/html5/h2.png +0 -0
  280. data/app/assets/images/wymeditor/skins/refinery/html5/h3.png +0 -0
  281. data/app/assets/images/wymeditor/skins/refinery/html5/h4.png +0 -0
  282. data/app/assets/images/wymeditor/skins/refinery/html5/h5.png +0 -0
  283. data/app/assets/images/wymeditor/skins/refinery/html5/h6.png +0 -0
  284. data/app/assets/images/wymeditor/skins/refinery/html5/header.png +0 -0
  285. data/app/assets/images/wymeditor/skins/refinery/html5/hgroup.png +0 -0
  286. data/app/assets/images/wymeditor/skins/refinery/html5/mark.png +0 -0
  287. data/app/assets/images/wymeditor/skins/refinery/html5/meter.png +0 -0
  288. data/app/assets/images/wymeditor/skins/refinery/html5/nav.png +0 -0
  289. data/app/assets/images/wymeditor/skins/refinery/html5/p.png +0 -0
  290. data/app/assets/images/wymeditor/skins/refinery/html5/pre.png +0 -0
  291. data/app/assets/images/wymeditor/skins/refinery/html5/progress.png +0 -0
  292. data/app/assets/images/wymeditor/skins/refinery/html5/readme.md +0 -1
  293. data/app/assets/images/wymeditor/skins/refinery/html5/rp.png +0 -0
  294. data/app/assets/images/wymeditor/skins/refinery/html5/rt.png +0 -0
  295. data/app/assets/images/wymeditor/skins/refinery/html5/ruby.png +0 -0
  296. data/app/assets/images/wymeditor/skins/refinery/html5/section.png +0 -0
  297. data/app/assets/images/wymeditor/skins/refinery/html5/summary.png +0 -0
  298. data/app/assets/images/wymeditor/skins/refinery/html5/time.png +0 -0
  299. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-blockquote.png +0 -0
  300. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h1.png +0 -0
  301. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h2.png +0 -0
  302. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h3.png +0 -0
  303. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h4.png +0 -0
  304. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h5.png +0 -0
  305. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h6.png +0 -0
  306. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-p.png +0 -0
  307. data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-pre.png +0 -0
  308. data/app/assets/images/wymeditor/skins/refinery/link_add.png +0 -0
  309. data/app/assets/images/wymeditor/skins/refinery/link_break.png +0 -0
  310. data/app/assets/images/wymeditor/skins/refinery/page_code.png +0 -0
  311. data/app/assets/images/wymeditor/skins/refinery/page_paste.png +0 -0
  312. data/app/assets/images/wymeditor/skins/refinery/photo_add.png +0 -0
  313. data/app/assets/images/wymeditor/skins/refinery/right.png +0 -0
  314. data/app/assets/images/wymeditor/skins/refinery/style.png +0 -0
  315. data/app/assets/images/wymeditor/skins/refinery/table_add.png +0 -0
  316. data/app/assets/images/wymeditor/skins/refinery/text_align_center.png +0 -0
  317. data/app/assets/images/wymeditor/skins/refinery/text_align_justify.png +0 -0
  318. data/app/assets/images/wymeditor/skins/refinery/text_align_left.png +0 -0
  319. data/app/assets/images/wymeditor/skins/refinery/text_align_right.png +0 -0
  320. data/app/assets/images/wymeditor/skins/refinery/text_bold.png +0 -0
  321. data/app/assets/images/wymeditor/skins/refinery/text_heading_1.png +0 -0
  322. data/app/assets/images/wymeditor/skins/refinery/text_heading_2.png +0 -0
  323. data/app/assets/images/wymeditor/skins/refinery/text_heading_3.png +0 -0
  324. data/app/assets/images/wymeditor/skins/refinery/text_heading_4.png +0 -0
  325. data/app/assets/images/wymeditor/skins/refinery/text_heading_5.png +0 -0
  326. data/app/assets/images/wymeditor/skins/refinery/text_heading_6.png +0 -0
  327. data/app/assets/images/wymeditor/skins/refinery/text_indent.png +0 -0
  328. data/app/assets/images/wymeditor/skins/refinery/text_indent_remove.png +0 -0
  329. data/app/assets/images/wymeditor/skins/refinery/text_italic.png +0 -0
  330. data/app/assets/images/wymeditor/skins/refinery/text_list_bullets.png +0 -0
  331. data/app/assets/images/wymeditor/skins/refinery/text_list_numbers.png +0 -0
  332. data/app/assets/images/wymeditor/skins/refinery/text_paragraph.png +0 -0
  333. data/app/assets/images/wymeditor/skins/refinery/text_strikethrough.png +0 -0
  334. data/app/assets/images/wymeditor/skins/refinery/text_subscript.png +0 -0
  335. data/app/assets/images/wymeditor/skins/refinery/text_superscript.png +0 -0
  336. data/app/assets/images/wymeditor/skins/refinery/text_underline.png +0 -0
  337. data/app/assets/images/wymeditor/skins/wymeditor_icon.png +0 -0
  338. data/app/assets/javascripts/refinery/boot_wym.js.erb +0 -285
  339. data/app/assets/javascripts/refinery/sortable_menu.js.coffee.erb +0 -20
  340. data/app/assets/javascripts/refinery/wymeditor.js +0 -37
  341. data/app/assets/javascripts/wymeditor/GPL-license.txt +0 -278
  342. data/app/assets/javascripts/wymeditor/MIT-license.txt +0 -20
  343. data/app/assets/javascripts/wymeditor/README +0 -35
  344. data/app/assets/javascripts/wymeditor/browsers/ie.js.erb +0 -224
  345. data/app/assets/javascripts/wymeditor/browsers/mozilla.js.erb +0 -292
  346. data/app/assets/javascripts/wymeditor/browsers/opera.js.erb +0 -123
  347. data/app/assets/javascripts/wymeditor/browsers/webkit.js.erb +0 -283
  348. data/app/assets/javascripts/wymeditor/classes.js.erb +0 -1575
  349. data/app/assets/javascripts/wymeditor/functions.js.erb +0 -222
  350. data/app/assets/javascripts/wymeditor/lang/bg.js +0 -57
  351. data/app/assets/javascripts/wymeditor/lang/ca.js +0 -45
  352. data/app/assets/javascripts/wymeditor/lang/cs.js +0 -58
  353. data/app/assets/javascripts/wymeditor/lang/da.js +0 -48
  354. data/app/assets/javascripts/wymeditor/lang/de.js +0 -45
  355. data/app/assets/javascripts/wymeditor/lang/en.js +0 -57
  356. data/app/assets/javascripts/wymeditor/lang/es.js +0 -58
  357. data/app/assets/javascripts/wymeditor/lang/fa.js +0 -46
  358. data/app/assets/javascripts/wymeditor/lang/fi.js +0 -57
  359. data/app/assets/javascripts/wymeditor/lang/fr.js +0 -58
  360. data/app/assets/javascripts/wymeditor/lang/he.js +0 -45
  361. data/app/assets/javascripts/wymeditor/lang/hu.js +0 -45
  362. data/app/assets/javascripts/wymeditor/lang/it.js +0 -48
  363. data/app/assets/javascripts/wymeditor/lang/ja.js +0 -47
  364. data/app/assets/javascripts/wymeditor/lang/lv.js +0 -47
  365. data/app/assets/javascripts/wymeditor/lang/nb.js +0 -48
  366. data/app/assets/javascripts/wymeditor/lang/nl.js +0 -57
  367. data/app/assets/javascripts/wymeditor/lang/nn.js +0 -45
  368. data/app/assets/javascripts/wymeditor/lang/pl.js +0 -56
  369. data/app/assets/javascripts/wymeditor/lang/pt-BR.js +0 -58
  370. data/app/assets/javascripts/wymeditor/lang/pt.js +0 -45
  371. data/app/assets/javascripts/wymeditor/lang/rs.js +0 -47
  372. data/app/assets/javascripts/wymeditor/lang/ru.js +0 -57
  373. data/app/assets/javascripts/wymeditor/lang/sk.js +0 -56
  374. data/app/assets/javascripts/wymeditor/lang/sl.js +0 -47
  375. data/app/assets/javascripts/wymeditor/lang/sv.js +0 -45
  376. data/app/assets/javascripts/wymeditor/lang/tr.js +0 -45
  377. data/app/assets/javascripts/wymeditor/lang/vi.js +0 -47
  378. data/app/assets/javascripts/wymeditor/lang/zh-CN.js +0 -47
  379. data/app/assets/javascripts/wymeditor/prototypes.js.erb +0 -1103
  380. data/app/assets/javascripts/wymeditor/setup.js.erb +0 -622
  381. data/app/assets/javascripts/wymeditor/skins/refinery/skin.js +0 -45
  382. data/app/assets/javascripts/wymeditor/validators.js.erb +0 -777
  383. data/app/assets/stylesheets/refinery/refinery.css +0 -15
  384. data/app/assets/stylesheets/refinery/site_bar.css.scss +0 -92
  385. data/app/assets/stylesheets/refinery/ui.css.scss +0 -103
  386. data/app/assets/stylesheets/wymeditor/skins/refinery/skin.css.scss +0 -530
  387. data/app/assets/stylesheets/wymeditor/skins/refinery/wymiframe.css.scss +0 -156
  388. data/app/helpers/refinery/admin/core_helper.rb +0 -6
  389. data/app/helpers/refinery/admin/dialogs_helper.rb +0 -6
  390. data/app/helpers/refinery/fast_helper.rb +0 -4
  391. data/app/helpers/refinery/sitemap_helper.rb +0 -4
  392. data/app/views/refinery/wymiframe.html.erb +0 -14
  393. data/lib/generators/refinery/form/USAGE +0 -20
  394. data/lib/generators/refinery/form/form_generator.rb +0 -25
  395. data/lib/generators/refinery/form/templates/.gitignore +0 -2
  396. data/lib/generators/refinery/form/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb +0 -54
  397. data/lib/generators/refinery/form/templates/app/controllers/refinery/namespace/admin/settings_controller.rb.erb +0 -45
  398. data/lib/generators/refinery/form/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb +0 -53
  399. data/lib/generators/refinery/form/templates/app/mailers/refinery/namespace/mailer.rb.erb +0 -22
  400. data/lib/generators/refinery/form/templates/app/models/refinery/namespace/setting.rb.erb +0 -34
  401. data/lib/generators/refinery/form/templates/app/models/refinery/namespace/singular_name.rb.erb +0 -49
  402. data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/_records.html.erb +0 -23
  403. data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/_singular_name.html.erb +0 -25
  404. data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/_submenu.html.erb +0 -29
  405. data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/index.html.erb +0 -4
  406. data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/show.html.erb +0 -52
  407. data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/spam.html.erb +0 -27
  408. data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/settings/_confirmation_email_form.html.erb +0 -51
  409. data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/settings/_notification_recipients_form.html.erb +0 -21
  410. data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/settings/edit.html.erb +0 -5
  411. data/lib/generators/refinery/form/templates/app/views/refinery/namespace/mailer/confirmation.html.erb +0 -1
  412. data/lib/generators/refinery/form/templates/app/views/refinery/namespace/mailer/notification.html.erb +0 -17
  413. data/lib/generators/refinery/form/templates/app/views/refinery/namespace/plural_name/new.html.erb +0 -43
  414. data/lib/generators/refinery/form/templates/app/views/refinery/namespace/plural_name/thank_you.html.erb +0 -1
  415. data/lib/generators/refinery/form/templates/config/locales/cs.yml +0 -78
  416. data/lib/generators/refinery/form/templates/config/locales/da.yml +0 -66
  417. data/lib/generators/refinery/form/templates/config/locales/de.yml +0 -78
  418. data/lib/generators/refinery/form/templates/config/locales/en.yml +0 -78
  419. data/lib/generators/refinery/form/templates/config/locales/es.yml +0 -66
  420. data/lib/generators/refinery/form/templates/config/locales/fr.yml +0 -78
  421. data/lib/generators/refinery/form/templates/config/locales/it.yml +0 -66
  422. data/lib/generators/refinery/form/templates/config/locales/lv.yml +0 -77
  423. data/lib/generators/refinery/form/templates/config/locales/nb.yml +0 -75
  424. data/lib/generators/refinery/form/templates/config/locales/nl.yml +0 -78
  425. data/lib/generators/refinery/form/templates/config/locales/pt-BR.yml +0 -78
  426. data/lib/generators/refinery/form/templates/config/locales/ru.yml +0 -77
  427. data/lib/generators/refinery/form/templates/config/locales/sk.yml +0 -78
  428. data/lib/generators/refinery/form/templates/config/locales/sl.yml +0 -67
  429. data/lib/generators/refinery/form/templates/config/locales/tr.yml +0 -78
  430. data/lib/generators/refinery/form/templates/config/locales/zh-CN.yml +0 -78
  431. data/lib/generators/refinery/form/templates/config/routes.rb.erb +0 -26
  432. data/lib/generators/refinery/form/templates/db/migrate/1_create_plural_name.rb.erb +0 -39
  433. data/lib/generators/refinery/form/templates/db/seeds.rb.erb +0 -31
  434. data/lib/generators/refinery/form/templates/lib/generators/refinery/plural_name_generator.rb.erb +0 -20
  435. data/lib/generators/refinery/form/templates/lib/refinery/plural_name.rb.erb +0 -18
  436. data/lib/generators/refinery/form/templates/lib/refinery/plural_name/engine.rb.erb +0 -27
  437. data/lib/generators/refinery/form/templates/lib/refinerycms-plural_name.rb.erb +0 -1
  438. data/lib/generators/refinery/form/templates/refinerycms-plural_name.gemspec +0 -16
  439. data/lib/generators/refinery/form/templates/script/rails +0 -10
  440. data/lib/refinery/activity.rb +0 -113
  441. data/lib/refinery/ext/action_view/helpers/form_builder.rb +0 -9
  442. data/lib/refinery/ext/action_view/helpers/form_helper.rb +0 -20
  443. data/lib/refinery/ext/action_view/helpers/form_tag_helper.rb +0 -10
  444. data/spec/controllers/refinery/admin/refinery_core_controller_spec.rb +0 -19
  445. data/spec/controllers/refinery/fast_controller_spec.rb +0 -12
  446. data/spec/lib/generators/refinery/form/form_generator_spec.rb +0 -99
  447. data/spec/lib/refinery/activity_spec.rb +0 -46
  448. data/spec/support/background_selenium_firefox_driver.rb +0 -14
  449. data/vendor/assets/javascripts/jquery/jquery.jcarousel.js +0 -900
data/lib/refinery/cli.rb CHANGED
@@ -6,8 +6,8 @@ module Refinery
6
6
 
7
7
  no_tasks do
8
8
  def source_paths
9
- Refinery::Plugins.registered.pathnames.map{|p|
10
- %w(app vendor).map{|dir| p.join(dir, @override_kind[:dir])}
9
+ Refinery::Plugins.registered.pathnames.map{ |p|
10
+ %w(app vendor).map{ |dir| p.join(dir, @override_kind[:dir])}
11
11
  }.flatten.uniq
12
12
  end
13
13
  end
@@ -44,7 +44,7 @@ module Refinery
44
44
  :desc => 'javascript',
45
45
  },
46
46
  :stylesheet => {
47
- :glob => '*.css{,.scss}',
47
+ :glob => '*.{s,}css',
48
48
  :dir => 'assets/stylesheets',
49
49
  :desc => 'stylesheet',
50
50
  },
@@ -58,20 +58,24 @@ module Refinery
58
58
  end
59
59
  end
60
60
 
61
- puts "You didn't specify anything valid to override. Here are some examples:"
62
- {
63
- :view => ['pages/home', 'refinery/pages/home', '**/*menu', '_menu_branch'],
64
- :javascript => %w(admin refinery/site_bar wymeditor**/{**/}*),
65
- :stylesheet => %w(home refinery/site_bar),
66
- :controller => %w(pages),
67
- :model => %w(page refinery/page),
68
- :helper => %w(site_bar refinery/site_bar_helper),
69
- :presenter => %w(refinery/page_presenter)
70
- }.each do |type, examples|
71
- examples.each do |example|
72
- puts "rake refinery:override #{type}=#{example}"
61
+ handle_invalid_override_input
62
+ end
63
+
64
+ desc "override_list", "lists files that you can override from any Refinery extension that you are using into your application"
65
+ def override_list(env)
66
+ OVERRIDES.keys.each do |kind|
67
+ which = env[kind.to_s] || (kind if env['type'] == kind.to_s)
68
+ if which.present? && @override_kind = OVERRIDES[kind]
69
+ matcher = [
70
+ "{refinery#{File::SEPARATOR},}", (which.presence || "**/*"), @override_kind[:glob]
71
+ ].flatten.join
72
+
73
+ puts find_relative_matches(matcher).sort.join("\n")
74
+ return
73
75
  end
74
76
  end
77
+
78
+ handle_invalid_override_list_input
75
79
  end
76
80
 
77
81
  desc "uncrudify", "shows you the code that your controller using crudify is running for a given action"
@@ -91,11 +95,11 @@ module Refinery
91
95
  abort "#{controller_class_name} is not defined"
92
96
  end
93
97
 
94
- crud_lines = Refinery.roots(:'refinery/core').join('lib', 'refinery', 'crud.rb').read
98
+ crud_lines = Refinery.roots('refinery/core').join('lib', 'refinery', 'crud.rb').read
95
99
  if (matches = crud_lines.scan(/(\ +)(def #{action}.+?protected)/m).first).present? &&
96
100
  (method_lines = "#{matches.last.split(%r{^#{matches.first}end}).first.strip}\nend".split("\n")).many?
97
101
  indent = method_lines.second.index %r{[^ ]}
98
- crud_method = method_lines.join("\n").gsub /^#{" " * indent}/, " "
102
+ crud_method = method_lines.join("\n").gsub(/^#{" " * indent}/, " ")
99
103
 
100
104
  crud_options = controller_class.try(:crudify_options) || {}
101
105
  crud_method.gsub! '#{options[:redirect_to_url]}', crud_options[:redirect_to_url].to_s
@@ -131,15 +135,46 @@ module Refinery
131
135
  end
132
136
 
133
137
  def find_matches(pattern)
134
- Set.new source_paths.map {|path| Dir[path.join(pattern)] }.flatten
138
+ Set.new source_paths.map { |path| Dir[path.join(pattern)] }.flatten
135
139
  end
136
140
 
137
141
  def find_relative_matches(pattern)
138
- find_matches(pattern).map {|match| strip_source_paths(match) }
142
+ find_matches(pattern).map { |match| strip_source_paths(match) }
139
143
  end
140
144
 
141
145
  def strip_source_paths(match)
142
146
  match.gsub Regexp.new(source_paths.join('\/?|')), ''
143
147
  end
148
+
149
+ def handle_invalid_override_input
150
+ puts "You didn't specify anything valid to override. Here are some examples:"
151
+ input_examples.each do |type, examples|
152
+ examples.each do |example|
153
+ puts "rake refinery:override #{type}=#{example}"
154
+ end
155
+ end
156
+ end
157
+
158
+ def handle_invalid_override_list_input
159
+ puts "You didn't specify a valid type to list overrides for. Here are some examples:"
160
+ input_examples.each do |type, examples|
161
+ puts "\nrake refinery:override:list type=#{type}"
162
+ examples.each do |example|
163
+ puts "rake refinery:override:list #{type}=#{example}"
164
+ end
165
+ end
166
+ end
167
+
168
+ def input_examples
169
+ {
170
+ :view => ['pages/home', 'refinery/pages/home', 'layouts/application'],
171
+ :javascript => %w(admin refinery/site_bar refinery**/{**/}*),
172
+ :stylesheet => %w(home refinery/site_bar),
173
+ :controller => %w(pages),
174
+ :model => %w(page refinery/page),
175
+ :helper => %w(site_bar refinery/site_bar_helper),
176
+ :presenter => %w(refinery/page_presenter)
177
+ }.freeze
178
+ end
144
179
  end
145
180
  end
data/lib/refinery/core.rb CHANGED
@@ -2,9 +2,11 @@ require File.expand_path('../../refinery', __FILE__)
2
2
  require 'truncate_html'
3
3
  require 'will_paginate'
4
4
  require 'refinery/i18n'
5
+ require 'zilch/authorisation'
5
6
 
6
7
  module Refinery
7
8
  module Core
9
+ require 'refinery/core/default_route'
8
10
  require 'refinery/core/engine'
9
11
  require 'refinery/core/configuration'
10
12
 
@@ -20,3 +22,6 @@ end
20
22
  # see https://github.com/refinery/refinerycms/issues/2273
21
23
  require 'decorators'
22
24
  require 'jquery-rails'
25
+ require 'jquery-ui-rails'
26
+ require 'sass-rails'
27
+ require 'coffee-rails'
@@ -0,0 +1,11 @@
1
+ module Refinery
2
+ module Core
3
+ class AuthorisationAdapter < Zilch::Authorisation::Adapters::Default
4
+
5
+ def current_user
6
+ @current_user ||= Refinery::Core::NilUser.new
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ require "zilch/authorisation/authorisation_manager"
2
+ require "refinery/core/authorisation_adapter"
3
+
4
+ module Refinery
5
+ module Core
6
+ class AuthorisationManager < Zilch::Authorisation::AuthorisationManager
7
+
8
+ def default_adapter
9
+ @default_adapter ||= Refinery::Core::AuthorisationAdapter.new
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -4,11 +4,12 @@ module Refinery
4
4
 
5
5
  config_accessor :rescue_not_found, :s3_backend, :base_cache_key, :site_name,
6
6
  :google_analytics_page_code, :authenticity_token_on_frontend,
7
- :dragonfly_secret,
8
- :wymeditor_whitelist_tags, :javascripts, :stylesheets,
7
+ :dragonfly_secret, :javascripts, :stylesheets, :mounted_path,
9
8
  :s3_bucket_name, :s3_region, :s3_access_key_id,
10
9
  :s3_secret_access_key, :force_ssl, :backend_route,
11
- :dragonfly_custom_backend_class, :dragonfly_custom_backend_opts
10
+ :dragonfly_custom_backend_class, :dragonfly_custom_backend_opts,
11
+ :visual_editor_javascripts, :visual_editor_stylesheets,
12
+ :plugin_priority, :refinery_logout_path
12
13
 
13
14
  self.rescue_not_found = false
14
15
  self.s3_backend = false
@@ -17,7 +18,6 @@ module Refinery
17
18
  self.google_analytics_page_code = "UA-xxxxxx-x"
18
19
  self.authenticity_token_on_frontend = false
19
20
  self.dragonfly_secret = Array.new(24) { rand(256) }.pack('C*').unpack('H*').first
20
- self.wymeditor_whitelist_tags = {}
21
21
  self.javascripts = []
22
22
  self.stylesheets = []
23
23
  self.s3_bucket_name = ENV['S3_BUCKET']
@@ -26,8 +26,12 @@ module Refinery
26
26
  self.s3_secret_access_key = ENV['S3_SECRET']
27
27
  self.force_ssl = false
28
28
  self.backend_route = "refinery"
29
+ self.mounted_path = "/"
29
30
  self.dragonfly_custom_backend_class = ''
30
31
  self.dragonfly_custom_backend_opts = {}
32
+ self.visual_editor_javascripts = []
33
+ self.visual_editor_stylesheets = []
34
+ self.plugin_priority = []
31
35
 
32
36
  def config.register_javascript(name)
33
37
  self.javascripts << name
@@ -37,12 +41,25 @@ module Refinery
37
41
  self.stylesheets << Stylesheet.new(*args)
38
42
  end
39
43
 
44
+ def config.register_visual_editor_javascript(name)
45
+ self.visual_editor_javascripts << name
46
+ end
47
+
48
+ def config.register_visual_editor_stylesheet(*args)
49
+ self.visual_editor_stylesheets << Stylesheet.new(*args)
50
+ end
51
+
40
52
  class << self
41
53
  def backend_route
42
54
  # prevent / at the start.
43
55
  config.backend_route.to_s.gsub(%r{\A/}, '')
44
56
  end
45
57
 
58
+ # See https://github.com/refinery/refinerycms/issues/2740
59
+ def backend_path
60
+ [mounted_path.gsub(%r{/\z}, ''), backend_route].join("/")
61
+ end
62
+
46
63
  def clear_javascripts!
47
64
  self.javascripts = []
48
65
  end
@@ -62,6 +79,10 @@ module Refinery
62
79
  def site_name
63
80
  ::I18n.t('site_name', :scope => 'refinery.core.config', :default => config.site_name)
64
81
  end
82
+
83
+ def wymeditor_whitelist_tags=(tags)
84
+ raise "Please ensure refinerycms-wymeditor is being used and use Refinery::Wymeditor.whitelist_tags instead of Refinery::Core.wymeditor_whitelist_tags"
85
+ end
65
86
  end
66
87
 
67
88
  # wrapper for stylesheet registration
@@ -0,0 +1,16 @@
1
+ module Refinery
2
+ module Core
3
+ class DefaultRoute
4
+
5
+ class << self
6
+ def load
7
+ Refinery::Core::Engine.routes.draw do
8
+ namespace :admin, :path => Refinery::Core.backend_route do
9
+ root :to => ::Refinery::Plugins.registered.in_menu.first.url
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -7,31 +7,31 @@ module Refinery
7
7
  engine_name :refinery
8
8
 
9
9
  class << self
10
- # Register all decorators from app/decorators/ and registered plugins' paths.
11
- def register_decorators!
12
- Decorators.register! Rails.root, Refinery::Plugins.registered.pathnames
13
- end
14
-
15
10
  # Performs the Refinery inclusion process which extends the currently loaded Rails
16
11
  # applications with Refinery's controllers and helpers. The process is wrapped by
17
12
  # a before_inclusion and after_inclusion step that calls procs registered by the
18
13
  # Refinery::Engine#before_inclusion and Refinery::Engine#after_inclusion class methods
19
14
  def refinery_inclusion!
20
- before_inclusion_procs.each(&:call)
15
+ before_inclusion_procs.each(&:call).tap do |c|
16
+ c.clear if Rails.application.config.cache_classes
17
+ end
21
18
 
22
19
  Refinery.include_once(::ApplicationController, Refinery::ApplicationController)
23
20
  ::ApplicationController.send :helper, Refinery::Core::Engine.helpers
24
21
 
25
- after_inclusion_procs.each(&:call)
22
+ after_inclusion_procs.each(&:call).tap do |c|
23
+ c.clear if Rails.application.config.cache_classes
24
+ end
25
+
26
+ # Register all decorators from app/decorators/ and registered plugins' paths.
27
+ Decorators.register! Rails.root, Refinery::Plugins.registered.pathnames
26
28
  end
27
29
  end
28
30
 
29
31
  config.autoload_paths += %W( #{config.root}/lib )
30
32
 
31
33
  # Include the refinery controllers and helpers dynamically
32
- config.to_prepare &method(:refinery_inclusion!).to_proc
33
-
34
- after_inclusion &method(:register_decorators!).to_proc
34
+ config.to_prepare(&method(:refinery_inclusion!).to_proc)
35
35
 
36
36
  # Wrap errors in spans
37
37
  config.to_prepare do
@@ -44,7 +44,7 @@ module Refinery
44
44
  WillPaginate.per_page = 20
45
45
  end
46
46
 
47
- initializer "register refinery_core plugin" do
47
+ before_inclusion do
48
48
  Refinery::Plugin.register do |plugin|
49
49
  plugin.pathname = root
50
50
  plugin.name = 'refinery_core'
@@ -53,9 +53,7 @@ module Refinery
53
53
  plugin.always_allow_access = true
54
54
  plugin.menu_match = /refinery\/(refinery_)?core$/
55
55
  end
56
- end
57
56
 
58
- initializer "register refinery_dialogs plugin" do
59
57
  Refinery::Plugin.register do |plugin|
60
58
  plugin.pathname = root
61
59
  plugin.name = 'refinery_dialogs'
@@ -75,21 +73,42 @@ module Refinery
75
73
  app.config.autoload_paths += [
76
74
  Rails.root.join('app', 'presenters'),
77
75
  Rails.root.join('vendor', '**', '**', 'app', 'presenters'),
78
- Refinery.roots.map{|r| r.join('**', 'app', 'presenters')}
76
+ Refinery.roots.map{ |r| r.join('**', 'app', 'presenters')}
79
77
  ].flatten
80
78
  end
81
79
 
82
- # set the manifests and assets to be precompiled
83
- initializer "refinery.assets.precompile" do |app|
84
- app.config.assets.precompile += [
85
- "refinery/*",
86
- "refinery/icons/*",
87
- "wymeditor/lang/*",
88
- "wymeditor/skins/refinery/*",
89
- "wymeditor/skins/refinery/**/*",
90
- "modernizr-min.js",
91
- "admin.js"
92
- ]
80
+ # set assets to be precompiled
81
+ config.to_prepare do
82
+
83
+ # scripts
84
+ Rails.application.config.assets.precompile += %w(
85
+ refinery/*.js
86
+ refinery/icons/*
87
+ modernizr-min.js
88
+ admin.js
89
+ )
90
+
91
+ # stylesheets
92
+ Rails.application.config.assets.precompile += %w(
93
+ refinery/refinery.css
94
+ refinery/formatting.css
95
+ refinery/site_bar.css
96
+ refinery/theme.css
97
+ )
98
+
99
+ # images
100
+ Rails.application.config.assets.precompile += %w(
101
+ refinery/images/*
102
+ )
103
+
104
+ # fonts
105
+ Rails.application.config.assets.precompile += %w(
106
+ font-awesome/fontawesome-webfont.eot
107
+ font-awesome/fontawesome-webfont.woff2
108
+ font-awesome/fontawesome-webfont.woff
109
+ font-awesome/fontawesome-webfont.ttf
110
+ font-awesome/fontawesome-webfont.svg
111
+ )
93
112
  end
94
113
 
95
114
  # active model fields which may contain sensitive data to filter
@@ -0,0 +1,42 @@
1
+ require 'zilch/authorisation/nil_user'
2
+ require 'refinery/plugins'
3
+
4
+ module Refinery
5
+ module Core
6
+ class NilUser < Zilch::Authorisation::NilUser
7
+ # The default NilUser has all roles and can access all plugins.
8
+ # Should be overridden in authentication solutions.
9
+ def has_role?(role)
10
+ true
11
+ end
12
+
13
+ # Returns all plugins that the user has access to, that are currently
14
+ # loaded in the system.
15
+ # For NilUser, this returns all registered plugins.
16
+ # Should be overridden in authentication solutions
17
+ def active_plugins
18
+ Refinery::Plugins.registered
19
+ end
20
+
21
+ # Returns all registered plugins.
22
+ # Should be overridden in authentication solutions.
23
+ def plugins
24
+ Refinery::Plugins.registered
25
+ end
26
+
27
+ # Returns true.
28
+ # Should be overridden in authentication solutions.
29
+ # A real solution might be: `Refinery::Plugins.active.names.include?(name)`
30
+ def has_plugin?(name)
31
+ true
32
+ end
33
+
34
+ # Returns a URL to the first plugin with a URL in the menu. Used for
35
+ # admin users' root admin url.
36
+ # Should be overridden in authentication solutions.
37
+ def landing_url
38
+ active_plugins.first_url_in_menu
39
+ end
40
+ end
41
+ end
42
+ end
data/lib/refinery/crud.rb CHANGED
@@ -34,7 +34,6 @@ module Refinery
34
34
  :search_conditions => '',
35
35
  :sortable => true,
36
36
  :title_attribute => "title",
37
- :xhr_paging => false,
38
37
  :class_name => class_name,
39
38
  :singular_name => singular_name,
40
39
  :plural_name => plural_name
@@ -50,6 +49,7 @@ module Refinery
50
49
 
51
50
  def crudify(model_name, options = {})
52
51
  options = ::Refinery::Crud.default_options(model_name).merge(options)
52
+ Refinery.deprecate :xhr_paging, when: '3.1' if options[:xhr_paging]
53
53
  class_name = options[:class_name]
54
54
  singular_name = options[:singular_name]
55
55
  plural_name = options[:plural_name]
@@ -59,16 +59,16 @@ module Refinery
59
59
  #{options.inspect}
60
60
  end
61
61
 
62
- prepend_before_filter :find_#{singular_name},
62
+ prepend_before_action :find_#{singular_name},
63
63
  :only => [:update, :destroy, :edit, :show]
64
- prepend_before_filter :merge_position_into_params!, :only => :create
64
+ prepend_before_action :merge_position_into_params!, :only => :create
65
65
 
66
66
  def new
67
67
  @#{singular_name} = #{class_name}.new
68
68
  end
69
69
 
70
70
  def create
71
- if (@#{singular_name} = #{class_name}.create(params[:#{singular_name}])).valid?
71
+ if (@#{singular_name} = #{class_name}.create(#{singular_name}_params)).valid?
72
72
  flash.notice = t(
73
73
  'refinery.crudify.created',
74
74
  :what => "'\#{@#{singular_name}.#{options[:title_attribute]}}'"
@@ -85,7 +85,7 @@ module Refinery
85
85
  end
86
86
 
87
87
  def update
88
- if @#{singular_name}.update_attributes(params[:#{singular_name}])
88
+ if @#{singular_name}.update_attributes(#{singular_name}_params)
89
89
  flash.notice = t(
90
90
  'refinery.crudify.updated',
91
91
  :what => "'\#{@#{singular_name}.#{options[:title_attribute]}}'"
@@ -109,24 +109,29 @@ module Refinery
109
109
 
110
110
  # Finds one single result based on the id params.
111
111
  def find_#{singular_name}
112
- @#{singular_name} = #{class_name}.find(params[:id],
113
- :include => #{options[:include].map(&:to_sym).inspect})
112
+ @#{singular_name} = find_#{singular_name}_scope.find(params[:id])
113
+ end
114
+
115
+ def find_#{singular_name}_scope
116
+ _finder_scope = #{class_name}.includes(#{options[:include].map(&:to_sym).inspect})
117
+ _finder_scope = _finder_scope.friendly if _finder_scope.respond_to?(:friendly)
118
+ _finder_scope
114
119
  end
115
120
 
116
121
  # Find the collection of @#{plural_name} based on the conditions specified into crudify
117
122
  # It will be ordered based on the conditions specified into crudify
118
123
  # And eager loading is applied as specified into crudify.
119
124
  def find_all_#{plural_name}(conditions = #{options[:conditions].inspect})
120
- @#{plural_name} = #{class_name}.where(conditions).includes(
121
- #{options[:include].map(&:to_sym).inspect}
122
- ).order("#{options[:order]}")
125
+ @#{plural_name} = find_#{singular_name}_scope
126
+ .where(conditions)
127
+ .order("#{options[:order]}")
123
128
  end
124
129
 
125
130
  def merge_position_into_params!
126
131
  # if the position field exists, set this object as last object, given the conditions of this class.
127
132
  if #{class_name}.column_names.include?("position") && params[:#{singular_name}][:position].nil?
128
133
  params[:#{singular_name}].merge!({
129
- :position => ((#{class_name}.maximum(:position, :conditions => #{options[:conditions].inspect})||-1) + 1)
134
+ position: ((#{class_name}.where(#{options[:conditions].inspect}).maximum(:position)||-1) + 1)
130
135
  })
131
136
  end
132
137
  end
@@ -204,14 +209,20 @@ module Refinery
204
209
  @#{plural_name} = @#{plural_name}.with_query(params[:search])
205
210
  end
206
211
 
212
+ def #{singular_name}_params
213
+ raise "Please override #{singular_name}_params with your desired parameter security."
214
+ end
215
+
207
216
  # Ensure all methods are protected so that they should only be called
208
217
  # from within the current controller.
209
218
  protected :find_#{singular_name},
219
+ :find_#{singular_name}_scope,
210
220
  :find_all_#{plural_name},
211
221
  :paginate_all_#{plural_name},
212
222
  :paginate_per_page,
213
223
  :render_partial_response?,
214
224
  :search_all_#{plural_name},
225
+ :#{singular_name}_params,
215
226
  :redirect_url,
216
227
  :create_or_update_successful,
217
228
  :create_or_update_unsuccessful,
@@ -220,7 +231,7 @@ module Refinery
220
231
 
221
232
  # Methods that are only included when this controller is searchable.
222
233
  if options[:searchable]
223
- if options[:paging] || options[:xhr_paging]
234
+ if options[:paging]
224
235
  module_eval %(
225
236
  def index
226
237
  search_all_#{plural_name} if searching?
@@ -232,10 +243,10 @@ module Refinery
232
243
  else
233
244
  module_eval %(
234
245
  def index
235
- unless searching?
236
- find_all_#{plural_name}
237
- else
246
+ if searching?
238
247
  search_all_#{plural_name}
248
+ else
249
+ find_all_#{plural_name}
239
250
  end
240
251
 
241
252
  render_partial_response?
@@ -244,7 +255,7 @@ module Refinery
244
255
  end
245
256
 
246
257
  else
247
- if options[:paging] || options[:xhr_paging]
258
+ if options[:paging]
248
259
  module_eval %(
249
260
  def index
250
261
  paginate_all_#{plural_name}
@@ -269,22 +280,22 @@ module Refinery
269
280
  find_all_#{plural_name}
270
281
  end
271
282
 
272
- # Based upon http://github.com/matenia/jQuery-Awesome-Nested-Set-Drag-and-Drop
283
+ # Based upon https://github.com/matenia/jQuery-Awesome-Nested-Set-Drag-and-Drop
273
284
  def update_positions
274
285
  previous = nil
275
286
  params[:ul].each do |_, list|
276
287
  list.each do |index, hash|
277
- moved_item_id = hash['id'][/\\d+$/]
288
+ moved_item_id = hash['id'][/\\d+\\z/]
278
289
  @current_#{singular_name} = #{class_name}.find_by_id(moved_item_id)
279
290
 
280
291
  if @current_#{singular_name}.respond_to?(:move_to_root)
281
292
  if previous.present?
282
293
  @current_#{singular_name}.move_to_right_of(#{class_name}.find_by_id(previous))
283
- else
294
+ elsif !@current_#{singular_name}.root?
284
295
  @current_#{singular_name}.move_to_root
285
296
  end
286
297
  else
287
- @current_#{singular_name}.update_attributes :position => index
298
+ @current_#{singular_name}.update_columns position: index
288
299
  end
289
300
 
290
301
  if hash['children'].present?
@@ -302,10 +313,14 @@ module Refinery
302
313
 
303
314
  def update_child_positions(_node, #{singular_name})
304
315
  list = _node['children']['0']
305
- list.sort_by {|k, v| k.to_i}.map { |item| item[1] }.each_with_index do |child, index|
316
+ child_positions_changed = false
317
+ list.sort_by { |k, v| k.to_i}.map { |item| item[1] }.each_with_index do |child, index|
306
318
  child_id = child['id'].split(/#{singular_name}\_?/).reject(&:empty?).first
307
319
  child_#{singular_name} = #{class_name}.where(:id => child_id).first
308
- child_#{singular_name}.move_to_child_of(#{singular_name})
320
+ child_positions_changed ||= #{singular_name}.children[index] != child_#{singular_name}
321
+ if child_positions_changed
322
+ child_#{singular_name}.move_to_child_of(#{singular_name})
323
+ end
309
324
 
310
325
  if child['children'].present?
311
326
  update_child_positions(child, child_#{singular_name})
@@ -324,20 +339,16 @@ module Refinery
324
339
  module_eval %(
325
340
  class << self
326
341
  def pageable?
327
- #{options[:paging].to_s} || #{options[:xhr_paging].to_s}
342
+ #{options[:paging]}
328
343
  end
329
344
  alias_method :paging?, :pageable?
330
345
 
331
- def xhr_pageable?
332
- #{options[:xhr_paging].to_s}
333
- end
334
-
335
346
  def sortable?
336
- #{options[:sortable].to_s}
347
+ #{options[:sortable]}
337
348
  end
338
349
 
339
350
  def searchable?
340
- #{options[:searchable].to_s}
351
+ #{options[:searchable]}
341
352
  end
342
353
  end
343
354
  )