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
@@ -1,5 +1,6 @@
1
1
  require 'rspec'
2
2
  require File.dirname(__FILE__) + '/../../lib/alchemy/resource'
3
+ require File.dirname(__FILE__) + '/../../lib/alchemy/errors'
3
4
 
4
5
  class Event
5
6
  end
@@ -16,126 +17,264 @@ module Namespace
16
17
  end
17
18
  end
18
19
 
19
- module Engine
20
+ module EventEngine
20
21
  module Namespace
21
22
  class Event
22
23
  end
23
24
  end
24
25
  end
25
26
 
27
+ # Alchemy's standard module definition. Only engine_name is relevant here
28
+ def module_definition
29
+ {
30
+ "name" => "event_list",
31
+ "engine_name" => "event_engine",
32
+ "navigation" => {
33
+ "name" => "modules.event_list",
34
+ "controller" => "admin/events",
35
+ "action" => "index",
36
+ "image" => "/assets/event_list_module.png"
37
+ }
38
+ }
39
+ end
40
+
26
41
  module Alchemy
27
42
  describe Resource do
28
43
 
29
- it "is initialized with a controller_path" do
30
- resource = Resource.new("admin/events")
31
- resource.should be_a Resource
32
- end
33
- it "can be can be initialized with an alchemy module_definition" do
34
- resource = Resource.new("admin/events", {'engine_name' => 'engine'})
35
- resource.should be_a Resource
44
+ before :each do
45
+ # stubbing an ActiveRecord::ModelSchema...
46
+ columns = [
47
+ mock(:column, {:name => 'name', :type => :string}),
48
+ mock(:column, {:name => 'hidden_value', :type => :string}),
49
+ mock(:column, {:name => 'description', :type => :string}),
50
+ mock(:column, {:name => 'id', :type => :integer}),
51
+ mock(:column, {:name => 'starts_at', :type => :datetime}),
52
+ mock(:column, {:name => 'location_id', :type => :integer}),
53
+ mock(:column, {:name => 'organizer_id', :type => :integer}),
54
+ ]
55
+ Event.stub(:columns).and_return columns
56
+ #Alchemy::Config.stub(:get).and_return {}
36
57
  end
37
58
 
38
- describe "model_array" do
39
- it "splits the controller_path and returns it as array." do
40
- resource = Resource.new("namespace1/namespace2/events")
41
- resource.model_array.should eql(['namespace1', 'namespace2', 'events'])
42
- end
59
+ describe "#initialize" do
43
60
 
44
- it "deletes 'admin' if found hence our model isn't in the admin-namespace by convention" do
61
+ it "should set an instance variable that holds the controller path" do
45
62
  resource = Resource.new("admin/events")
46
- resource.model_array.should eql(['events'])
63
+ resource.instance_variable_get(:@controller_path).should == "admin/events"
47
64
  end
48
- end
49
65
 
50
- describe "instance methods" do
51
- let(:resource) { Resource.new("admin/events") }
66
+ context "when initialized with a module definition" do
67
+ it "sets an instance variable that holds the module definition" do
68
+ resource = Resource.new("admin/events", module_definition)
69
+ resource.instance_variable_get(:@module_definition).should == module_definition
70
+ end
71
+ end
52
72
 
53
- describe "model" do
54
- it "returns resource's model-class" do
55
- resource.model.should be(Event)
73
+ context "when initialized with a custom model" do
74
+ it "sets @model to custom model" do
75
+ CustomEvent = Class.new
76
+ resource = Resource.new("admin/events", nil, CustomEvent)
77
+ resource.instance_variable_get(:@model).should == CustomEvent
56
78
  end
79
+ end
57
80
 
58
- describe "resources_name" do
59
- it "returns plural name (like events for model Event)" do
60
- resource.resources_name.should == 'events'
61
- end
81
+ context "when initialized without custom model" do
82
+ it "guesses the model by the controller_path" do
83
+ resource = Resource.new("admin/events", nil, nil)
84
+ resource.instance_variable_get(:@model).should == Event
62
85
  end
86
+ end
63
87
 
64
- describe "model_name" do
65
- it "returns model_name (like event for model Event" do
66
- resource.model_name.should == 'event'
88
+ context "when model has resource_relations defined" do
89
+ before do
90
+ Event.class_eval do
91
+ def self.resource_relations
92
+ {location: {attr_method: 'name', type: 'string'}}
93
+ end
67
94
  end
95
+ Event.stub!(:respond_to?).and_return { |arg|
96
+ case arg
97
+ when :reflect_on_all_associations
98
+ then false
99
+ when :resource_relations
100
+ then true
101
+ end
102
+ }
68
103
  end
69
104
 
70
- describe "permission_scope" do
71
- it "should return the permissions_scope usable in declarative authorization" do
72
- resource.permission_scope.should == :admin_events
105
+ context ", but not an ActiveRecord association" do
106
+ it "should raise error." do
107
+ expect { Resource.new("admin/events") }.to raise_error(MissingActiveRecordAssociation)
73
108
  end
74
109
  end
75
110
 
76
- describe "namespace_for_scope" do
77
- it "returns a scope for use in url_for-based path-helpers" do
78
- resource.namespace_for_scope.should == ['admin']
111
+ after do
112
+ Event.class_eval do
113
+ class << self
114
+ undef resource_relations
115
+ end
79
116
  end
80
117
  end
118
+ end
81
119
 
82
- describe "attributes" do
83
- before :each do
84
- ##stubbing an ActiveRecord::ModelSchema...
85
- columns = [
86
- mock(:column, {:name => 'name', :type => :string}),
87
- mock(:column, {:name => 'hidden_value', :type => :string}),
88
- mock(:column, {:name => 'description', :type => :string}),
89
- mock(:column, {:name => 'id', :type => :integer}),
90
- mock(:column, {:name => 'starts_at', :type => :datetime}),
91
- ]
92
- Event.stub(:columns).and_return columns
93
- Config.stub(:get).and_return {}
94
- end
120
+ end
95
121
 
96
- it "parses and returns the resource-model's attributes from ActiveRecord::ModelSchema" do
97
- resource.attributes.should == [{:name => "name", :type => :string}, {:name => "hidden_value", :type => :string}, {:name => "description", :type => :string}, {:name => "starts_at", :type => :datetime}]
98
- end
122
+ describe "#resource_array" do
99
123
 
100
- it "skips a set of default attributes (DEFAULT_SKIPPED_ATTRIBUTES)" do
101
- resource.attributes.should_not include({:name => "id", :type => :integer})
102
- resource.attributes.should include({:name => "hidden_value", :type => :string})
103
- end
124
+ it "splits the controller_path and returns it as array." do
125
+ resource = Resource.new("namespace1/namespace2/events")
126
+ resource.resource_array.should eql(%W[namespace1 namespace2 events])
127
+ end
104
128
 
105
- it "should skip attributes set via skip_attributes" do
106
- resource.skip_attributes = %W[hidden_value]
107
- resource.attributes.should include({:name => "id", :type => :integer})
108
- resource.attributes.should_not include({:name => "hidden_value", :type => :string})
109
- end
129
+ it "deletes 'admin' if found hence our model isn't in the admin-namespace by convention" do
130
+ resource = Resource.new("admin/events")
131
+ resource.resource_array.should eql(%W[events])
132
+ end
110
133
 
111
- describe "searchable_attributes" do
112
- it "should return all attributes of type string" do
113
- resource.skip_attributes = []
114
- resource.searchable_attributes.should == [{:name => "name", :type => :string}, {:name => "hidden_value", :type => :string}, {:name => "description", :type => :string}]
115
- end
116
- end
117
- end
134
+ end
135
+
136
+ describe "#model" do
137
+ it "returns the @model instance variable" do
138
+ resource = Resource.new("admin/events")
139
+ resource.model.should == resource.instance_variable_get(:@model)
140
+ end
141
+ end
142
+
143
+ describe "#resources_name" do
144
+ it "returns plural name (like events for model Event)" do
145
+ resource = Resource.new("admin/events")
146
+ resource.resources_name.should == "events"
147
+ end
148
+ end
149
+
150
+ describe "#resource_name" do
151
+ it "returns the resources name as singular" do
152
+ resource = Resource.new("admin/events")
153
+ resource.resource_name.should == "event"
154
+ end
155
+ end
156
+
157
+ describe "#model_name" do
158
+ it "is deprecated" do
159
+ ActiveSupport::Deprecation.should_receive(:warn)
160
+ Resource.new("admin/events").model_name
161
+ end
162
+ end
163
+
164
+ describe "#namespaced_resource_name" do
165
+
166
+ it "returns resource_name with namespace (namespace_event for Namespace::Event), i.e. for use in forms" do
167
+ namespaced_resource = Resource.new("admin/namespace/events")
168
+ namespaced_resource.namespaced_resource_name.should == 'namespace_event'
169
+ end
170
+
171
+ it "equals resource_name if resource not namespaced" do
172
+ namespaced_resource = Resource.new("admin/events")
173
+ namespaced_resource.namespaced_resource_name.should == 'event'
174
+ end
175
+
176
+ it "doesn't include the engine's name" do
177
+ namespaced_resource = Resource.new("admin/event_engine/namespace/events", module_definition)
178
+ namespaced_resource.namespaced_resource_name.should == 'namespace_event'
179
+ end
180
+
181
+ end
118
182
 
183
+ describe "#engine_name" do
184
+ it "should return the engine name of the module" do
185
+ resource = Resource.new("admin/event_engine/namespace/events", module_definition)
186
+ resource.engine_name.should == "event_engine"
119
187
  end
188
+ end
120
189
 
121
- describe "namespaced_model_name" do
190
+ describe "#permission_scope" do
191
+ it "returns a permission_scope usable in declarative authorization" do
192
+ resource = Resource.new("admin/events")
193
+ resource.permission_scope.should == :admin_events
194
+ end
195
+ end
196
+
197
+ describe "#namespace_for_scope" do
198
+ it "returns a scope for use in url_for-based path-helpers" do
199
+ resource = Resource.new("admin/events")
200
+ resource.namespace_for_scope.should == %W[admin]
201
+ end
202
+ end
122
203
 
123
- it "returns model_name with namespace (namespace_event for Namespace::Event), i.e. for use in forms" do
124
- namespaced_resource = Resource.new("admin/namespace/events")
125
- namespaced_resource.namespaced_model_name.should == 'namespace_event'
204
+ describe "#attributes" do
205
+ let(:resource) { Resource.new("admin/events") }
206
+
207
+ it "parses and returns the resource-model's attributes from ActiveRecord::ModelSchema" do
208
+ resource.attributes.should == [
209
+ {:name => "name", :type => :string},
210
+ {:name => "hidden_value", :type => :string},
211
+ {:name => "description", :type => :string},
212
+ {:name => "starts_at", :type => :datetime},
213
+ {:name => "location_id", :type => :integer},
214
+ {:name => "organizer_id", :type => :integer},
215
+ ]
216
+ end
217
+
218
+ it "skips attributes returned by skip_attributes" do
219
+ # attr_accessor, hence skip_attributes= works
220
+ resource.skip_attributes = %W[hidden_value]
221
+ resource.attributes.should include({:name => "id", :type => :integer})
222
+ resource.attributes.should_not include({:name => "hidden_value", :type => :string})
223
+ end
224
+ end
225
+
226
+
227
+ describe "#skip_attributes" do
228
+ let(:resource) { Resource.new("admin/events") }
229
+
230
+ it "returns a set of default attributes (Rails' default database attributes)" do
231
+ # read from Resource::DEFAULT_SKIPPED_ATTRIBUTES
232
+ default_skipped_attributes = %W[id updated_at created_at creator_id updater_id]
233
+ resource.skip_attributes = default_skipped_attributes
234
+ end
235
+
236
+ context "when skip_attributes is defined as class-method in the model" do
237
+ before do
238
+ Event.class_eval do
239
+ def self.skip_attributes
240
+ %W[hidden_name]
241
+ end
242
+ end
243
+ end
244
+ after do
245
+ Event.class_eval do
246
+ class << self
247
+ undef skip_attributes
248
+ end
249
+ end
126
250
  end
127
251
 
128
- it "should not include the engine's name" do
129
- namespaced_resource = Resource.new("admin/engine/namespace/events", {'engine_name' => 'engine'})
130
- namespaced_resource.namespaced_model_name.should == 'namespace_event'
252
+ it "returns the result of Model.skip_attributes" do
253
+ custom_skipped_attributes = %W[hidden_name]
254
+ resource.skip_attributes = custom_skipped_attributes
131
255
  end
132
256
 
133
- it "should equal model_name if model not namespaced" do
134
- namespaced_resource = Resource.new("admin/events")
135
- namespaced_resource.namespaced_model_name.should == namespaced_resource.model_name
257
+ end
258
+
259
+ describe "#searchable_attributes" do
260
+ it "returns all attributes of type string" do
261
+ resource = Resource.new("admin/events")
262
+ resource.skip_attributes = []
263
+ resource.searchable_attributes.should == [
264
+ {:name => "name", :type => :string},
265
+ {:name => "hidden_value", :type => :string},
266
+ {:name => "description", :type => :string}
267
+ ]
136
268
  end
137
269
  end
138
270
 
271
+ describe "#namespaced_model_name" do
272
+ it "is deprecated" do
273
+ ActiveSupport::Deprecation.should_receive(:warn)
274
+ resource = Resource.new("admin/events")
275
+ resource.namespaced_model_name
276
+ end
277
+ end
139
278
 
140
279
  end
141
280
  end
@@ -1,3 +1,4 @@
1
+ require 'rspec'
1
2
  require 'ostruct'
2
3
  require File.dirname(__FILE__) + "/../../lib/alchemy/resource"
3
4
  require File.dirname(__FILE__) + "/../../lib/alchemy/resources_helper"
@@ -39,74 +40,115 @@ describe Alchemy::ResourcesHelper do
39
40
 
40
41
  describe "path-helpers" do
41
42
 
42
- describe "resource_url_proxy" do
43
- it "should return the current proxy for use in url-helper-methods" do
43
+ describe "#resource_url_proxy" do
44
+
45
+ it "returns the current proxy for url-helper-methods" do
44
46
  @controller.resource_url_proxy.should == 'main_app_proxy'
45
47
  end
46
- it "should return the engine's proxy object when resource is in engine" do
47
- @controller_for_engine = ResourcesControllerForEngine.new
48
- @controller_for_engine.stub('my_engine').and_return 'my_engine_proxy'
49
- @controller_for_engine.resource_url_proxy.should == 'my_engine_proxy'
48
+
49
+ context "when resource is in engine" do
50
+ it "returns the engine's proxy" do
51
+ @controller_for_engine = ResourcesControllerForEngine.new
52
+ @controller_for_engine.stub('my_engine').and_return 'my_engine_proxy'
53
+ @controller_for_engine.resource_url_proxy.should == 'my_engine_proxy'
54
+ end
50
55
  end
56
+
51
57
  end
52
58
 
53
- describe "resource_scope" do
54
- it "should provide an array containing a proxy and namespaces for use in url_for-based helper-methods" do
59
+ describe "#resource_scope" do
60
+ it "returns an array containing a proxy and namespaces for url_for-based helper-methods" do
55
61
  @controller.resource_scope.should == %W[main_app_proxy admin]
56
62
  end
57
63
  end
58
64
 
59
- describe "resource_path" do
65
+ describe "#resource_path" do
60
66
 
61
- it "should invoke polymorphic-path with correct scope and object" do
67
+ it "invokes polymorphic-path with correct scope and object" do
62
68
  my_resource_item = stub
63
69
  @controller.should_receive(:polymorphic_path).with(["main_app_proxy", "admin", my_resource_item], {})
64
70
  @controller.resource_path(my_resource_item)
65
71
  end
66
72
 
67
- it "use resource's class when no object is given" do
68
- @controller.should_receive(:polymorphic_path).with(["main_app_proxy", "admin", Namespace::MyResource], {})
73
+ it "uses resource_name when no object is given" do
74
+ @controller.should_receive(:polymorphic_path).with(["main_app_proxy", "admin", "my_resource"], {})
69
75
  @controller.resource_path
70
76
  end
71
77
 
72
78
  end
73
79
 
74
- describe "resources_path method" do
75
- it "should invoke polymorphic-path with correct scope and resource class-name" do
76
- @controller.should_receive(:polymorphic_path).with(["main_app_proxy", "admin", Namespace::MyResource], {})
80
+ describe "#resources_path" do
81
+ it "invokes polymorphic-path with correct scope and resources_name" do
82
+ @controller.should_receive(:polymorphic_path).with(["main_app_proxy", "admin", "my_resources"], {})
77
83
  @controller.resources_path
78
84
  end
79
85
  end
80
86
 
81
- it "should provide a new_resource_path method" do
82
- @controller.should_receive(:new_polymorphic_path).with(["main_app_proxy", "admin", Namespace::MyResource], {})
83
- @controller.new_resource_path
87
+ describe "#new_resource_path" do
88
+ it "invokes new_polymorphic_path with correct scope and resource_name" do
89
+ @controller.should_receive(:new_polymorphic_path).with(["main_app_proxy", "admin", "my_resource"], {})
90
+ @controller.new_resource_path
91
+ end
84
92
  end
85
93
 
86
- it "should provide a edit_resource_path method" do
87
- my_resource_item = stub
88
- @controller.should_receive(:edit_polymorphic_path).with(["main_app_proxy", "admin", my_resource_item], {})
89
- @controller.edit_resource_path(my_resource_item)
94
+
95
+ describe "#edit_resource_path" do
96
+ it "invokes edit_polymorphic_path with correct scope and resource_name" do
97
+ my_resource_item = stub
98
+ @controller.should_receive(:edit_polymorphic_path).with(["main_app_proxy", "admin", my_resource_item], {})
99
+ @controller.edit_resource_path(my_resource_item)
100
+ end
90
101
  end
91
102
 
92
103
  end
93
104
 
94
- describe "resource_instance_variable" do
95
- it "should return the resource_item" do
105
+ describe "#resource_instance_variable" do
106
+ it "returns the resource_item" do
96
107
  @controller.resource_instance_variable.should == @resource_item
97
108
  end
98
109
  end
99
110
 
100
- describe "resources_instance_variable" do
101
- it "should return a collection of resource_items" do
111
+ describe "#resources_instance_variable" do
112
+ it "returns a collection of resource_items" do
102
113
  @controller.resources_instance_variable.should == [@resource_item]
103
114
  end
104
115
  end
105
116
 
106
- describe "resource_window_size" do
107
- it "should return overlay size string depending on resource attributes length" do
117
+ describe "#resource_window_size" do
118
+ it "returns overlay size string depending on resource attributes length" do
108
119
  @controller.stub(:resource_handler).and_return(OpenStruct.new(:attributes => OpenStruct.new(:length => 4)))
109
120
  @controller.resource_window_size.should == "420x260"
110
121
  end
111
122
  end
123
+
124
+ describe "#render_attribute" do
125
+ it "should return the value from resource attribute" do
126
+ @resource_item.stub!(:name).and_return('my-name')
127
+ @controller.render_attribute(@resource_item, {:name => 'name'}).should == 'my-name'
128
+ end
129
+
130
+ context "resource having a relation" do
131
+ it "should return the value from the related object attribute" do
132
+ @resource_item.stub!(:name).and_return('my-name')
133
+ associated_object = double("location", :title => 'Title of related object')
134
+ associated_klass = double("klass", :find => associated_object)
135
+ relation = {:attr_method => :title, :model_association => OpenStruct.new(:klass => associated_klass)}
136
+ @controller.render_attribute(@resource_item, {:name => 'name', :relation => relation}).should == 'Title of related object'
137
+ end
138
+ end
139
+ end
140
+
141
+ describe "#resource_model_name" do
142
+ it "is deprecated" do
143
+ ActiveSupport::Deprecation.should_receive(:warn)
144
+ @controller.resource_model_name
145
+ end
146
+ end
147
+
148
+ describe "#resource_name" do
149
+ it "returns resource_handler.resource_name" do
150
+ @controller.resource_name.should == "my_resource"
151
+ end
152
+ end
153
+
112
154
  end