alchemy_cms 2.5.3.1 → 2.6.0.rc5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (331) hide show
  1. data/.gitignore +1 -1
  2. data/.travis.yml +5 -13
  3. data/Gemfile +6 -3
  4. data/README.md +3 -2
  5. data/alchemy_cms.gemspec +22 -22
  6. data/app/assets/fonts/alchemy-icons.eot +0 -0
  7. data/app/assets/fonts/alchemy-icons.svg +54 -0
  8. data/app/assets/fonts/alchemy-icons.ttf +0 -0
  9. data/app/assets/fonts/alchemy-icons.woff +0 -0
  10. data/app/assets/images/alchemy/icons.png +0 -0
  11. data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +151 -0
  12. data/app/assets/javascripts/alchemy/alchemy.buttons.js.coffee +3 -2
  13. data/app/assets/javascripts/alchemy/alchemy.datepicker.js.coffee +31 -0
  14. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +1 -1
  15. data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +98 -0
  16. data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +23 -24
  17. data/app/assets/javascripts/alchemy/alchemy.growler.js.coffee +27 -0
  18. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +11 -8
  19. data/app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee +32 -0
  20. data/app/assets/javascripts/alchemy/alchemy.image_cropper.js.coffee +46 -0
  21. data/app/assets/javascripts/alchemy/alchemy.js +8 -2
  22. data/app/assets/javascripts/alchemy/alchemy.link_overlay.js.coffee +5 -4
  23. data/app/assets/javascripts/alchemy/alchemy.list_filter.js.coffee +49 -0
  24. data/app/assets/javascripts/alchemy/alchemy.onload.js.coffee +3 -0
  25. data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +71 -0
  26. data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +61 -0
  27. data/app/assets/javascripts/alchemy/alchemy.spinner.js.coffee +35 -0
  28. data/app/assets/javascripts/alchemy/alchemy.string_extension.js.coffee +11 -0
  29. data/app/assets/javascripts/alchemy/alchemy.windows.js.coffee +278 -0
  30. data/app/assets/stylesheets/alchemy/admin.css.scss +2 -0
  31. data/app/assets/stylesheets/alchemy/archive.scss +109 -65
  32. data/app/assets/stylesheets/alchemy/base.scss +16 -188
  33. data/app/assets/stylesheets/alchemy/dashboard.scss +2 -2
  34. data/app/assets/stylesheets/alchemy/defaults.scss +2 -1
  35. data/app/assets/stylesheets/alchemy/elements.scss +58 -94
  36. data/app/assets/stylesheets/alchemy/errors.scss +2 -2
  37. data/app/assets/stylesheets/alchemy/{mixins.scss → extends.scss} +104 -80
  38. data/app/assets/stylesheets/alchemy/flash.scss +4 -6
  39. data/app/assets/stylesheets/alchemy/fonts.scss +46 -0
  40. data/app/assets/stylesheets/alchemy/form_elements.scss +46 -45
  41. data/app/assets/stylesheets/alchemy/frame.scss +20 -15
  42. data/app/assets/stylesheets/alchemy/icons.scss +22 -9
  43. data/app/assets/stylesheets/alchemy/jquery-ui.scss +476 -399
  44. data/app/assets/stylesheets/alchemy/login.scss +1 -1
  45. data/app/assets/stylesheets/alchemy/menubar.css.scss +1 -1
  46. data/app/assets/stylesheets/alchemy/notices.scss +5 -5
  47. data/app/assets/stylesheets/alchemy/pagination.scss +25 -13
  48. data/app/assets/stylesheets/alchemy/search.scss +29 -17
  49. data/app/assets/stylesheets/alchemy/sitemap.scss +41 -36
  50. data/app/assets/stylesheets/alchemy/tables.scss +102 -50
  51. data/app/assets/stylesheets/alchemy/tinymce_dialog.css.scss +18 -16
  52. data/app/assets/stylesheets/alchemy/toolbar.scss +84 -24
  53. data/app/assets/stylesheets/alchemy/upload.scss +14 -9
  54. data/app/assets/stylesheets/alchemy/variables.scss +1 -0
  55. data/app/assets/stylesheets/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css.scss +18 -21
  56. data/app/controllers/alchemy/admin/attachments_controller.rb +29 -39
  57. data/app/controllers/alchemy/admin/base_controller.rb +3 -9
  58. data/app/controllers/alchemy/admin/clipboard_controller.rb +1 -1
  59. data/app/controllers/alchemy/admin/contents_controller.rb +1 -1
  60. data/app/controllers/alchemy/admin/dashboard_controller.rb +1 -1
  61. data/app/controllers/alchemy/admin/elements_controller.rb +3 -3
  62. data/app/controllers/alchemy/admin/essence_files_controller.rb +1 -1
  63. data/app/controllers/alchemy/admin/essence_pictures_controller.rb +5 -5
  64. data/app/controllers/alchemy/admin/languages_controller.rb +1 -1
  65. data/app/controllers/alchemy/admin/pages_controller.rb +18 -16
  66. data/app/controllers/alchemy/admin/pictures_controller.rb +11 -10
  67. data/app/controllers/alchemy/admin/resources_controller.rb +87 -14
  68. data/app/controllers/alchemy/admin/tags_controller.rb +3 -3
  69. data/app/controllers/alchemy/admin/trash_controller.rb +3 -3
  70. data/app/controllers/alchemy/admin/users_controller.rb +6 -11
  71. data/app/controllers/alchemy/attachments_controller.rb +8 -9
  72. data/app/controllers/alchemy/base_controller.rb +17 -10
  73. data/app/controllers/alchemy/pages_controller.rb +7 -19
  74. data/app/controllers/alchemy/passwords_controller.rb +15 -3
  75. data/app/controllers/alchemy/user_sessions_controller.rb +5 -4
  76. data/app/controllers/alchemy/users_controller.rb +1 -1
  77. data/app/helpers/alchemy/admin/attachments_helper.rb +2 -2
  78. data/app/helpers/alchemy/admin/base_helper.rb +62 -90
  79. data/app/helpers/alchemy/admin/elements_helper.rb +13 -5
  80. data/app/helpers/alchemy/admin/essences_helper.rb +3 -5
  81. data/app/helpers/alchemy/admin/pages_helper.rb +6 -3
  82. data/app/helpers/alchemy/admin/tags_helper.rb +60 -0
  83. data/app/helpers/alchemy/base_helper.rb +16 -20
  84. data/app/helpers/alchemy/elements_helper.rb +7 -11
  85. data/app/helpers/alchemy/essences_helper.rb +2 -2
  86. data/app/helpers/alchemy/pages_helper.rb +31 -69
  87. data/app/helpers/alchemy/url_helper.rb +11 -3
  88. data/app/models/alchemy/attachment.rb +73 -45
  89. data/app/models/alchemy/cell.rb +1 -1
  90. data/app/models/alchemy/content.rb +20 -9
  91. data/app/models/alchemy/element.rb +9 -7
  92. data/app/models/alchemy/page.rb +15 -248
  93. data/app/models/alchemy/page/cells.rb +71 -0
  94. data/app/models/alchemy/page/elements.rb +147 -0
  95. data/app/models/alchemy/page/naming.rb +90 -0
  96. data/app/models/alchemy/picture.rb +18 -13
  97. data/app/models/alchemy/tag.rb +1 -1
  98. data/app/models/alchemy/user.rb +38 -6
  99. data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +14 -7
  100. data/app/views/alchemy/admin/attachments/_attachment.html.erb +17 -12
  101. data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +3 -8
  102. data/app/views/alchemy/admin/attachments/_files_list.html.erb +20 -12
  103. data/app/views/alchemy/admin/attachments/_overlay_file_list.html.erb +11 -0
  104. data/app/views/alchemy/admin/attachments/_tag_list.html.erb +31 -0
  105. data/app/views/alchemy/admin/attachments/archive_overlay.js.erb +4 -0
  106. data/app/views/alchemy/admin/attachments/edit.html.erb +8 -7
  107. data/app/views/alchemy/admin/attachments/index.html.erb +19 -12
  108. data/app/views/alchemy/admin/attachments/new.html.erb +2 -2
  109. data/app/views/alchemy/admin/attachments/show.html.erb +3 -0
  110. data/app/views/alchemy/admin/contents/_missing.html.erb +4 -4
  111. data/app/views/alchemy/admin/contents/create.js.erb +1 -1
  112. data/app/views/alchemy/admin/contents/new.html.erb +6 -3
  113. data/app/views/alchemy/admin/dashboard/_locked_pages.html.erb +1 -1
  114. data/app/views/alchemy/admin/dashboard/_users.html.erb +1 -1
  115. data/app/views/alchemy/admin/dashboard/index.html.erb +3 -3
  116. data/app/views/alchemy/admin/dashboard/info.html.erb +16 -13
  117. data/app/views/alchemy/admin/elements/_add_picture.html.erb +1 -1
  118. data/app/views/alchemy/admin/elements/_element_foot.html.erb +4 -4
  119. data/app/views/alchemy/admin/elements/_element_head.html.erb +1 -7
  120. data/app/views/alchemy/admin/elements/_elements_select.html.erb +2 -2
  121. data/app/views/alchemy/admin/elements/_new_element_form.html.erb +4 -4
  122. data/app/views/alchemy/admin/elements/_picture_gallery_editor.html.erb +1 -1
  123. data/app/views/alchemy/admin/elements/create.js.erb +2 -2
  124. data/app/views/alchemy/admin/elements/fold.js.erb +3 -6
  125. data/app/views/alchemy/admin/elements/new.html.erb +1 -1
  126. data/app/views/alchemy/admin/elements/order.js.erb +1 -1
  127. data/app/views/alchemy/admin/elements/trash.js.erb +1 -1
  128. data/app/views/alchemy/admin/elements/update.js.erb +2 -2
  129. data/app/views/alchemy/admin/essence_files/edit.html.erb +4 -4
  130. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +17 -18
  131. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +2 -2
  132. data/app/views/alchemy/admin/essence_pictures/update.js.erb +1 -0
  133. data/app/views/alchemy/admin/languages/_form.html.erb +12 -10
  134. data/app/views/alchemy/admin/languages/_language.html.erb +2 -1
  135. data/app/views/alchemy/admin/languages/_table.html.erb +3 -3
  136. data/app/views/alchemy/admin/languages/index.html.erb +15 -15
  137. data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +6 -6
  138. data/app/views/alchemy/admin/layoutpages/index.html.erb +41 -40
  139. data/app/views/alchemy/admin/pages/_contactform_links.html.erb +4 -4
  140. data/app/views/alchemy/admin/pages/_create_language_form.html.erb +6 -6
  141. data/app/views/alchemy/admin/pages/_external_link.html.erb +2 -2
  142. data/app/views/alchemy/admin/pages/_file_link.html.erb +3 -3
  143. data/app/views/alchemy/admin/pages/_internal_link.html.erb +1 -1
  144. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -1
  145. data/app/views/alchemy/admin/pages/_page.html.erb +13 -13
  146. data/app/views/alchemy/admin/pages/_page_for_links.html.erb +2 -4
  147. data/app/views/alchemy/admin/pages/_sitemap.html.erb +5 -0
  148. data/app/views/alchemy/admin/pages/configure.html.erb +7 -7
  149. data/app/views/alchemy/admin/pages/configure_external.html.erb +4 -4
  150. data/app/views/alchemy/admin/pages/edit.html.erb +23 -30
  151. data/app/views/alchemy/admin/pages/index.html.erb +34 -23
  152. data/app/views/alchemy/admin/pages/new.html.erb +1 -1
  153. data/app/views/alchemy/admin/pages/sort.js.erb +1 -1
  154. data/app/views/alchemy/admin/partials/_flash_upload.html.erb +2 -3
  155. data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +2 -2
  156. data/app/views/alchemy/admin/partials/_search_form.html.erb +3 -3
  157. data/app/views/alchemy/admin/partials/_upload_form.html.erb +2 -2
  158. data/app/views/alchemy/admin/pictures/_archive.html.erb +7 -7
  159. data/app/views/alchemy/admin/pictures/_archive_overlay.html.erb +1 -1
  160. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +6 -6
  161. data/app/views/alchemy/admin/pictures/_filter_bar.html.erb +4 -4
  162. data/app/views/alchemy/admin/pictures/_overlay_picture_list.html.erb +1 -1
  163. data/app/views/alchemy/admin/pictures/_picture.html.erb +3 -8
  164. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +9 -14
  165. data/app/views/alchemy/admin/pictures/_tag_list.html.erb +27 -25
  166. data/app/views/alchemy/admin/pictures/archive_overlay.js.erb +3 -1
  167. data/app/views/alchemy/admin/pictures/index.html.erb +49 -42
  168. data/app/views/alchemy/admin/pictures/new.html.erb +2 -2
  169. data/app/views/alchemy/admin/pictures/show.html.erb +11 -0
  170. data/app/views/alchemy/admin/resources/_boolean.html.erb +2 -2
  171. data/app/views/alchemy/admin/resources/_datetime.html.erb +2 -2
  172. data/app/views/alchemy/admin/resources/_form.html.erb +9 -8
  173. data/app/views/alchemy/admin/resources/_resource.html.erb +15 -21
  174. data/app/views/alchemy/admin/resources/_string.html.erb +2 -2
  175. data/app/views/alchemy/admin/resources/_table.html.erb +11 -13
  176. data/app/views/alchemy/admin/resources/_text.html.erb +2 -2
  177. data/app/views/alchemy/admin/resources/index.csv.erb +13 -0
  178. data/app/views/alchemy/admin/resources/index.html.erb +24 -15
  179. data/app/views/alchemy/admin/sites/index.html.erb +23 -0
  180. data/app/views/alchemy/admin/tags/_radio_tag.html.erb +1 -1
  181. data/app/views/alchemy/admin/tags/_tag.html.erb +2 -1
  182. data/app/views/alchemy/admin/tags/edit.html.erb +1 -1
  183. data/app/views/alchemy/admin/tags/index.html.erb +16 -11
  184. data/app/views/alchemy/admin/tags/new.html.erb +3 -3
  185. data/app/views/alchemy/admin/trash/clear.js.coffee +1 -1
  186. data/app/views/alchemy/admin/users/_table.html.erb +12 -5
  187. data/app/views/alchemy/admin/users/_user.html.erb +16 -16
  188. data/app/views/alchemy/admin/users/index.html.erb +28 -16
  189. data/app/views/alchemy/breadcrumb/_page.html.erb +15 -0
  190. data/app/views/alchemy/breadcrumb/_spacer.html.erb +1 -0
  191. data/app/views/alchemy/elements/_editor_not_found.html.erb +1 -1
  192. data/app/views/alchemy/essences/_essence_file_editor.html.erb +16 -16
  193. data/app/views/alchemy/essences/_essence_file_view.html.erb +8 -9
  194. data/app/views/alchemy/essences/_essence_picture_editor.html.erb +3 -6
  195. data/app/views/alchemy/essences/_essence_picture_tools.html.erb +9 -8
  196. data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +0 -5
  197. data/app/views/alchemy/essences/_linkable_essence_tools.html.erb +2 -2
  198. data/app/views/alchemy/navigation/_link.html.erb +7 -7
  199. data/app/views/alchemy/navigation/_renderer.html.erb +29 -36
  200. data/app/views/alchemy/notifications/admin_user_created.de.text.erb +5 -1
  201. data/app/views/alchemy/notifications/admin_user_created.en.text.erb +5 -1
  202. data/app/views/alchemy/notifications/registered_user_created.de.text.erb +13 -0
  203. data/app/views/alchemy/notifications/registered_user_created.en.text.erb +13 -0
  204. data/app/views/alchemy/search/_result.html.erb +4 -6
  205. data/app/views/alchemy/search/_results.html.erb +4 -5
  206. data/app/views/alchemy/user_sessions/leave.html.erb +1 -1
  207. data/app/views/alchemy/user_sessions/new.html.erb +2 -2
  208. data/app/views/kaminari/_first_page.html.erb +11 -0
  209. data/app/views/kaminari/_gap.html.erb +1 -1
  210. data/app/views/kaminari/_last_page.html.erb +11 -0
  211. data/app/views/kaminari/_next_page.html.erb +2 -2
  212. data/app/views/kaminari/_page.html.erb +1 -1
  213. data/app/views/kaminari/_paginator.html.erb +2 -0
  214. data/app/views/kaminari/_prev_page.html.erb +2 -2
  215. data/app/views/layouts/alchemy/admin.html.erb +4 -5
  216. data/config/alchemy/config.yml +8 -12
  217. data/config/authorization_rules.rb +4 -3
  218. data/config/initializers/dragonfly.rb +20 -12
  219. data/config/locales/alchemy.de.yml +20 -15
  220. data/config/locales/alchemy.en.yml +15 -10
  221. data/config/locales/devise.de.yml +1 -0
  222. data/config/routes.rb +3 -3
  223. data/{spec/dummy/db/migrate/20121118000000_alchemy_two_point_four.rb → db/migrate/20130214233001_alchemy_two_point_five.rb} +50 -36
  224. data/db/migrate/20130221200514_migrate_attachments_to_dragonfly.rb +21 -0
  225. data/db/migrate/20130312205327_change_alchemy_users_role_to_roles.rb +11 -0
  226. data/lib/alchemy/capistrano.rb +10 -8
  227. data/lib/alchemy/errors.rb +7 -0
  228. data/lib/alchemy/filetypes.rb +33 -0
  229. data/lib/alchemy/i18n.rb +9 -1
  230. data/lib/alchemy/name_conversions.rb +28 -0
  231. data/lib/alchemy/page_layout.rb +5 -3
  232. data/lib/alchemy/resource.rb +132 -29
  233. data/lib/alchemy/resources_helper.rb +81 -12
  234. data/lib/alchemy/upgrader.rb +14 -276
  235. data/lib/alchemy/version.rb +1 -1
  236. data/lib/alchemy_cms.rb +17 -2
  237. data/lib/rails/generators/alchemy/deploy_script/templates/deploy.rb.tt +1 -1
  238. data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +1 -1
  239. data/lib/tasks/alchemy/convert.rake +39 -0
  240. data/lib/tasks/alchemy/install.rake +4 -6
  241. data/lib/tasks/alchemy/upgrade.rake +18 -1
  242. data/spec/controllers/admin/clipboard_controller_spec.rb +4 -4
  243. data/spec/controllers/admin/elements_controller_spec.rb +23 -23
  244. data/spec/controllers/admin/pages_controller_spec.rb +15 -0
  245. data/spec/controllers/admin/resources_controller_spec.rb +1 -11
  246. data/spec/controllers/admin/trash_controller_spec.rb +9 -9
  247. data/spec/controllers/attachments_controller_spec.rb +3 -3
  248. data/spec/controllers/elements_controller_spec.rb +2 -2
  249. data/spec/controllers/pages_controller_spec.rb +160 -129
  250. data/spec/controllers/pictures_controller_spec.rb +2 -2
  251. data/spec/controllers/user_sessions_controller_spec.rb +3 -3
  252. data/spec/controllers/users_controller_spec.rb +2 -2
  253. data/spec/dummy/app/models/event.rb +2 -2
  254. data/spec/dummy/app/models/location.rb +4 -0
  255. data/spec/dummy/app/views/layouts/application.html.erb +6 -42
  256. data/spec/dummy/config/routes.rb +1 -1
  257. data/spec/dummy/db/migrate/20121026104128_create_events.rb +0 -1
  258. data/{db/migrate/20121118000000_alchemy_two_point_four.rb → spec/dummy/db/migrate/20130214233001_alchemy_two_point_five.rb} +50 -36
  259. data/spec/dummy/db/migrate/20130221200514_migrate_attachments_to_dragonfly.rb +21 -0
  260. data/spec/dummy/db/migrate/20130312205327_change_alchemy_users_role_to_roles.rb +11 -0
  261. data/spec/dummy/db/migrate/20130328101418_create_locations.rb +9 -0
  262. data/spec/dummy/db/schema.rb +15 -6
  263. data/spec/factories.rb +4 -4
  264. data/spec/{integration → features}/admin/link_overlay_spec.rb +0 -0
  265. data/spec/{integration → features}/admin/modules_integration_spec.rb +1 -1
  266. data/spec/{integration → features}/admin/pages_controller_spec.rb +9 -4
  267. data/spec/{integration → features}/admin/picture_library_integration_spec.rb +5 -5
  268. data/spec/{integration → features}/admin/resources_integration_spec.rb +1 -1
  269. data/spec/{integration → features}/navigation_spec.rb +0 -0
  270. data/spec/{integration → features}/pages_controller_spec.rb +42 -112
  271. data/spec/{integration → features}/picture_security_spec.rb +2 -2
  272. data/spec/{integration → features}/security_spec.rb +7 -7
  273. data/spec/{integration → features}/translation_integration_spec.rb +0 -0
  274. data/spec/helpers/admin/base_helper_spec.rb +0 -50
  275. data/spec/helpers/admin/tags_helper_spec.rb +53 -0
  276. data/spec/helpers/base_helper_spec.rb +19 -3
  277. data/spec/helpers/pages_helper_spec.rb +92 -44
  278. data/spec/{url_helpers_spec.rb → helpers/picture_url_helpers_spec.rb} +7 -7
  279. data/spec/helpers/url_helper_spec.rb +92 -72
  280. data/spec/{config_spec.rb → libraries/config_spec.rb} +0 -0
  281. data/spec/libraries/resource_spec.rb +215 -76
  282. data/spec/libraries/resources_helper_spec.rb +70 -28
  283. data/spec/models/attachment_spec.rb +75 -9
  284. data/spec/models/clipboard_spec.rb +1 -1
  285. data/spec/models/element_spec.rb +7 -0
  286. data/spec/models/page_spec.rb +144 -25
  287. data/spec/models/picture_spec.rb +5 -5
  288. data/spec/models/resource_spec.rb +47 -10
  289. data/spec/models/user_spec.rb +115 -3
  290. data/spec/{routing_spec.rb → routing/routing_spec.rb} +8 -20
  291. data/spec/spec_helper.rb +5 -6
  292. data/spec/support/alchemy/specs_helpers.rb +1 -1
  293. data/spec/support/ci/install_phantomjs +1 -1
  294. data/spec/support/image with spaces.png +0 -0
  295. data/vendor/assets/javascripts/jquery_plugins/jquery.Jcrop.min.js +18 -18
  296. data/vendor/assets/javascripts/jquery_plugins/{jquery.dialogextend.1_0_1.js → jquery.dialogextend.js} +25 -17
  297. data/vendor/assets/javascripts/jquery_plugins/jquery.scrollTo.min.js +7 -0
  298. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.tabspaging.js +7 -7
  299. data/vendor/assets/javascripts/keymage.min.js +6 -0
  300. data/vendor/assets/javascripts/spin.min.js +1 -0
  301. metadata +122 -124
  302. data/app/assets/images/alchemy/ajax_loader.gif +0 -0
  303. data/app/assets/images/alchemy/gui/toggle.png +0 -0
  304. data/app/assets/images/alchemy/image_loader.gif +0 -0
  305. data/app/assets/images/alchemy/shading.png +0 -0
  306. data/app/assets/images/alchemy/tabs.gif +0 -0
  307. data/app/assets/javascripts/alchemy/alchemy.base.js +0 -172
  308. data/app/assets/javascripts/alchemy/alchemy.datepicker.js +0 -47
  309. data/app/assets/javascripts/alchemy/alchemy.element_editor_selector.js +0 -91
  310. data/app/assets/javascripts/alchemy/alchemy.growler.js +0 -46
  311. data/app/assets/javascripts/alchemy/alchemy.image_cropper.js +0 -60
  312. data/app/assets/javascripts/alchemy/alchemy.js_extensions.js +0 -15
  313. data/app/assets/javascripts/alchemy/alchemy.preview_window.js +0 -97
  314. data/app/assets/javascripts/alchemy/alchemy.windows.js +0 -321
  315. data/app/models/alchemy/clipboard_spec.rb +0 -0
  316. data/app/views/alchemy/admin/pictures/show_in_window.html.erb +0 -8
  317. data/app/views/alchemy/notifications/registered_user_created.text.erb +0 -11
  318. data/db/migrate/20121121162313_switch_from_fleximage_to_dragonfly.rb +0 -21
  319. data/db/migrate/20121205155004_create_alchemy_sites.rb +0 -14
  320. data/db/migrate/20121211163003_add_public_to_alchemy_sites.rb +0 -6
  321. data/db/migrate/20121220102223_add_aliases_to_site.rb +0 -6
  322. data/db/migrate/20130110212411_create_alchemy_legacy_page_urls.rb +0 -11
  323. data/db/migrate/20130121092645_migrate_to_devise.rb +0 -24
  324. data/spec/alchemy_spec.rb +0 -7
  325. data/spec/dummy/db/migrate/20121121162313_switch_from_fleximage_to_dragonfly.rb +0 -21
  326. data/spec/dummy/db/migrate/20121205155004_create_alchemy_sites.rb +0 -14
  327. data/spec/dummy/db/migrate/20121211163003_add_public_to_alchemy_sites.rb +0 -6
  328. data/spec/dummy/db/migrate/20121220102223_add_aliases_to_site.rb +0 -6
  329. data/spec/dummy/db/migrate/20130110212411_create_alchemy_legacy_page_urls.rb +0 -11
  330. data/spec/dummy/db/migrate/20130121092645_migrate_to_devise.rb +0 -24
  331. data/vendor/assets/javascripts/jquery_plugins/jquery.scrollTo-1.4.2-min.js +0 -11
@@ -2,35 +2,113 @@ require 'active_support/inflector'
2
2
  require 'active_support/core_ext'
3
3
 
4
4
  module Alchemy
5
+ # = Alchemy::Resource
6
+ #
7
+ # Used to DRY up resource like structures in Alchemy's admin backend.
8
+ # So far Language, User and Tag already uses this.
9
+ #
10
+ # It provides convenience methods to create an admin interface without further knowledge about
11
+ # the model and the controller (it's instantiated with controller_path at least and guesses the model accordingly)
12
+ #
13
+ # For examples how to use in controllers see Alchemy::ResourcesController or inherit from it directly.
14
+ #
15
+ # == Naming Conventions
16
+ #
17
+ # As Rails' form helpers, path helpers, etc. and declarative authorization rely on controller_path even if the model
18
+ # class is named differently (or sits in another namespace) model and controller are handled separatly here.
19
+ # Therefore "resource" always refers to the controller_path whereas "model" refers to the model class.
20
+ #
21
+ # == Skip attributes
22
+ #
23
+ # Usually you don't want your users to edit all attributes provided by a model. Hence some default attributes,
24
+ # namely id, updated_at, created_at, creator_id and updater_id are not returned by Resource#attributes.
25
+ #
26
+ # If you want to skip a different set of attributes just define a skip_attributes class method in your model class
27
+ # that returns an array of strings: %W[id, updated_at]
28
+ #
29
+ # == Resource relations
30
+ #
31
+ # Alchemy::Resource can take care of ActiveRecord relations. You will have to announce relations by defining a
32
+ # resource_relations class method in your model class that returns a hash like this:
33
+ #
34
+ # {
35
+ # :location_id => {:attr_method => "location#name", :attr_type => :string},
36
+ # :organizer_id => {:attr_method => "organizer#name", :attr_type => :string}
37
+ # }
38
+ #
39
+ # With this knowledge Resource#attributes will return location#name and organizer#name instead of location_id
40
+ # and organizer_id. Refer to Alchemy::ResourcesController for further details on usage.
41
+ #
42
+ # == Creation
43
+ #
44
+ # Resource needs a controller_path at least. Without other arguments it will guess the model name from it and assume
45
+ # that the model doesn't live in an engine. Moreover model and controller has to follow Rails' naming convention:
46
+ #
47
+ # Event -> EventsController
48
+ #
49
+ # It will also strip "admin" automatically, so this is also valid:
50
+ #
51
+ # Event -> Admin::EventsController
52
+ #
53
+ # If your Resource and it's controllers are part of an engine you need to provide Alchemy's module_definition,
54
+ # so resource can provide the correct url_proxy. If you don't declare it in Alchemy, you need at least provide the
55
+ # following hash (i.e. if your engine is named EventEngine):
56
+ #
57
+ # resource = Resource.new(controller_path, {"engine_name" => "event_engine"})
58
+ #
59
+ # If you don't want to stick with these conventions you can separate model and controller by providing
60
+ # a model class (for example used by Alchemy's Tags admin interface):
61
+ #
62
+ # resource = Resource.new('/admin/tags', {"engine_name"=>"alchemy"}, ActsAsTaggableOn::Tag)
63
+ #
5
64
  class Resource
6
-
7
- attr_accessor :skip_attributes, :resource_relations
65
+ attr_accessor :skip_attributes, :resource_relations, :model_associations
66
+ attr_reader :model
8
67
 
9
68
  DEFAULT_SKIPPED_ATTRIBUTES = %W[id updated_at created_at creator_id updater_id]
69
+ DEFAULT_SKIPPED_ASSOCIATIONS = %w(creator updater)
10
70
 
11
- def initialize(controller_path, module_definition=nil)
71
+ def initialize(controller_path, module_definition=nil, custom_model=nil)
12
72
  @controller_path = controller_path
13
73
  @module_definition = module_definition
74
+ @model = (custom_model or guess_model_from_controller_path)
14
75
  self.skip_attributes = model.respond_to?(:skip_attributes) ? model.skip_attributes : DEFAULT_SKIPPED_ATTRIBUTES
15
- self.resource_relations = model.resource_relations if model.respond_to?(:resource_relations)
76
+ if model.respond_to?(:resource_relations)
77
+ if not model.respond_to?(:reflect_on_all_associations)
78
+ raise MissingActiveRecordAssociation
79
+ end
80
+ store_model_associations
81
+ map_relations
82
+ end
16
83
  end
17
84
 
18
- def model_array
19
- model_array = controller_path_array
20
- model_array.delete("admin")
21
- model_array
85
+ def resource_array
86
+ @_resource_array ||= controller_path_array.reject { |el| el == 'admin' }
22
87
  end
23
88
 
24
- def model
25
- @_model ||= model_array.join('/').classify.constantize
89
+ def resources_name
90
+ @_resources_name ||= resource_array.last
26
91
  end
27
92
 
28
- def resources_name
29
- @_resources_name ||= model_array.last
93
+ def resource_name
94
+ @_resource_name ||= resources_name.singularize
30
95
  end
31
96
 
32
97
  def model_name
33
- @_model_name ||= resources_name.singularize
98
+ ActiveSupport::Deprecation.warn("model_name is deprecated. Please use resource_name instead!")
99
+ resource_name
100
+ end
101
+
102
+ def namespaced_resource_name
103
+ return @_namespaced_resource_name unless @_namespaced_resource_name.nil?
104
+ resource_name_array = resource_array
105
+ resource_name_array.delete(engine_name) if in_engine?
106
+ @_namespaced_resource_name = resource_name_array.join('_').singularize
107
+ end
108
+
109
+ def namespaced_model_name
110
+ ActiveSupport::Deprecation.warn("namespaced_model_name is deprecated. Please use namespaced_resource_name instead!")
111
+ namespaced_resource_name
34
112
  end
35
113
 
36
114
  def permission_scope
@@ -46,21 +124,20 @@ module Alchemy
46
124
 
47
125
  def attributes
48
126
  @_attributes ||= self.model.columns.collect do |col|
49
- {:name => (resource_relation_name(col.name) || col.name), :type => (resource_relation_type(col.name) || col.type)} unless self.skip_attributes.include?(col.name)
127
+ unless self.skip_attributes.include?(col.name)
128
+ { :name => col.name, :type => resource_relation_type(col.name) || col.type, :relation => resource_relation(col.name) }.delete_if { |k, v | v.nil? }
129
+ end
50
130
  end.compact
51
131
  end
52
132
 
133
+ # Returns all columns that are searchable
134
+ #
135
+ # For now it only uses string type columns
136
+ #
53
137
  def searchable_attributes
54
138
  self.attributes.select { |a| a[:type] == :string }
55
139
  end
56
140
 
57
- def namespaced_model_name
58
- return @_namespaced_model_name unless @_namespaced_model_name.nil?
59
- model_name_array = self.model_array
60
- model_name_array.delete(self.engine_name) if in_engine?
61
- @_namespaced_model_name = model_name_array.join('_').singularize
62
- end
63
-
64
141
  def in_engine?
65
142
  not self.engine_name.nil?
66
143
  end
@@ -76,27 +153,28 @@ module Alchemy
76
153
  # de:
77
154
  # alchemy:
78
155
  # resource_help_texts:
79
- # my_resource_model_name:
156
+ # my_resource_name:
80
157
  # attribute_name: This is the fancy help text
81
158
  #
82
159
  def help_text_for(attribute)
83
- ::I18n.translate!(attribute[:name], :scope => [:alchemy, :resource_help_texts, model_name])
160
+ ::I18n.translate!(attribute[:name], :scope => [:alchemy, :resource_help_texts, resource_name])
84
161
  rescue ::I18n::MissingTranslationData
85
162
  false
86
163
  end
87
164
 
88
- protected
165
+
166
+ private
167
+
168
+ def guess_model_from_controller_path
169
+ resource_array.join('/').classify.constantize
170
+ end
89
171
 
90
172
  def controller_path_array
91
173
  @controller_path.split('/')
92
174
  end
93
175
 
94
176
  def namespace_diff
95
- controller_path_array - model_array
96
- end
97
-
98
- def resource_relation_name(column_name)
99
- resource_relation(column_name).try(:[], :attr_method)
177
+ controller_path_array - resource_array
100
178
  end
101
179
 
102
180
  def resource_relation_type(column_name)
@@ -107,5 +185,30 @@ module Alchemy
107
185
  resource_relations[column_name.to_sym] if resource_relations
108
186
  end
109
187
 
188
+ # Expands the resource_relations hash with matching activerecord associations data.
189
+ def map_relations
190
+ self.resource_relations = {}
191
+ model.resource_relations.each do |name, options|
192
+ name = name.to_s.gsub(/_id$/, '') # ensure that we don't have an id
193
+ association = association_from_relation_name(name)
194
+ foreign_key = association.options[:foreign_key] || "#{association.name}_id".to_sym
195
+ if options[:attr_method].to_s =~ /#/
196
+ ActiveSupport::Deprecation.warn('Old style :attr_method used in Alchemy::Ressource#resource_relations. Please remove the # and pass column name only.', caller[2..10])
197
+ options[:attr_method] = options[:attr_method].split('#').last
198
+ end
199
+ self.resource_relations[foreign_key] = options.merge(:model_association => association, :name => name)
200
+ end
201
+ end
202
+
203
+ # Stores all activerecord associations in model_associations attribute
204
+ def store_model_associations
205
+ self.model_associations = model.reflect_on_all_associations.delete_if { |a| DEFAULT_SKIPPED_ASSOCIATIONS.include?(a.name.to_s) }
206
+ end
207
+
208
+ # Returns activerecord association that has the given name
209
+ def association_from_relation_name(name)
210
+ model_associations.detect { |a| a.name == name.to_sym }
211
+ end
212
+
110
213
  end
111
214
  end
@@ -1,12 +1,18 @@
1
1
  module Alchemy
2
2
  module ResourcesHelper
3
+ # = Alchemy::ResourceHelper
4
+ #
5
+ # Used to DRY up resource like structures in Alchemy's admin backend in combination with Alchemy::Resource
6
+ #
7
+ # See Alchemy::Resource for examples how to initialize a resource_handler
8
+ #
3
9
 
4
10
  def resource_window_size
5
11
  @resource_window_size ||= "420x#{100 + resource_handler.attributes.length * 40}"
6
12
  end
7
13
 
8
14
  def resource_instance_variable
9
- instance_variable_get("@#{resource_handler.model_name}")
15
+ instance_variable_get("@#{resource_handler.resource_name}")
10
16
  end
11
17
 
12
18
  def resources_instance_variable
@@ -25,20 +31,21 @@ module Alchemy
25
31
  @_resource_scope ||= [resource_url_proxy].concat(resource_handler.namespace_for_scope)
26
32
  end
27
33
 
28
- def resources_path(resource=resource_handler.model, options={})
29
- polymorphic_path (resource_scope + [resource]), options
34
+ def resources_path(resource_or_name=resource_handler.resources_name, options={})
35
+ polymorphic_path (resource_scope + [resource_or_name]), options
30
36
  end
31
37
 
32
- def resource_path(resource=resource_handler.model, options={})
38
+ def resource_path(resource=resource_handler.resource_name, options={})
33
39
  resources_path(resource, options)
34
40
  end
35
41
 
36
42
  def new_resource_path(options={})
37
- new_polymorphic_path (resource_scope + [resource_handler.model]), options
43
+ new_polymorphic_path (resource_scope + [resource_handler.resource_name]), options
38
44
  end
39
45
 
40
46
  def edit_resource_path(resource=nil, options={})
41
- edit_polymorphic_path (resource_scope+([resource] or model_array)), options
47
+ path_segments = (resource_scope + [resource] or resource_handler.resource_array)
48
+ edit_polymorphic_path path_segments, options
42
49
  end
43
50
 
44
51
  def resource_permission_scope
@@ -46,19 +53,43 @@ module Alchemy
46
53
  end
47
54
 
48
55
  def resource_model_name
49
- resource_handler.model_name
56
+ ActiveSupport::Deprecation.warn("resource_model_name is deprecated. Please use resource_name instead!")
57
+ resource_handler.resource_name
58
+ end
59
+
60
+ def resource_name
61
+ resource_handler.resource_name
50
62
  end
51
63
 
52
64
  def resource_model
53
65
  resource_handler.model
54
66
  end
55
67
 
56
- def render_attribute(obj, attribute)
57
- attr_array = attribute.split('.')
58
- attr_array.each do |attr|
59
- obj = obj.send(attr) if obj
68
+ # Returns the value from resource attribute
69
+ #
70
+ # If the attribute has a relation, the related object's attribute value will be returned.
71
+ #
72
+ # The output will be truncated after 50 chars.
73
+ #
74
+ # @param [Alchemy::Resource] resource
75
+ # @param [Hash] attribute
76
+ # @option options [Hash] :truncate (50) The length of the value returned.
77
+ #
78
+ # @return [String]
79
+ #
80
+ def render_attribute(resource, attribute, options={})
81
+ options.reverse_merge!(truncate: 50)
82
+ value = resource.send(attribute[:name])
83
+ if (relation = attribute[:relation]) && value.present?
84
+ record = relation[:model_association].klass.find(value)
85
+ value = record.send(relation[:attr_method])
86
+ elsif attribute[:type] == :datetime && value.present?
87
+ value = l(value)
60
88
  end
61
- obj
89
+ value.to_s.truncate(options[:truncate])
90
+ rescue ActiveRecord::RecordNotFound => e
91
+ warning e
92
+ _t(:not_found)
62
93
  end
63
94
 
64
95
  def resource_help_text(attribute)
@@ -67,5 +98,43 @@ module Alchemy
67
98
  end
68
99
  end
69
100
 
101
+ # Renders the human model name with a count as h1 header
102
+ def resources_header
103
+ content_tag :h1, "#{resources_instance_variable.total_count} #{resource_model.model_name.human(:count => resources_instance_variable.total_count)}"
104
+ end
105
+
106
+ # Returns true if the resource contains any relations
107
+ def contains_relations?
108
+ resource_handler.resource_relations.present?
109
+ end
110
+
111
+ # Returns an array of all resource_relations names
112
+ def resource_relations_names
113
+ resource_handler.resource_relations.collect { |k, v| v[:name].to_sym }
114
+ end
115
+
116
+ # Returns the attribute's column for sorting
117
+ #
118
+ # If the attribute contains a resource_relation, then the table and column for related model will be returned.
119
+ #
120
+ def sortable_resource_header_column(attribute)
121
+ if relation = attribute[:relation]
122
+ "#{relation[:model_association].table_name}.#{relation[:attr_method]}"
123
+ else
124
+ attribute[:name]
125
+ end
126
+ end
127
+
128
+ # Returns resource relations options hash for a rails select helper.
129
+ #
130
+ # @param [Hash] relation
131
+ # @returns Hash
132
+ #
133
+ def options_for_resource_relation_select(relation)
134
+ relation[:model_association].klass.all.collect do |r|
135
+ [r.send(relation[:attr_method]), r.id]
136
+ end
137
+ end
138
+
70
139
  end
71
140
  end
@@ -1,191 +1,29 @@
1
- require 'fileutils'
2
- require 'active_record'
3
-
4
1
  module Alchemy
5
2
  class Upgrader < Alchemy::Seeder
6
-
7
3
  class << self
8
4
 
9
- # Runs all ugrades
5
+ # Runs ugrades
6
+ #
7
+ # Set UPGRADE env variable to only run a specific task.
10
8
  def run!
11
- Rake::Task['alchemy:install:migrations'].invoke
12
- strip_alchemy_from_schema_version_table
13
- Rake::Task['db:migrate'].invoke
14
- Seeder.seed!
15
- upgrade_to_language
16
- upgrade_layoutpages
17
- upgrade_essence_link_target_default
18
- upgrade_to_namespaced_essence_type
19
- convert_essence_texts_displayed_as_select_into_essence_selects
20
- convert_essence_texts_displayed_as_checkbox_into_essence_booleans
21
- copy_new_config_file
22
- gallery_pictures_change_notice
23
- removed_richmedia_essences_notice
24
- convert_picture_storage
25
- removed_standard_set_notice
26
- renamed_t_method
27
- migrated_to_devise
28
-
29
- display_todos
30
- end
31
-
32
- private
33
-
34
- # Creates Language model if it does not exist (Alchemy CMS prior v1.5)
35
- # Also creates missing associations between pages and languages
36
- def upgrade_to_language
37
- desc "Creating languages for pages"
38
- Alchemy::Page.all.each do |page|
39
- if !page.language_code.blank? && page.language.nil?
40
- root = page.get_language_root
41
- lang = Alchemy::Language.find_or_create_by_language_code(
42
- :name => page.language_code.capitalize,
43
- :code => page.language_code,
44
- :frontpage_name => root.name,
45
- :page_layout => root.page_layout,
46
- :public => true
47
- )
48
- page.language = lang
49
- if page.save(:validate => false)
50
- log "Set language for page #{page.name} to #{lang.name}."
51
- end
52
- else
53
- log("Language for page #{page.name} already set.", :skip)
54
- end
55
- end
56
- end
57
-
58
- def upgrade_layoutpages
59
- desc "Setting language of layoutpages"
60
- default_language = Alchemy::Language.get_default
61
- layoutpages = Alchemy::Page.layoutpages
62
- if layoutpages.any?
63
- layoutpages.each do |page|
64
- if page.language.class == String || page.language.nil?
65
- page.language = default_language
66
- if page.save(:validate => false)
67
- log "Set language for page #{page.name} to #{default_language.name}."
68
- end
69
- else
70
- log "Language for page #{page.name} already set.", :skip
71
- end
9
+ if ENV['UPGRADE']
10
+ ENV['UPGRADE'].split(',').each do |task|
11
+ self.send(task)
72
12
  end
73
13
  else
74
- log "No layoutpages found.", :skip
14
+ run_all
75
15
  end
16
+ display_todos
76
17
  end
77
18
 
78
- def upgrade_essence_link_target_default
79
- desc "Setting new link_target default"
80
- essences = (Alchemy::EssencePicture.all + Alchemy::EssenceText.all)
81
- if essences.any?
82
- essences.each do |essence|
83
- case essence.link_target
84
- when '1'
85
- if essence.update_column(:link_target, 'blank')
86
- log("Updated #{essence.preview_text} link target to #{essence.link_target}.")
87
- end
88
- when '0'
89
- essence.update_column(:link_target, nil)
90
- log("Updated #{essence.preview_text} link target to #{essence.link_target.inspect}.")
91
- else
92
- log("#{essence.preview_text} already upgraded.", :skip)
93
- end
94
- end
95
- else
96
- log("No essences to upgrade found.", :skip)
97
- end
98
- end
99
-
100
- # Updates all essence_type of Content if not already namespaced.
101
- def upgrade_to_namespaced_essence_type
102
- desc "Namespacing essence_type columns"
103
- depricated_contents = Alchemy::Content.where("essence_type LIKE ?", "Essence%")
104
- if depricated_contents.any?
105
- success = 0
106
- errors = []
107
- depricated_contents.each do |c|
108
- if c.update_column(:essence_type, c.essence_type.gsub(/^Essence/, 'Alchemy::Essence'))
109
- success += 1
110
- else
111
- errors << c.errors.full_messages
112
- end
113
- end
114
- log("Namespaced #{success} essence_type columns.") if success > 0
115
- log("#{errors.count} errors while namespacing essence_type columns.\n#{errors.join('\n')}", :error) if errors.count > 0
116
- else
117
- log "No essence_type columns to be namespaced found.", :skip
118
- end
119
- end
120
-
121
- def strip_alchemy_from_schema_version_table
122
- desc "Strip -alchemy suffix from schema_version table."
123
- database_yml = YAML.load_file(Rails.root.join("config", "database.yml"))
124
- adapter = ActiveRecord::Base.establish_connection(database_yml.fetch(Rails.env.to_s).symbolize_keys)
125
- adapter.connection.update("UPDATE schema_migrations SET version = REPLACE(`schema_migrations`.`version`,'-alchemy','')")
126
- end
127
-
128
- def convert_essence_texts_displayed_as_select_into_essence_selects
129
- desc "Converting EssenceTexts displayed as select into EssenceSelects"
130
- contents_found = 0
131
- elements = Alchemy::Element.descriptions.select { |e| e['contents'].present? && !e['contents'].detect { |c| c['settings'].present? && c['settings']['display_as'] == 'select' }.nil? }
132
- contents = elements.collect { |el| el['contents'] }.flatten.select { |c| c['settings'] && c['settings']['display_as'] == 'select' }.flatten
133
- content_names = contents.collect { |c| c['name'] }
134
- Alchemy::Content.essence_texts.where(
135
- :name => content_names,
136
- :alchemy_elements => {:name => elements.collect { |e| e['name'] }}
137
- ).joins(:element).each do |content|
138
- new_content = Alchemy::Content.new(:name => content.name, :element_id => content.element.id)
139
- if new_content.create_essence!('name' => content.name, 'type' => 'EssenceSelect')
140
- new_content.essence.value = content.ingredient
141
- if new_content.essence.save
142
- contents_found += 1
143
- log "Converted #{content.name}'s essence_type into EssenceSelect"
144
- content.destroy
145
- else
146
- log "Could not save essence: #{new_content.essence.errors.full_messages.join(', ')}", :error
147
- end
148
- else
149
- log "Could not create content: #{new_content.errors.full_messages.join(', ')}", :error
150
- end
151
- end
152
- if contents_found > 0
153
- todo "Please open your elements.yml file and change all type values from these contents:\n\n#{content_names.join(', ')}\n\ninto EssenceSelect."
154
- else
155
- log "No EssenceTexts with display_as select setting found.", :skip
156
- end
19
+ def run_all
20
+ Rake::Task['alchemy:install:migrations'].invoke
21
+ Rake::Task['db:migrate'].invoke
22
+ Seeder.seed!
23
+ copy_new_config_file
157
24
  end
158
25
 
159
- def convert_essence_texts_displayed_as_checkbox_into_essence_booleans
160
- desc "Converting EssenceTexts displayed as checkbox into EssenceBooleans"
161
- contents_found = 0
162
- elements = Alchemy::Element.descriptions.select { |e| e['contents'].present? && !e['contents'].detect { |c| c['settings'].present? && c['settings']['display_as'] == 'checkbox' }.nil? }
163
- contents = elements.collect { |el| el['contents'] }.flatten.select { |c| c['settings'] && c['settings']['display_as'] == 'checkbox' }.flatten
164
- content_names = contents.collect { |c| c['name'] }
165
- Alchemy::Content.essence_texts.where(
166
- :name => content_names,
167
- :alchemy_elements => {:name => elements.collect { |e| e['name'] }}
168
- ).joins(:element).each do |content|
169
- new_content = Alchemy::Content.new(:name => content.name, :element_id => content.element.id)
170
- if new_content.create_essence!('name' => content.name, 'type' => 'EssenceBoolean')
171
- new_content.essence.value = content.ingredient
172
- if new_content.essence.save
173
- contents_found += 1
174
- log "Converted #{content.name}'s essence_type into EssenceBoolean"
175
- content.destroy
176
- else
177
- log "Could not save essence: #{new_content.essence.errors.full_messages.join(', ')}", :error
178
- end
179
- else
180
- log "Could not create content: #{new_content.errors.full_messages.join(', ')}", :error
181
- end
182
- end
183
- if contents_found > 0
184
- todo "Please open your elements.yml file and change all type values from these contents:\n\n#{content_names.join(', ')}\n\ninto EssenceBoolean."
185
- else
186
- log "No EssenceTexts with display_as checkbox setting found.", :skip
187
- end
188
- end
26
+ private
189
27
 
190
28
  def copy_new_config_file
191
29
  desc "Copy configuration file."
@@ -201,106 +39,6 @@ module Alchemy
201
39
  end
202
40
  end
203
41
 
204
- def gallery_pictures_change_notice
205
- txt = ["We have changed the way Alchemy handles EssencePictures in elements."]
206
- txt << "It is now possible to have single EssencePictures and galleries side by side in the same element."
207
- txt << "All element editor views containing render_picture_editor with option `maximum_amount_of_images => 1` must be changed into render_essence_editor_by_name."
208
- txt << "In the yml description of these elements add a new content for this picture."
209
- txt << "\nIn order to upgrade your elements in the database run:"
210
- txt << "\nrails g alchemy:gallery_pictures_migration\n"
211
- txt << "and alter `db/seeds.rb`, so that it contains all elements that have essence pictures."
212
- todo txt.join("\n")
213
- end
214
-
215
- def removed_richmedia_essences_notice
216
- warn = <<-WARN
217
- We removed the EssenceAudio, EssenceFlash and EssenceVideo essences from Alchemy core!
218
- In order to get the essences back, install the `alchemy-richmedia-essences` gem.
219
-
220
- gem 'alchemy-richmedia-essences'
221
-
222
- We left the tables in your database, you can simply drop them if you don't use these essences in your project.
223
-
224
- drop_table :alchemy_essence_audios
225
- drop_table :alchemy_essence_flashes
226
- drop_table :alchemy_essence_videos
227
- WARN
228
- todo warn
229
- end
230
-
231
- def convert_picture_storage
232
- desc "Convert the picture storage"
233
- converted_images = []
234
- images = Dir.glob Rails.root.join 'uploads/pictures/**/*.*'
235
- if images.blank?
236
- log "No pictures found", :skip
237
- else
238
- images.each do |image|
239
- image_uid = image.gsub(/#{Rails.root.to_s}\/uploads\/pictures\//, '')
240
- image_id = image_uid.split('/').last.split('.').first
241
- picture = Alchemy::Picture.find_by_id(image_id)
242
- if picture && picture.image_file_uid.blank?
243
- picture.image_file_uid = image_uid
244
- picture.image_file_size = File.new(image).size
245
- if picture.save!
246
- log "Converted #{image_uid}"
247
- end
248
- else
249
- log "Picture with id #{image_id} not found or already converted.", :skip
250
- end
251
- end
252
- end
253
- end
254
-
255
- def removed_standard_set_notice
256
- warn = <<-WARN
257
- We removed the standard set from Alchemy core!
258
- In order to get the standard set back, install the `alchemy-demo_kit` gem.
259
- WARN
260
- todo warn
261
- end
262
-
263
- def renamed_t_method
264
- warn = <<-WARN
265
- We renamed alchemy's `t` method override into `_t` to avoid conflicts with Rails own t method!
266
- If you use the `t` method to translate alchemy scoped keys, then you have to use the `_t` method from now on.
267
- WARN
268
- todo warn
269
- end
270
-
271
- def migrated_to_devise
272
- warn = <<-WARN
273
- We changed the authentication provider from Authlogic to Devise.
274
-
275
- If you are upgrading from an old Alchemy version < 2.5.0, then you have to make changes to your Devise configuration.
276
-
277
- 1. Run:
278
-
279
- $ rails g alchemy:devise
280
-
281
- And alter the encryptor to authlogic_sha512
282
- and the stretches value from 10 to 20
283
-
284
- # config/initializers/devise.rb
285
- config.stretches = Rails.env.test? ? 1 : 20
286
- config.encryptor = :authlogic_sha512
287
-
288
- 2. Add the encryptable module to your Alchemy config.yml:
289
-
290
- # config/alchemy/config.yml
291
- devise_modules:
292
- - :database_authenticatable
293
- - :trackable
294
- - :validatable
295
- - :timeoutable
296
- - :recoverable
297
- - :encryptable
298
-
299
- WARN
300
- todo warn
301
- end
302
-
303
42
  end
304
-
305
43
  end
306
44
  end