lc_alchemy_cms 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (744) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +23 -0
  3. data/.gitignore +21 -0
  4. data/.hound.yml +2 -0
  5. data/.rspec +1 -0
  6. data/.rubocop.yml +861 -0
  7. data/.teatro.yml +7 -0
  8. data/.travis.yml +27 -0
  9. data/.yardopts +5 -0
  10. data/CODE_OF_CONDUCT.md +13 -0
  11. data/CONTRIBUTING.md +73 -0
  12. data/Gemfile +34 -0
  13. data/LICENSE +27 -0
  14. data/README.md +297 -0
  15. data/Rakefile +48 -0
  16. data/alchemy_cms.gemspec +81 -0
  17. data/app/assets/fonts/alchemy/icons.eot +0 -0
  18. data/app/assets/fonts/alchemy/icons.svg +71 -0
  19. data/app/assets/fonts/alchemy/icons.ttf +0 -0
  20. data/app/assets/fonts/alchemy/icons.woff +0 -0
  21. data/app/assets/images/alchemy/alchemy-logo.svg +70 -0
  22. data/app/assets/images/alchemy/favicon.ico +0 -0
  23. data/app/assets/images/alchemy/icon.svg +14 -0
  24. data/app/assets/images/alchemy/icons.png +0 -0
  25. data/app/assets/images/alchemy/lupe.cur +0 -0
  26. data/app/assets/images/alchemy/ui-icons_666666_256x240.png +0 -0
  27. data/app/assets/images/sassy-ie-overlay.png +0 -0
  28. data/app/assets/javascripts/alchemy/alchemy.autocomplete.js.coffee +30 -0
  29. data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +142 -0
  30. data/app/assets/javascripts/alchemy/alchemy.browser.js.coffee +22 -0
  31. data/app/assets/javascripts/alchemy/alchemy.buttons.js.coffee +32 -0
  32. data/app/assets/javascripts/alchemy/alchemy.char_counter.js.coffee +19 -0
  33. data/app/assets/javascripts/alchemy/alchemy.confirm_dialog.js.coffee +85 -0
  34. data/app/assets/javascripts/alchemy/alchemy.custom.js +1 -0
  35. data/app/assets/javascripts/alchemy/alchemy.datepicker.js.coffee +31 -0
  36. data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +266 -0
  37. data/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee +70 -0
  38. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +84 -0
  39. data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +138 -0
  40. data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +89 -0
  41. data/app/assets/javascripts/alchemy/alchemy.file_progress.js.coffee +63 -0
  42. data/app/assets/javascripts/alchemy/alchemy.growler.js.coffee +27 -0
  43. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +22 -0
  44. data/app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee +49 -0
  45. data/app/assets/javascripts/alchemy/alchemy.html5.js +22 -0
  46. data/app/assets/javascripts/alchemy/alchemy.i18n.js.coffee +26 -0
  47. data/app/assets/javascripts/alchemy/alchemy.image_cropper.js.coffee +44 -0
  48. data/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee +63 -0
  49. data/app/assets/javascripts/alchemy/alchemy.jquery_loader.js +42 -0
  50. data/app/assets/javascripts/alchemy/alchemy.js +52 -0
  51. data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +250 -0
  52. data/app/assets/javascripts/alchemy/alchemy.list_filter.js.coffee +49 -0
  53. data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +48 -0
  54. data/app/assets/javascripts/alchemy/alchemy.preview.js.coffee +106 -0
  55. data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +58 -0
  56. data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +50 -0
  57. data/app/assets/javascripts/alchemy/alchemy.spinner.js.coffee +49 -0
  58. data/app/assets/javascripts/alchemy/alchemy.string_extension.js.coffee +11 -0
  59. data/app/assets/javascripts/alchemy/alchemy.tinymce.js.coffee +66 -0
  60. data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +132 -0
  61. data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +102 -0
  62. data/app/assets/javascripts/alchemy/alchemy.windows.js.coffee +42 -0
  63. data/app/assets/javascripts/alchemy/menubar.js.coffee +8 -0
  64. data/app/assets/javascripts/alchemy/preview.js +1 -0
  65. data/app/assets/javascripts/tinymce/plugins/alchemy_link/plugin.min.js +19 -0
  66. data/app/assets/stylesheets/alchemy/_defaults.scss +8 -0
  67. data/app/assets/stylesheets/alchemy/_extends.scss +93 -0
  68. data/app/assets/stylesheets/alchemy/_mixins.scss +112 -0
  69. data/app/assets/stylesheets/alchemy/_variables.scss +61 -0
  70. data/app/assets/stylesheets/alchemy/admin.scss +31 -0
  71. data/app/assets/stylesheets/alchemy/archive.scss +436 -0
  72. data/app/assets/stylesheets/alchemy/base.scss +609 -0
  73. data/app/assets/stylesheets/alchemy/buttons.scss +259 -0
  74. data/app/assets/stylesheets/alchemy/custom.scss +1 -0
  75. data/app/assets/stylesheets/alchemy/dashboard.scss +104 -0
  76. data/app/assets/stylesheets/alchemy/dialogs.scss +214 -0
  77. data/app/assets/stylesheets/alchemy/elements.scss +772 -0
  78. data/app/assets/stylesheets/alchemy/errors.scss +39 -0
  79. data/app/assets/stylesheets/alchemy/flash.scss +65 -0
  80. data/app/assets/stylesheets/alchemy/form_fields.scss +89 -0
  81. data/app/assets/stylesheets/alchemy/forms.scss +193 -0
  82. data/app/assets/stylesheets/alchemy/frame.scss +301 -0
  83. data/app/assets/stylesheets/alchemy/icon-font.scss +67 -0
  84. data/app/assets/stylesheets/alchemy/icons.scss +324 -0
  85. data/app/assets/stylesheets/alchemy/jquery-ui.scss +1511 -0
  86. data/app/assets/stylesheets/alchemy/menubar.scss +81 -0
  87. data/app/assets/stylesheets/alchemy/modules.scss +33 -0
  88. data/app/assets/stylesheets/alchemy/notices.scss +64 -0
  89. data/app/assets/stylesheets/alchemy/pagination.scss +65 -0
  90. data/app/assets/stylesheets/alchemy/print.scss +34 -0
  91. data/app/assets/stylesheets/alchemy/search.scss +73 -0
  92. data/app/assets/stylesheets/alchemy/selects.scss +235 -0
  93. data/app/assets/stylesheets/alchemy/sitemap.scss +385 -0
  94. data/app/assets/stylesheets/alchemy/tables.scss +218 -0
  95. data/app/assets/stylesheets/alchemy/toolbar.scss +146 -0
  96. data/app/assets/stylesheets/alchemy/upload.scss +121 -0
  97. data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +90 -0
  98. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/readme.md +1 -0
  99. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.eot +0 -0
  100. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.svg +175 -0
  101. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.ttf +0 -0
  102. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.woff +0 -0
  103. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.eot +0 -0
  104. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.svg +153 -0
  105. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.ttf +0 -0
  106. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.woff +0 -0
  107. data/app/assets/stylesheets/tinymce/skins/alchemy/img/anchor.gif +0 -0
  108. data/app/assets/stylesheets/tinymce/skins/alchemy/img/loader.gif +0 -0
  109. data/app/assets/stylesheets/tinymce/skins/alchemy/img/object.gif +0 -0
  110. data/app/assets/stylesheets/tinymce/skins/alchemy/img/trans.gif +0 -0
  111. data/app/assets/stylesheets/tinymce/skins/alchemy/img/wline.gif +0 -0
  112. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.ie7.min.css +1 -0
  113. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +1810 -0
  114. data/app/controllers/alchemy/admin/attachments_controller.rb +106 -0
  115. data/app/controllers/alchemy/admin/base_controller.rb +168 -0
  116. data/app/controllers/alchemy/admin/clipboard_controller.rb +51 -0
  117. data/app/controllers/alchemy/admin/contents_controller.rb +76 -0
  118. data/app/controllers/alchemy/admin/dashboard_controller.rb +89 -0
  119. data/app/controllers/alchemy/admin/elements_controller.rb +190 -0
  120. data/app/controllers/alchemy/admin/essence_files_controller.rb +47 -0
  121. data/app/controllers/alchemy/admin/essence_pictures_controller.rb +120 -0
  122. data/app/controllers/alchemy/admin/languages_controller.rb +17 -0
  123. data/app/controllers/alchemy/admin/layoutpages_controller.rb +19 -0
  124. data/app/controllers/alchemy/admin/legacy_page_urls_controller.rb +39 -0
  125. data/app/controllers/alchemy/admin/pages_controller.rb +359 -0
  126. data/app/controllers/alchemy/admin/pictures_controller.rb +168 -0
  127. data/app/controllers/alchemy/admin/resources_controller.rb +185 -0
  128. data/app/controllers/alchemy/admin/sites_controller.rb +6 -0
  129. data/app/controllers/alchemy/admin/tags_controller.rb +76 -0
  130. data/app/controllers/alchemy/admin/trash_controller.rb +27 -0
  131. data/app/controllers/alchemy/api/base_controller.rb +19 -0
  132. data/app/controllers/alchemy/api/contents_controller.rb +35 -0
  133. data/app/controllers/alchemy/api/elements_controller.rb +29 -0
  134. data/app/controllers/alchemy/api/pages_controller.rb +32 -0
  135. data/app/controllers/alchemy/attachments_controller.rb +35 -0
  136. data/app/controllers/alchemy/base_controller.rb +106 -0
  137. data/app/controllers/alchemy/elements_controller.rb +27 -0
  138. data/app/controllers/alchemy/messages_controller.rb +114 -0
  139. data/app/controllers/alchemy/pages_controller.rb +211 -0
  140. data/app/controllers/alchemy/pictures_controller.rb +82 -0
  141. data/app/helpers/alchemy/admin/attachments_helper.rb +12 -0
  142. data/app/helpers/alchemy/admin/base_helper.rb +471 -0
  143. data/app/helpers/alchemy/admin/contents_helper.rb +113 -0
  144. data/app/helpers/alchemy/admin/elements_helper.rb +134 -0
  145. data/app/helpers/alchemy/admin/essences_helper.rb +120 -0
  146. data/app/helpers/alchemy/admin/form_helper.rb +30 -0
  147. data/app/helpers/alchemy/admin/navigation_helper.rb +238 -0
  148. data/app/helpers/alchemy/admin/pages_helper.rb +70 -0
  149. data/app/helpers/alchemy/admin/pictures_helper.rb +30 -0
  150. data/app/helpers/alchemy/admin/tags_helper.rb +102 -0
  151. data/app/helpers/alchemy/base_helper.rb +81 -0
  152. data/app/helpers/alchemy/elements_block_helper.rb +162 -0
  153. data/app/helpers/alchemy/elements_helper.rb +291 -0
  154. data/app/helpers/alchemy/essences_helper.rb +138 -0
  155. data/app/helpers/alchemy/pages_helper.rb +417 -0
  156. data/app/helpers/alchemy/url_helper.rb +76 -0
  157. data/app/mailers/alchemy/messages.rb +15 -0
  158. data/app/models/alchemy.rb +7 -0
  159. data/app/models/alchemy/attachment.rb +129 -0
  160. data/app/models/alchemy/cell.rb +94 -0
  161. data/app/models/alchemy/content.rb +255 -0
  162. data/app/models/alchemy/content/factory.rb +190 -0
  163. data/app/models/alchemy/element.rb +513 -0
  164. data/app/models/alchemy/element/definitions.rb +52 -0
  165. data/app/models/alchemy/element/presenters.rb +87 -0
  166. data/app/models/alchemy/element_to_page.rb +7 -0
  167. data/app/models/alchemy/essence_boolean.rb +19 -0
  168. data/app/models/alchemy/essence_date.rb +24 -0
  169. data/app/models/alchemy/essence_file.rb +42 -0
  170. data/app/models/alchemy/essence_html.rb +23 -0
  171. data/app/models/alchemy/essence_link.rb +20 -0
  172. data/app/models/alchemy/essence_picture.rb +152 -0
  173. data/app/models/alchemy/essence_richtext.rb +47 -0
  174. data/app/models/alchemy/essence_select.rb +18 -0
  175. data/app/models/alchemy/essence_text.rb +22 -0
  176. data/app/models/alchemy/folded_page.rb +16 -0
  177. data/app/models/alchemy/language.rb +144 -0
  178. data/app/models/alchemy/language/code.rb +22 -0
  179. data/app/models/alchemy/legacy_page_url.rb +20 -0
  180. data/app/models/alchemy/message.rb +40 -0
  181. data/app/models/alchemy/page.rb +409 -0
  182. data/app/models/alchemy/page/page_cells.rb +71 -0
  183. data/app/models/alchemy/page/page_elements.rb +272 -0
  184. data/app/models/alchemy/page/page_naming.rb +122 -0
  185. data/app/models/alchemy/page/page_natures.rb +114 -0
  186. data/app/models/alchemy/page/page_scopes.rb +95 -0
  187. data/app/models/alchemy/page/page_users.rb +58 -0
  188. data/app/models/alchemy/picture.rb +220 -0
  189. data/app/models/alchemy/picture/sweeping.rb +17 -0
  190. data/app/models/alchemy/picture/transformations.rb +256 -0
  191. data/app/models/alchemy/site.rb +91 -0
  192. data/app/models/alchemy/site/layout.rb +38 -0
  193. data/app/models/alchemy/tag.rb +24 -0
  194. data/app/models/alchemy/translations.rb +7 -0
  195. data/app/models/alchemy/translations/essence_body_updater.rb +64 -0
  196. data/app/models/alchemy/translations/translation_pusher.rb +18 -0
  197. data/app/models/alchemy/tree_node.rb +4 -0
  198. data/app/serializers/alchemy/attachment_serializer.rb +15 -0
  199. data/app/serializers/alchemy/cell_serializer.rb +18 -0
  200. data/app/serializers/alchemy/content_serializer.rb +20 -0
  201. data/app/serializers/alchemy/element_serializer.rb +20 -0
  202. data/app/serializers/alchemy/essence_boolean_serializer.rb +11 -0
  203. data/app/serializers/alchemy/essence_date_serializer.rb +11 -0
  204. data/app/serializers/alchemy/essence_file_serializer.rb +12 -0
  205. data/app/serializers/alchemy/essence_html_serializer.rb +11 -0
  206. data/app/serializers/alchemy/essence_link_serializer.rb +14 -0
  207. data/app/serializers/alchemy/essence_picture_serializer.rb +28 -0
  208. data/app/serializers/alchemy/essence_richtext_serializer.rb +12 -0
  209. data/app/serializers/alchemy/essence_select_serializer.rb +11 -0
  210. data/app/serializers/alchemy/essence_text_serializer.rb +22 -0
  211. data/app/serializers/alchemy/legacy_element_serializer.rb +17 -0
  212. data/app/serializers/alchemy/page_serializer.rb +29 -0
  213. data/app/serializers/alchemy/picture_serializer.rb +16 -0
  214. data/app/views/alchemy/_menubar.html.erb +16 -0
  215. data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +32 -0
  216. data/app/views/alchemy/admin/attachments/_attachment.html.erb +63 -0
  217. data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +15 -0
  218. data/app/views/alchemy/admin/attachments/_files_list.html.erb +39 -0
  219. data/app/views/alchemy/admin/attachments/_overlay_file_list.html.erb +11 -0
  220. data/app/views/alchemy/admin/attachments/_tag_list.html.erb +14 -0
  221. data/app/views/alchemy/admin/attachments/archive_overlay.js.erb +7 -0
  222. data/app/views/alchemy/admin/attachments/create.js.erb +11 -0
  223. data/app/views/alchemy/admin/attachments/destroy.js.erb +1 -0
  224. data/app/views/alchemy/admin/attachments/edit.html.erb +10 -0
  225. data/app/views/alchemy/admin/attachments/index.html.erb +29 -0
  226. data/app/views/alchemy/admin/attachments/new.html.erb +14 -0
  227. data/app/views/alchemy/admin/attachments/show.html.erb +3 -0
  228. data/app/views/alchemy/admin/clipboard/clear.js.erb +3 -0
  229. data/app/views/alchemy/admin/clipboard/index.html.erb +22 -0
  230. data/app/views/alchemy/admin/clipboard/insert.js.erb +19 -0
  231. data/app/views/alchemy/admin/clipboard/remove.js.erb +10 -0
  232. data/app/views/alchemy/admin/contents/_missing.html.erb +19 -0
  233. data/app/views/alchemy/admin/contents/create.js.erb +56 -0
  234. data/app/views/alchemy/admin/contents/destroy.js.erb +4 -0
  235. data/app/views/alchemy/admin/contents/new.html.erb +11 -0
  236. data/app/views/alchemy/admin/contents/order.js.erb +3 -0
  237. data/app/views/alchemy/admin/dashboard/_locked_pages.html.erb +38 -0
  238. data/app/views/alchemy/admin/dashboard/_recent_pages.html.erb +22 -0
  239. data/app/views/alchemy/admin/dashboard/_sites.html.erb +23 -0
  240. data/app/views/alchemy/admin/dashboard/_users.html.erb +19 -0
  241. data/app/views/alchemy/admin/dashboard/help.html.erb +21 -0
  242. data/app/views/alchemy/admin/dashboard/index.html.erb +44 -0
  243. data/app/views/alchemy/admin/dashboard/info.html.erb +64 -0
  244. data/app/views/alchemy/admin/elements/_add_picture.html.erb +14 -0
  245. data/app/views/alchemy/admin/elements/_element.html.erb +23 -0
  246. data/app/views/alchemy/admin/elements/_element_foot.html.erb +36 -0
  247. data/app/views/alchemy/admin/elements/_element_head.html.erb +23 -0
  248. data/app/views/alchemy/admin/elements/_new_element_form.html.erb +26 -0
  249. data/app/views/alchemy/admin/elements/_picture_gallery_editor.html.erb +24 -0
  250. data/app/views/alchemy/admin/elements/_refresh_editor.js.erb +8 -0
  251. data/app/views/alchemy/admin/elements/create.js.erb +46 -0
  252. data/app/views/alchemy/admin/elements/fold.js.erb +28 -0
  253. data/app/views/alchemy/admin/elements/index.html.erb +26 -0
  254. data/app/views/alchemy/admin/elements/list.html.erb +16 -0
  255. data/app/views/alchemy/admin/elements/new.html.erb +25 -0
  256. data/app/views/alchemy/admin/elements/order.js.erb +14 -0
  257. data/app/views/alchemy/admin/elements/trash.js.erb +12 -0
  258. data/app/views/alchemy/admin/elements/update.js.erb +28 -0
  259. data/app/views/alchemy/admin/essence_files/assign.js.erb +9 -0
  260. data/app/views/alchemy/admin/essence_files/edit.html.erb +18 -0
  261. data/app/views/alchemy/admin/essence_pictures/assign.js.erb +18 -0
  262. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +50 -0
  263. data/app/views/alchemy/admin/essence_pictures/destroy.js.erb +24 -0
  264. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +28 -0
  265. data/app/views/alchemy/admin/essence_pictures/save_link.js.erb +3 -0
  266. data/app/views/alchemy/admin/essence_pictures/update.js.erb +9 -0
  267. data/app/views/alchemy/admin/languages/_form.html.erb +14 -0
  268. data/app/views/alchemy/admin/languages/_language.html.erb +42 -0
  269. data/app/views/alchemy/admin/languages/_table.html.erb +37 -0
  270. data/app/views/alchemy/admin/languages/index.html.erb +23 -0
  271. data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +63 -0
  272. data/app/views/alchemy/admin/layoutpages/edit.html.erb +15 -0
  273. data/app/views/alchemy/admin/layoutpages/index.html.erb +41 -0
  274. data/app/views/alchemy/admin/leave.html.erb +11 -0
  275. data/app/views/alchemy/admin/legacy_page_urls/_form.html.erb +5 -0
  276. data/app/views/alchemy/admin/legacy_page_urls/_label.html.erb +1 -0
  277. data/app/views/alchemy/admin/legacy_page_urls/_legacy_page_url.html.erb +13 -0
  278. data/app/views/alchemy/admin/legacy_page_urls/_new.html.erb +20 -0
  279. data/app/views/alchemy/admin/legacy_page_urls/create.js.erb +10 -0
  280. data/app/views/alchemy/admin/legacy_page_urls/destroy.js.erb +6 -0
  281. data/app/views/alchemy/admin/legacy_page_urls/update.js.erb +2 -0
  282. data/app/views/alchemy/admin/pages/_create_language_form.html.erb +54 -0
  283. data/app/views/alchemy/admin/pages/_external_link.html.erb +31 -0
  284. data/app/views/alchemy/admin/pages/_file_link.html.erb +31 -0
  285. data/app/views/alchemy/admin/pages/_form.html.erb +62 -0
  286. data/app/views/alchemy/admin/pages/_internal_link.html.erb +41 -0
  287. data/app/views/alchemy/admin/pages/_legacy_urls.html.erb +23 -0
  288. data/app/views/alchemy/admin/pages/_locked_page.html.erb +24 -0
  289. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +11 -0
  290. data/app/views/alchemy/admin/pages/_page.html.erb +112 -0
  291. data/app/views/alchemy/admin/pages/_page_for_links.html.erb +45 -0
  292. data/app/views/alchemy/admin/pages/_page_status.html.erb +14 -0
  293. data/app/views/alchemy/admin/pages/_sitemap.html.erb +8 -0
  294. data/app/views/alchemy/admin/pages/_tinymce_custom_config.html.erb +13 -0
  295. data/app/views/alchemy/admin/pages/configure.html.erb +16 -0
  296. data/app/views/alchemy/admin/pages/configure_external.html.erb +33 -0
  297. data/app/views/alchemy/admin/pages/destroy.js.erb +19 -0
  298. data/app/views/alchemy/admin/pages/edit.html.erb +206 -0
  299. data/app/views/alchemy/admin/pages/flush.js.erb +2 -0
  300. data/app/views/alchemy/admin/pages/fold.js.erb +3 -0
  301. data/app/views/alchemy/admin/pages/index.html.erb +101 -0
  302. data/app/views/alchemy/admin/pages/info.html.erb +43 -0
  303. data/app/views/alchemy/admin/pages/link.html.erb +16 -0
  304. data/app/views/alchemy/admin/pages/locked.html.erb +3 -0
  305. data/app/views/alchemy/admin/pages/new.html.erb +26 -0
  306. data/app/views/alchemy/admin/pages/show.html.erb +1 -0
  307. data/app/views/alchemy/admin/pages/sort.js.erb +5 -0
  308. data/app/views/alchemy/admin/pages/unlock.js.erb +8 -0
  309. data/app/views/alchemy/admin/pages/update.js.erb +37 -0
  310. data/app/views/alchemy/admin/partials/_autocomplete_tag_list.html.erb +1 -0
  311. data/app/views/alchemy/admin/partials/_flash.html.erb +4 -0
  312. data/app/views/alchemy/admin/partials/_flash_notices.html.erb +5 -0
  313. data/app/views/alchemy/admin/partials/_language_tree_select.html.erb +11 -0
  314. data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +12 -0
  315. data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +33 -0
  316. data/app/views/alchemy/admin/partials/_routes.html.erb +25 -0
  317. data/app/views/alchemy/admin/partials/_search_form.html.erb +20 -0
  318. data/app/views/alchemy/admin/partials/_sub_navigation.html.erb +8 -0
  319. data/app/views/alchemy/admin/partials/_toolbar_button.html.erb +25 -0
  320. data/app/views/alchemy/admin/partials/_upload_form.html.erb +67 -0
  321. data/app/views/alchemy/admin/pictures/_archive.html.erb +53 -0
  322. data/app/views/alchemy/admin/pictures/_archive_overlay.html.erb +14 -0
  323. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +78 -0
  324. data/app/views/alchemy/admin/pictures/_filter_bar.html.erb +33 -0
  325. data/app/views/alchemy/admin/pictures/_overlay_picture_list.html.erb +11 -0
  326. data/app/views/alchemy/admin/pictures/_picture.html.erb +87 -0
  327. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +28 -0
  328. data/app/views/alchemy/admin/pictures/_tag_list.html.erb +16 -0
  329. data/app/views/alchemy/admin/pictures/archive_overlay.js.erb +8 -0
  330. data/app/views/alchemy/admin/pictures/edit.html.erb +13 -0
  331. data/app/views/alchemy/admin/pictures/edit_multiple.html.erb +30 -0
  332. data/app/views/alchemy/admin/pictures/flush.js.erb +2 -0
  333. data/app/views/alchemy/admin/pictures/index.html.erb +109 -0
  334. data/app/views/alchemy/admin/pictures/index.js.erb +3 -0
  335. data/app/views/alchemy/admin/pictures/info.html.erb +38 -0
  336. data/app/views/alchemy/admin/pictures/new.html.erb +16 -0
  337. data/app/views/alchemy/admin/pictures/show.html.erb +11 -0
  338. data/app/views/alchemy/admin/resources/_form.html.erb +13 -0
  339. data/app/views/alchemy/admin/resources/_resource.html.erb +30 -0
  340. data/app/views/alchemy/admin/resources/_table.html.erb +25 -0
  341. data/app/views/alchemy/admin/resources/edit.html.erb +1 -0
  342. data/app/views/alchemy/admin/resources/index.csv.erb +13 -0
  343. data/app/views/alchemy/admin/resources/index.html.erb +32 -0
  344. data/app/views/alchemy/admin/resources/new.html.erb +1 -0
  345. data/app/views/alchemy/admin/sites/index.html.erb +23 -0
  346. data/app/views/alchemy/admin/tags/_radio_tag.html.erb +6 -0
  347. data/app/views/alchemy/admin/tags/_tag.html.erb +30 -0
  348. data/app/views/alchemy/admin/tags/edit.html.erb +24 -0
  349. data/app/views/alchemy/admin/tags/index.html.erb +52 -0
  350. data/app/views/alchemy/admin/tags/new.html.erb +7 -0
  351. data/app/views/alchemy/admin/trash/clear.js.erb +4 -0
  352. data/app/views/alchemy/admin/trash/index.html.erb +29 -0
  353. data/app/views/alchemy/attachments/show.html.erb +1 -0
  354. data/app/views/alchemy/base/500.html.erb +26 -0
  355. data/app/views/alchemy/base/error_notice.html.erb +1 -0
  356. data/app/views/alchemy/base/error_notice.js.erb +2 -0
  357. data/app/views/alchemy/base/permission_denied.js.erb +3 -0
  358. data/app/views/alchemy/base/redirect.js.erb +12 -0
  359. data/app/views/alchemy/base/update.js.erb +5 -0
  360. data/app/views/alchemy/breadcrumb/_page.html.erb +16 -0
  361. data/app/views/alchemy/breadcrumb/_separator.html.erb +1 -0
  362. data/app/views/alchemy/breadcrumb/_wrapper.html.erb +13 -0
  363. data/app/views/alchemy/elements/_editor_not_found.html.erb +5 -0
  364. data/app/views/alchemy/elements/_view_not_found.html.erb +1 -0
  365. data/app/views/alchemy/elements/show.html.erb +1 -0
  366. data/app/views/alchemy/elements/show.js.erb +1 -0
  367. data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +16 -0
  368. data/app/views/alchemy/essences/_essence_boolean_view.html.erb +3 -0
  369. data/app/views/alchemy/essences/_essence_date_editor.html.erb +19 -0
  370. data/app/views/alchemy/essences/_essence_date_view.html.erb +11 -0
  371. data/app/views/alchemy/essences/_essence_file_editor.html.erb +57 -0
  372. data/app/views/alchemy/essences/_essence_file_view.html.erb +10 -0
  373. data/app/views/alchemy/essences/_essence_html_editor.html.erb +9 -0
  374. data/app/views/alchemy/essences/_essence_html_view.html.erb +3 -0
  375. data/app/views/alchemy/essences/_essence_link_editor.html.erb +25 -0
  376. data/app/views/alchemy/essences/_essence_link_view.html.erb +11 -0
  377. data/app/views/alchemy/essences/_essence_picture_editor.html.erb +59 -0
  378. data/app/views/alchemy/essences/_essence_picture_view.html.erb +5 -0
  379. data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +13 -0
  380. data/app/views/alchemy/essences/_essence_richtext_view.html.erb +5 -0
  381. data/app/views/alchemy/essences/_essence_select_editor.html.erb +25 -0
  382. data/app/views/alchemy/essences/_essence_select_view.html.erb +3 -0
  383. data/app/views/alchemy/essences/_essence_text_editor.html.erb +18 -0
  384. data/app/views/alchemy/essences/_essence_text_view.html.erb +18 -0
  385. data/app/views/alchemy/essences/shared/_essence_picture_tools.html.erb +61 -0
  386. data/app/views/alchemy/essences/shared/_linkable_essence_tools.html.erb +19 -0
  387. data/app/views/alchemy/language_links/_language.html.erb +12 -0
  388. data/app/views/alchemy/language_links/_spacer.html.erb +1 -0
  389. data/app/views/alchemy/messages/contact_form_mail.de.text.erb +12 -0
  390. data/app/views/alchemy/messages/contact_form_mail.en.text.erb +12 -0
  391. data/app/views/alchemy/messages/contact_form_mail.es.text.erb +12 -0
  392. data/app/views/alchemy/messages/new.html.erb +1 -0
  393. data/app/views/alchemy/navigation/_image_link.html.erb +14 -0
  394. data/app/views/alchemy/navigation/_link.html.erb +20 -0
  395. data/app/views/alchemy/navigation/_renderer.html.erb +30 -0
  396. data/app/views/alchemy/pages/show.html.erb +1 -0
  397. data/app/views/alchemy/pages/show.rss.builder +20 -0
  398. data/app/views/alchemy/pages/sitemap.xml.erb +6 -0
  399. data/app/views/kaminari/alchemy/_first_page.html.erb +11 -0
  400. data/app/views/kaminari/alchemy/_gap.html.erb +8 -0
  401. data/app/views/kaminari/alchemy/_last_page.html.erb +11 -0
  402. data/app/views/kaminari/alchemy/_next_page.html.erb +13 -0
  403. data/app/views/kaminari/alchemy/_page.html.erb +14 -0
  404. data/app/views/kaminari/alchemy/_paginator.html.erb +23 -0
  405. data/app/views/kaminari/alchemy/_prev_page.html.erb +13 -0
  406. data/app/views/layouts/alchemy/admin.html.erb +109 -0
  407. data/app/views/layouts/alchemy/sitemap.xml.erb +4 -0
  408. data/bin/alchemy +267 -0
  409. data/bin/rails +8 -0
  410. data/config/alchemy/config.yml +189 -0
  411. data/config/alchemy/modules.yml +88 -0
  412. data/config/initializers/dragonfly.rb +25 -0
  413. data/config/initializers/simple_form.rb +144 -0
  414. data/config/locales/alchemy.de.yml +918 -0
  415. data/config/locales/alchemy.en.yml +920 -0
  416. data/config/locales/alchemy.es.yml +958 -0
  417. data/config/locales/alchemy.fr.yml +942 -0
  418. data/config/locales/alchemy.nl.yml +921 -0
  419. data/config/locales/alchemy.ru.yml +837 -0
  420. data/config/locales/simple_form.de.yml +26 -0
  421. data/config/locales/simple_form.en.yml +25 -0
  422. data/config/locales/simple_form.es.yml +6 -0
  423. data/config/locales/simple_form.fr.yml +26 -0
  424. data/config/locales/simple_form.nl.yml +25 -0
  425. data/config/locales/simple_form.ru.yml +25 -0
  426. data/config/routes.rb +164 -0
  427. data/db/migrate/20130827094554_alchemy_two_point_six.rb +380 -0
  428. data/db/migrate/20130828121054_remove_do_not_index_from_alchemy_essence_texts.rb +5 -0
  429. data/db/migrate/20130828121120_remove_do_not_index_from_alchemy_essence_richtexts.rb +5 -0
  430. data/db/migrate/20130918201742_add_published_at_to_alchemy_pages.rb +5 -0
  431. data/lib/alchemy/auth_accessors.rb +104 -0
  432. data/lib/alchemy/cache_digests/template_tracker.rb +65 -0
  433. data/lib/alchemy/config.rb +65 -0
  434. data/lib/alchemy/configuration_methods.rb +29 -0
  435. data/lib/alchemy/controller_actions.rb +138 -0
  436. data/lib/alchemy/engine.rb +104 -0
  437. data/lib/alchemy/errors.rb +82 -0
  438. data/lib/alchemy/essence.rb +232 -0
  439. data/lib/alchemy/filetypes.rb +33 -0
  440. data/lib/alchemy/forms/builder.rb +23 -0
  441. data/lib/alchemy/hints.rb +57 -0
  442. data/lib/alchemy/i18n.rb +70 -0
  443. data/lib/alchemy/kaminari/scoped_pagination_url_helper.rb +13 -0
  444. data/lib/alchemy/locale.rb +65 -0
  445. data/lib/alchemy/logger.rb +15 -0
  446. data/lib/alchemy/middleware/rescue_old_cookies.rb +27 -0
  447. data/lib/alchemy/modules.rb +75 -0
  448. data/lib/alchemy/mount_point.rb +47 -0
  449. data/lib/alchemy/name_conversions.rb +28 -0
  450. data/lib/alchemy/on_page_layout.rb +58 -0
  451. data/lib/alchemy/page_layout.rb +183 -0
  452. data/lib/alchemy/permissions.rb +221 -0
  453. data/lib/alchemy/picture_attributes.rb +29 -0
  454. data/lib/alchemy/resource.rb +238 -0
  455. data/lib/alchemy/resources_helper.rb +135 -0
  456. data/lib/alchemy/routing_constraints.rb +49 -0
  457. data/lib/alchemy/seeder.rb +53 -0
  458. data/lib/alchemy/shell.rb +102 -0
  459. data/lib/alchemy/ssl_protection.rb +30 -0
  460. data/lib/alchemy/tasks/helpers.rb +83 -0
  461. data/lib/alchemy/test_support/controller_requests.rb +73 -0
  462. data/lib/alchemy/test_support/essence_shared_examples.rb +286 -0
  463. data/lib/alchemy/test_support/factories.rb +147 -0
  464. data/lib/alchemy/test_support/integration_helpers.rb +33 -0
  465. data/lib/alchemy/tinymce.rb +68 -0
  466. data/lib/alchemy/touching.rb +41 -0
  467. data/lib/alchemy/upgrader.rb +80 -0
  468. data/lib/alchemy/upgrader/three_point_one.rb +54 -0
  469. data/lib/alchemy/upgrader/three_point_two.rb +69 -0
  470. data/lib/alchemy/upgrader/three_point_zero.rb +93 -0
  471. data/lib/alchemy/userstamp.rb +10 -0
  472. data/lib/alchemy/version.rb +7 -0
  473. data/lib/alchemy_cms.rb +5 -0
  474. data/lib/rails/generators/alchemy/base.rb +41 -0
  475. data/lib/rails/generators/alchemy/elements/elements_generator.rb +37 -0
  476. data/lib/rails/generators/alchemy/elements/templates/editor.html.erb +14 -0
  477. data/lib/rails/generators/alchemy/elements/templates/editor.html.haml +13 -0
  478. data/lib/rails/generators/alchemy/elements/templates/editor.html.slim +12 -0
  479. data/lib/rails/generators/alchemy/elements/templates/view.html.erb +27 -0
  480. data/lib/rails/generators/alchemy/elements/templates/view.html.haml +20 -0
  481. data/lib/rails/generators/alchemy/elements/templates/view.html.slim +20 -0
  482. data/lib/rails/generators/alchemy/essence/essence_generator.rb +52 -0
  483. data/lib/rails/generators/alchemy/essence/templates/editor.html.erb +17 -0
  484. data/lib/rails/generators/alchemy/essence/templates/view.html.erb +2 -0
  485. data/lib/rails/generators/alchemy/install/files/_article_editor.html.erb +5 -0
  486. data/lib/rails/generators/alchemy/install/files/_article_view.html.erb +7 -0
  487. data/lib/rails/generators/alchemy/install/files/_standard.html.erb +1 -0
  488. data/lib/rails/generators/alchemy/install/files/alchemy.de.yml +31 -0
  489. data/lib/rails/generators/alchemy/install/files/alchemy.elements.css.scss +30 -0
  490. data/lib/rails/generators/alchemy/install/files/alchemy.en.yml +31 -0
  491. data/lib/rails/generators/alchemy/install/files/alchemy.es.yml +31 -0
  492. data/lib/rails/generators/alchemy/install/files/application.html.erb +14 -0
  493. data/lib/rails/generators/alchemy/install/install_generator.rb +69 -0
  494. data/lib/rails/generators/alchemy/install/templates/elements.yml.tt +21 -0
  495. data/lib/rails/generators/alchemy/install/templates/page_layouts.yml.tt +10 -0
  496. data/lib/rails/generators/alchemy/module/module_generator.rb +30 -0
  497. data/lib/rails/generators/alchemy/module/templates/ability.rb.tt +11 -0
  498. data/lib/rails/generators/alchemy/module/templates/controller.rb.tt +2 -0
  499. data/lib/rails/generators/alchemy/module/templates/module_config.rb.tt +17 -0
  500. data/lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb +24 -0
  501. data/lib/rails/generators/alchemy/page_layouts/templates/layout.html.erb +1 -0
  502. data/lib/rails/generators/alchemy/page_layouts/templates/layout.html.haml +1 -0
  503. data/lib/rails/generators/alchemy/page_layouts/templates/layout.html.slim +1 -0
  504. data/lib/rails/generators/alchemy/site_layouts/site_layouts_generator.rb +23 -0
  505. data/lib/rails/generators/alchemy/site_layouts/templates/layout.html.erb +1 -0
  506. data/lib/rails/generators/alchemy/site_layouts/templates/layout.html.haml +1 -0
  507. data/lib/rails/generators/alchemy/site_layouts/templates/layout.html.slim +1 -0
  508. data/lib/rails/generators/alchemy/views/views_generator.rb +41 -0
  509. data/lib/rails/templates/alchemy.rb +7 -0
  510. data/lib/tasks/alchemy/convert.rake +39 -0
  511. data/lib/tasks/alchemy/db.rake +22 -0
  512. data/lib/tasks/alchemy/install.rake +61 -0
  513. data/lib/tasks/alchemy/tidy.rake +102 -0
  514. data/lib/tasks/alchemy/upgrade.rake +28 -0
  515. data/spec/controllers/admin/attachments_controller_spec.rb +211 -0
  516. data/spec/controllers/admin/base_controller_spec.rb +74 -0
  517. data/spec/controllers/admin/clipboard_controller_spec.rb +60 -0
  518. data/spec/controllers/admin/contents_controller_spec.rb +72 -0
  519. data/spec/controllers/admin/dashboard_controller_spec.rb +139 -0
  520. data/spec/controllers/admin/elements_controller_spec.rb +473 -0
  521. data/spec/controllers/admin/essence_files_controller_spec.rb +71 -0
  522. data/spec/controllers/admin/essence_pictures_controller_spec.rb +202 -0
  523. data/spec/controllers/admin/languages_controller_spec.rb +61 -0
  524. data/spec/controllers/admin/layoutpages_controller_spec.rb +27 -0
  525. data/spec/controllers/admin/pages_controller_spec.rb +553 -0
  526. data/spec/controllers/admin/pictures_controller_spec.rb +358 -0
  527. data/spec/controllers/admin/resources_controller_spec.rb +53 -0
  528. data/spec/controllers/admin/trash_controller_spec.rb +68 -0
  529. data/spec/controllers/alchemy/admin/tags_controller_spec.rb +63 -0
  530. data/spec/controllers/alchemy/api/contents_controller_spec.rb +126 -0
  531. data/spec/controllers/alchemy/api/elements_controller_spec.rb +125 -0
  532. data/spec/controllers/alchemy/api/pages_controller_spec.rb +134 -0
  533. data/spec/controllers/attachments_controller_spec.rb +64 -0
  534. data/spec/controllers/base_controller_spec.rb +51 -0
  535. data/spec/controllers/elements_controller_spec.rb +48 -0
  536. data/spec/controllers/messages_controller_spec.rb +199 -0
  537. data/spec/controllers/pages_controller_spec.rb +265 -0
  538. data/spec/controllers/pictures_controller_spec.rb +393 -0
  539. data/spec/dummy/Rakefile +6 -0
  540. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  541. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  542. data/spec/dummy/app/controllers/admin/events_controller.rb +3 -0
  543. data/spec/dummy/app/controllers/application_controller.rb +15 -0
  544. data/spec/dummy/app/controllers/login_controller.rb +5 -0
  545. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  546. data/spec/dummy/app/mailers/.gitkeep +0 -0
  547. data/spec/dummy/app/models/ability.rb +9 -0
  548. data/spec/dummy/app/models/dummy_model.rb +3 -0
  549. data/spec/dummy/app/models/dummy_user.rb +11 -0
  550. data/spec/dummy/app/models/event.rb +10 -0
  551. data/spec/dummy/app/models/location.rb +3 -0
  552. data/spec/dummy/app/views/alchemy/elements/_all_you_can_eat_editor.html.erb +11 -0
  553. data/spec/dummy/app/views/alchemy/elements/_article_editor.html.erb +10 -0
  554. data/spec/dummy/app/views/alchemy/elements/_article_view.html.erb +25 -0
  555. data/spec/dummy/app/views/alchemy/elements/_headline_editor.html.erb +1 -0
  556. data/spec/dummy/app/views/alchemy/elements/_headline_view.html.erb +1 -0
  557. data/spec/dummy/app/views/alchemy/elements/_news_view.html.erb +11 -0
  558. data/spec/dummy/app/views/alchemy/page_layouts/_standard.html.erb +14 -0
  559. data/spec/dummy/app/views/layouts/application.html.erb +17 -0
  560. data/spec/dummy/bin/bundle +3 -0
  561. data/spec/dummy/bin/rails +4 -0
  562. data/spec/dummy/bin/rake +4 -0
  563. data/spec/dummy/config.ru +4 -0
  564. data/spec/dummy/config/alchemy/cells.yml +5 -0
  565. data/spec/dummy/config/alchemy/elements.yml +112 -0
  566. data/spec/dummy/config/alchemy/page_layouts.yml +32 -0
  567. data/spec/dummy/config/application.rb +32 -0
  568. data/spec/dummy/config/boot.rb +5 -0
  569. data/spec/dummy/config/database.yml +32 -0
  570. data/spec/dummy/config/environment.rb +5 -0
  571. data/spec/dummy/config/environments/development.rb +41 -0
  572. data/spec/dummy/config/environments/production.rb +77 -0
  573. data/spec/dummy/config/environments/test.rb +43 -0
  574. data/spec/dummy/config/initializers/alchemy.rb +2 -0
  575. data/spec/dummy/config/initializers/assets.rb +11 -0
  576. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  577. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  578. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  579. data/spec/dummy/config/initializers/inflections.rb +16 -0
  580. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  581. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  582. data/spec/dummy/config/initializers/session_store.rb +3 -0
  583. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  584. data/spec/dummy/config/routes.rb +12 -0
  585. data/spec/dummy/config/secrets.yml +22 -0
  586. data/spec/dummy/db/migrate/20121026104128_create_events.rb +20 -0
  587. data/spec/dummy/db/migrate/20130328101418_create_locations.rb +9 -0
  588. data/spec/dummy/db/migrate/20130827094554_alchemy_two_point_six.rb +380 -0
  589. data/spec/dummy/db/migrate/20130828121054_remove_do_not_index_from_alchemy_essence_texts.rb +5 -0
  590. data/spec/dummy/db/migrate/20130828121120_remove_do_not_index_from_alchemy_essence_richtexts.rb +5 -0
  591. data/spec/dummy/db/migrate/20130918201742_add_published_at_to_alchemy_pages.rb +5 -0
  592. data/spec/dummy/db/migrate/20131209225243_create_dummy_users.rb +9 -0
  593. data/spec/dummy/db/migrate/20150122213511_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +31 -0
  594. data/spec/dummy/db/migrate/20150122213512_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
  595. data/spec/dummy/db/migrate/20150122213513_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
  596. data/spec/dummy/db/migrate/20150122213514_add_missing_taggable_index.acts_as_taggable_on_engine.rb +10 -0
  597. data/spec/dummy/db/migrate/20150412103152_create_dummy_model.rb +7 -0
  598. data/spec/dummy/db/schema.rb +322 -0
  599. data/spec/dummy/db/seeds.rb +1 -0
  600. data/spec/dummy/lib/assets/.gitkeep +0 -0
  601. data/spec/dummy/public/404.html +67 -0
  602. data/spec/dummy/public/422.html +67 -0
  603. data/spec/dummy/public/500.html +66 -0
  604. data/spec/dummy/public/favicon.ico +0 -0
  605. data/spec/features/admin/dashboard_spec.rb +82 -0
  606. data/spec/features/admin/language_tree_feature_spec.rb +33 -0
  607. data/spec/features/admin/legacy_page_url_management_spec.rb +62 -0
  608. data/spec/features/admin/link_overlay_spec.rb +54 -0
  609. data/spec/features/admin/locale_select_feature_spec.rb +25 -0
  610. data/spec/features/admin/modules_integration_spec.rb +24 -0
  611. data/spec/features/admin/navigation_feature_spec.rb +13 -0
  612. data/spec/features/admin/page_creation_feature_spec.rb +51 -0
  613. data/spec/features/admin/page_editing_feature_spec.rb +135 -0
  614. data/spec/features/admin/picture_library_integration_spec.rb +62 -0
  615. data/spec/features/admin/resources_integration_spec.rb +133 -0
  616. data/spec/features/admin/site_select_feature_spec.rb +32 -0
  617. data/spec/features/admin/tinymce_feature_spec.rb +34 -0
  618. data/spec/features/navigation_spec.rb +9 -0
  619. data/spec/features/page_feature_spec.rb +287 -0
  620. data/spec/features/picture_security_spec.rb +35 -0
  621. data/spec/features/security_spec.rb +24 -0
  622. data/spec/features/translation_integration_spec.rb +51 -0
  623. data/spec/fixtures/500x500.png +0 -0
  624. data/spec/fixtures/80x60.png +0 -0
  625. data/spec/fixtures/image with spaces.png +0 -0
  626. data/spec/fixtures/image.png +0 -0
  627. data/spec/fixtures/image2.PNG +0 -0
  628. data/spec/fixtures/image3.jpeg +0 -0
  629. data/spec/helpers/admin/attachments_helper_spec.rb +15 -0
  630. data/spec/helpers/admin/base_helper_spec.rb +270 -0
  631. data/spec/helpers/admin/contents_helper_spec.rb +65 -0
  632. data/spec/helpers/admin/elements_helper_spec.rb +178 -0
  633. data/spec/helpers/admin/essences_helper_spec.rb +140 -0
  634. data/spec/helpers/admin/navigation_helper_spec.rb +288 -0
  635. data/spec/helpers/admin/pages_helper_spec.rb +95 -0
  636. data/spec/helpers/admin/pictures_helper_spec.rb +29 -0
  637. data/spec/helpers/admin/tags_helper_spec.rb +113 -0
  638. data/spec/helpers/base_helper_spec.rb +45 -0
  639. data/spec/helpers/elements_block_helper_spec.rb +135 -0
  640. data/spec/helpers/elements_helper_spec.rb +311 -0
  641. data/spec/helpers/essences_helper_spec.rb +156 -0
  642. data/spec/helpers/pages_helper_spec.rb +413 -0
  643. data/spec/helpers/picture_url_helpers_spec.rb +35 -0
  644. data/spec/helpers/url_helper_spec.rb +174 -0
  645. data/spec/javascripts/alchemy/dialog_spec.coffee +82 -0
  646. data/spec/javascripts/alchemy/link_overlay_spec.coffee +25 -0
  647. data/spec/javascripts/alchemy_integration_spec.coffee +3 -0
  648. data/spec/javascripts/fixtures/select.html +3 -0
  649. data/spec/javascripts/helpers/mock-ajax.js +199 -0
  650. data/spec/javascripts/helpers/test_responses/test_responses.js +1 -0
  651. data/spec/javascripts/support/jasmine.yml +29 -0
  652. data/spec/libraries/auth_accessors_spec.rb +40 -0
  653. data/spec/libraries/config_spec.rb +112 -0
  654. data/spec/libraries/controller_actions_spec.rb +133 -0
  655. data/spec/libraries/i18n_spec.rb +30 -0
  656. data/spec/libraries/kaminari/scoped_pagination_url_helper_spec.rb +30 -0
  657. data/spec/libraries/modules_spec.rb +67 -0
  658. data/spec/libraries/mount_point_spec.rb +77 -0
  659. data/spec/libraries/on_page_layout_spec.rb +112 -0
  660. data/spec/libraries/page_layout_spec.rb +144 -0
  661. data/spec/libraries/permissions_spec.rb +261 -0
  662. data/spec/libraries/resource_spec.rb +371 -0
  663. data/spec/libraries/resources_helper_spec.rb +144 -0
  664. data/spec/libraries/shell_spec.rb +125 -0
  665. data/spec/libraries/template_tracker_spec.rb +94 -0
  666. data/spec/libraries/tinymce_spec.rb +67 -0
  667. data/spec/libraries/userstamp_spec.rb +10 -0
  668. data/spec/mailers/messages_spec.rb +23 -0
  669. data/spec/models/attachment_spec.rb +227 -0
  670. data/spec/models/cell_spec.rb +102 -0
  671. data/spec/models/content_spec.rb +404 -0
  672. data/spec/models/dummy_model_spec.rb +11 -0
  673. data/spec/models/element_spec.rb +617 -0
  674. data/spec/models/element_to_page_spec.rb +14 -0
  675. data/spec/models/essence_boolean_spec.rb +10 -0
  676. data/spec/models/essence_date_spec.rb +29 -0
  677. data/spec/models/essence_file_spec.rb +43 -0
  678. data/spec/models/essence_html_spec.rb +18 -0
  679. data/spec/models/essence_link_spec.rb +10 -0
  680. data/spec/models/essence_picture_spec.rb +183 -0
  681. data/spec/models/essence_richtext_spec.rb +18 -0
  682. data/spec/models/essence_select_spec.rb +10 -0
  683. data/spec/models/essence_text_spec.rb +114 -0
  684. data/spec/models/language_spec.rb +123 -0
  685. data/spec/models/legacy_page_url_spec.rb +21 -0
  686. data/spec/models/message_spec.rb +55 -0
  687. data/spec/models/page_spec.rb +1896 -0
  688. data/spec/models/picture_spec.rb +330 -0
  689. data/spec/models/site_spec.rb +233 -0
  690. data/spec/models/tag_spec.rb +31 -0
  691. data/spec/routing/api_routing_spec.rb +150 -0
  692. data/spec/routing/routing_spec.rb +234 -0
  693. data/spec/spec_helper.rb +89 -0
  694. data/spec/support/ci/install_phantomjs +7 -0
  695. data/spec/support/hint_examples.rb +30 -0
  696. data/spec/support/rspec-activemodel-mocks_patch.rb +8 -0
  697. data/spec/support/test_tweaks.rb +31 -0
  698. data/spec/support/transformation_examples.rb +180 -0
  699. data/spec/tasks/helpers_spec.rb +219 -0
  700. data/spec/views/essences/essence_boolean_editor_spec.rb +33 -0
  701. data/spec/views/essences/essence_boolean_view_spec.rb +25 -0
  702. data/spec/views/essences/essence_date_view_spec.rb +39 -0
  703. data/spec/views/essences/essence_file_editor_spec.rb +61 -0
  704. data/spec/views/essences/essence_file_view_spec.rb +24 -0
  705. data/spec/views/essences/essence_html_view_spec.rb +22 -0
  706. data/spec/views/essences/essence_link_view_spec.rb +41 -0
  707. data/spec/views/essences/essence_picture_view_spec.rb +129 -0
  708. data/spec/views/essences/essence_richtext_view_spec.rb +32 -0
  709. data/spec/views/essences/essence_select_view_spec.rb +12 -0
  710. data/spec/views/essences/essence_text_view_spec.rb +52 -0
  711. data/vendor/assets/images/Jcrop.gif +0 -0
  712. data/vendor/assets/javascripts/fileupload/jquery.fileupload-process.js +175 -0
  713. data/vendor/assets/javascripts/fileupload/jquery.fileupload-validate.js +122 -0
  714. data/vendor/assets/javascripts/fileupload/jquery.fileupload.js +1467 -0
  715. data/vendor/assets/javascripts/fileupload/jquery.iframe-transport.js +217 -0
  716. data/vendor/assets/javascripts/jquery_plugins/jquery.Jcrop.min.js +22 -0
  717. data/vendor/assets/javascripts/jquery_plugins/jquery.floatThead.min.js +3 -0
  718. data/vendor/assets/javascripts/jquery_plugins/jquery.scrollTo.min.js +7 -0
  719. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.nestedSortable.js +435 -0
  720. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.tabspaging.js +296 -0
  721. data/vendor/assets/javascripts/keymaster.js +296 -0
  722. data/vendor/assets/javascripts/requestAnimationFrame.js +31 -0
  723. data/vendor/assets/javascripts/spin.min.js +1 -0
  724. data/vendor/assets/javascripts/tinymce/langs/de.js +200 -0
  725. data/vendor/assets/javascripts/tinymce/langs/es.js +200 -0
  726. data/vendor/assets/javascripts/tinymce/langs/fr.js +200 -0
  727. data/vendor/assets/javascripts/tinymce/langs/nl.js +200 -0
  728. data/vendor/assets/javascripts/tinymce/langs/ru.js +200 -0
  729. data/vendor/assets/javascripts/tinymce/license.txt +504 -0
  730. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.min.js +1 -0
  731. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.min.js +1 -0
  732. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.min.js +1 -0
  733. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.min.js +1 -0
  734. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.min.js +1 -0
  735. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.min.js +1 -0
  736. data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.min.js +1 -0
  737. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.min.js +1 -0
  738. data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.min.js +1 -0
  739. data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.min.js +1 -0
  740. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.min.js +1 -0
  741. data/vendor/assets/javascripts/tinymce/themes/modern/theme.min.js +1 -0
  742. data/vendor/assets/javascripts/tinymce/tinymce.min.js +13 -0
  743. data/vendor/assets/stylesheets/jquery.Jcrop.min.css +28 -0
  744. metadata +1453 -0
@@ -0,0 +1,71 @@
1
+ require "spec_helper"
2
+
3
+ module Alchemy
4
+ describe Admin::EssenceFilesController do
5
+ before do
6
+ authorize_user(:as_admin)
7
+ end
8
+
9
+ let(:essence_file) { mock_model('EssenceFile', :attachment= => nil, content: content) }
10
+ let(:content) { mock_model('Content') }
11
+ let(:attachment) { mock_model('Attachment') }
12
+
13
+ describe '#edit' do
14
+ before do
15
+ expect(EssenceFile).to receive(:find)
16
+ .with(essence_file.id.to_s)
17
+ .and_return(essence_file)
18
+ end
19
+
20
+ it "assigns @essence_file with the EssenceFile found by id" do
21
+ alchemy_get :edit, id: essence_file.id
22
+ expect(assigns(:essence_file)).to eq(essence_file)
23
+ end
24
+
25
+ it "should assign @content with essence_file's content" do
26
+ alchemy_get :edit, id: essence_file.id
27
+ expect(assigns(:content)).to eq(content)
28
+ end
29
+ end
30
+
31
+ describe '#update' do
32
+ let(:essence_file) { FactoryGirl.create(:essence_file) }
33
+
34
+ before do
35
+ expect(EssenceFile).to receive(:find).and_return(essence_file)
36
+ end
37
+
38
+ it "should update the attributes of essence_file" do
39
+ alchemy_xhr :put, :update, id: essence_file.id, essence_file: {title: 'new title', css_class: 'left'}
40
+ expect(essence_file.title).to eq 'new title'
41
+ expect(essence_file.css_class).to eq 'left'
42
+ end
43
+ end
44
+
45
+ describe '#assign' do
46
+ let(:content) { create(:content) }
47
+
48
+ before do
49
+ expect(Content).to receive(:find_by).and_return(content)
50
+ expect(Attachment).to receive(:find_by).and_return(attachment)
51
+ allow(content).to receive(:essence).and_return(essence_file)
52
+ end
53
+
54
+ it "should assign @attachment with the Attachment found by attachment_id" do
55
+ alchemy_xhr :put, :assign, content_id: content.id, attachment_id: attachment.id
56
+ expect(assigns(:attachment)).to eq(attachment)
57
+ end
58
+
59
+ it "should assign @content.essence.attachment with the attachment found by id" do
60
+ expect(content.essence).to receive(:attachment=).with(attachment)
61
+ alchemy_xhr :put, :assign, content_id: content.id, attachment_id: attachment.id
62
+ end
63
+
64
+ it "updates the @content.updated_at column" do
65
+ expect {
66
+ alchemy_xhr :put, :assign, content_id: content.id, attachment_id: attachment.id
67
+ }.to change(content, :updated_at)
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,202 @@
1
+ require 'spec_helper'
2
+
3
+ module Alchemy
4
+ describe Admin::EssencePicturesController do
5
+ before { authorize_user(:as_admin) }
6
+
7
+ let(:essence) { EssencePicture.new }
8
+ let(:content) { Content.new }
9
+ let(:picture) { Picture.new }
10
+
11
+ describe '#edit' do
12
+ before do
13
+ expect(EssencePicture).to receive(:find).and_return(essence)
14
+ expect(Content).to receive(:find).and_return(content)
15
+ end
16
+
17
+ it 'should assign @essence_picture and @content instance variables' do
18
+ alchemy_post :edit, id: 1, content_id: 1
19
+ expect(assigns(:essence_picture)).to be_a(EssencePicture)
20
+ expect(assigns(:content)).to be_a(Content)
21
+ end
22
+ end
23
+
24
+ describe '#crop' do
25
+ before do
26
+ expect(EssencePicture).to receive(:find).and_return(essence)
27
+ end
28
+
29
+ context 'with no picture assigned' do
30
+ before do
31
+ expect(essence).to receive(:picture).at_least(:once).and_return(nil)
32
+ end
33
+
34
+ it "renders error message" do
35
+ alchemy_get :crop, id: 1
36
+ expect(assigns(:no_image_notice)).to eq(Alchemy::I18n.t(:no_image_for_cropper_found))
37
+ end
38
+ end
39
+
40
+ context 'with picture assigned' do
41
+ let(:default_mask) do
42
+ {
43
+ x1: 0,
44
+ y1: 0,
45
+ x2: 300,
46
+ y2: 250
47
+ }
48
+ end
49
+
50
+ before do
51
+ picture.image_file_width = 300
52
+ picture.image_file_height = 250
53
+ expect(essence).to receive(:picture).at_least(:once).and_return(picture)
54
+ end
55
+
56
+ context 'with no render_size present in essence' do
57
+ before do
58
+ expect(essence).to receive(:render_size).at_least(:once).and_return(nil)
59
+ end
60
+
61
+ context 'with sizes in params' do
62
+ it "sets sizes to given values" do
63
+ alchemy_get :crop, id: 1, options: {image_size: '300x250'}
64
+ expect(assigns(:min_size)).to eq({ width: 300, height: 250 })
65
+ end
66
+ end
67
+
68
+ context 'with no sizes in params' do
69
+ it "sets sizes to zero" do
70
+ alchemy_get :crop, id: 1
71
+ expect(assigns(:min_size)).to eq({ width: 0, height: 0 })
72
+ end
73
+ end
74
+ end
75
+
76
+ context 'with render_size present in essence' do
77
+ it "sets sizes from these values" do
78
+ expect(essence).to receive(:render_size).at_least(:once).and_return('30x25')
79
+
80
+ alchemy_get :crop, id: 1
81
+ expect(assigns(:min_size)).to eq({ width: 30, height: 25 })
82
+ end
83
+
84
+ context 'when width or height is not fixed' do
85
+ it 'infers the height from the image file preserving the aspect ratio' do
86
+ expect(essence).to receive(:render_size).at_least(:once).and_return('30x')
87
+
88
+ alchemy_get :crop, id: 1
89
+ expect(assigns(:min_size)).to eq({ width: 30, height: 0})
90
+ end
91
+
92
+ it 'does not infer the height from the image file preserving the aspect ratio' do
93
+ expect(essence).to receive(:render_size).at_least(:once).and_return('x25')
94
+
95
+ alchemy_get :crop, id: 1, options: { fixed_ratio: "2"}
96
+ expect(assigns(:min_size)).to eq({ width: 50, height: 25 })
97
+ end
98
+ end
99
+
100
+ context 'when width or height is not fixed and an aspect ratio is given' do
101
+ it 'width is given, it infers the height from width and ratio' do
102
+ expect(essence).to receive(:render_size).at_least(:once).and_return('30x')
103
+
104
+ alchemy_get :crop, id: 1, options: { fixed_ratio: "0.5" }
105
+ expect(assigns(:min_size)).to eq({ width: 30, height: 60 })
106
+ end
107
+
108
+ it 'infers the height from the image file preserving the aspect ratio' do
109
+ expect(essence).to receive(:render_size).at_least(:once).and_return('x25')
110
+
111
+ alchemy_get :crop, id: 1
112
+ expect(assigns(:min_size)).to eq({ width: 0, height: 25})
113
+ end
114
+ end
115
+ end
116
+
117
+ context 'no crop sizes present in essence' do
118
+ before do
119
+ expect(essence).to receive(:crop_from).and_return(nil)
120
+ allow(essence).to receive(:crop_size).and_return(nil)
121
+ end
122
+
123
+ it "assigns default mask boxes" do
124
+ alchemy_get :crop, id: 1
125
+ expect(assigns(:initial_box)).to eq(default_mask)
126
+ expect(assigns(:default_box)).to eq(default_mask)
127
+ end
128
+ end
129
+
130
+ context 'crop sizes present in essence' do
131
+ let(:mask) { {'x1' => '0', 'y1' => '0', 'x2' => '120', 'y2' => '160'} }
132
+
133
+ before do
134
+ allow(essence).to receive(:crop_from).and_return('0x0')
135
+ allow(essence).to receive(:crop_size).and_return('120x160')
136
+ end
137
+
138
+ it "assigns cropping boxes" do
139
+ expect(essence).to receive(:cropping_mask).and_return(mask)
140
+ alchemy_get :crop, id: 1
141
+ expect(assigns(:initial_box)).to eq(mask)
142
+ expect(assigns(:default_box)).to eq(default_mask)
143
+ end
144
+ end
145
+
146
+ context 'with fixed_ratio set to false' do
147
+ it "sets ratio to false" do
148
+ alchemy_get :crop, id: 1, options: {fixed_ratio: false}
149
+ expect(assigns(:ratio)).to eq(false)
150
+ end
151
+ end
152
+
153
+ context 'with no fixed_ratio set in params' do
154
+ it "sets a fixed ratio from sizes" do
155
+ alchemy_get :crop, id: 1, options: {image_size: '80x60'}
156
+ expect(assigns(:ratio)).to eq(80.0/60.0)
157
+ end
158
+ end
159
+ end
160
+ end
161
+
162
+ describe '#update' do
163
+ before do
164
+ expect(EssencePicture).to receive(:find).and_return(essence)
165
+ expect(Content).to receive(:find).and_return(content)
166
+ end
167
+
168
+ let(:attributes) { {render_size: '1x1', alt_tag: 'Alt Tag', caption: 'Caption', css_class: 'CSS Class', title: 'Title'} }
169
+
170
+ it "updates the essence attributes" do
171
+ expect(essence).to receive(:update).and_return(true)
172
+ alchemy_xhr :put, :update, id: 1, essence_picture: attributes
173
+ end
174
+
175
+ it "saves the cropping mask" do
176
+ expect(essence).to receive(:update).and_return(true)
177
+ alchemy_xhr :put, :update, id: 1, essence_picture: {render_size: '1x1', crop_from: '0x0', crop_size: '100x100'}
178
+ end
179
+ end
180
+
181
+ describe '#assign' do
182
+ let(:content) { create(:content) }
183
+
184
+ before do
185
+ expect(Content).to receive(:find).and_return(content)
186
+ expect(content).to receive(:essence).at_least(:once).and_return(essence)
187
+ expect(Picture).to receive(:find_by).and_return(picture)
188
+ end
189
+
190
+ it "should assign a Picture" do
191
+ alchemy_xhr :put, :assign, content_id: '1', picture_id: '1'
192
+ expect(assigns(:content).essence.picture).to eq(picture)
193
+ end
194
+
195
+ it "updates the content timestamp" do
196
+ expect {
197
+ alchemy_xhr :put, :assign, content_id: '1', picture_id: '1'
198
+ }.to change(content, :updated_at)
199
+ end
200
+ end
201
+ end
202
+ end
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe Alchemy::Admin::LanguagesController do
4
+
5
+ before do
6
+ authorize_user(:as_admin)
7
+ end
8
+
9
+ describe "#new" do
10
+ context "when default_language.page_layout is set" do
11
+ before do
12
+ allow(Alchemy::Config).to receive(:get) do |arg|
13
+ if arg == :default_language
14
+ {'page_layout' => "new_standard"}
15
+ else
16
+ Alchemy::Config.show[arg.to_s]
17
+ end
18
+ end
19
+ end
20
+
21
+ it "uses it as page_layout-default for the new language" do
22
+ alchemy_get :new
23
+ expect(assigns(:language).page_layout).to eq("new_standard")
24
+ end
25
+ end
26
+
27
+ context "when default_language is not configured" do
28
+ before do
29
+ allow(Alchemy::Config).to receive(:get) do |arg|
30
+ if arg == :default_language
31
+ nil
32
+ else
33
+ Alchemy::Config.show[arg.to_s]
34
+ end
35
+ end
36
+ end
37
+
38
+ it "falls back to default database value." do
39
+ alchemy_get :new
40
+ expect(assigns(:language).page_layout).to eq("intro")
41
+ end
42
+ end
43
+
44
+ context "when default language page_layout is not configured" do
45
+ before do
46
+ allow(Alchemy::Config).to receive(:get) do |arg|
47
+ if arg == :default_language
48
+ {}
49
+ else
50
+ Alchemy::Config.show[arg.to_s]
51
+ end
52
+ end
53
+ end
54
+
55
+ it "falls back to default database value." do
56
+ alchemy_get :new
57
+ expect(assigns(:language).page_layout).to eq("intro")
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ module Alchemy
4
+ describe Admin::LayoutpagesController do
5
+
6
+ before(:each) do
7
+ authorize_user(:as_admin)
8
+ end
9
+
10
+ describe "#index" do
11
+ it "should assign @locked_pages" do
12
+ alchemy_get :index
13
+ expect(assigns(:locked_pages)).to eq([])
14
+ end
15
+
16
+ it "should assign @layout_root" do
17
+ alchemy_get :index
18
+ expect(assigns(:layout_root)).to be_a(Page)
19
+ end
20
+
21
+ it "should assign @languages" do
22
+ alchemy_get :index
23
+ expect(assigns(:languages).first).to be_a(Language)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,553 @@
1
+ require 'ostruct'
2
+ require 'spec_helper'
3
+
4
+ module Alchemy
5
+ describe Admin::PagesController do
6
+
7
+ context 'a guest' do
8
+ it 'can not access page tree' do
9
+ alchemy_get :index
10
+ expect(request).to redirect_to(Alchemy.login_path)
11
+ end
12
+ end
13
+
14
+ context 'a member' do
15
+ before { authorize_user(build(:alchemy_dummy_user)) }
16
+
17
+ it 'can not access page tree' do
18
+ alchemy_get :index
19
+ expect(request).to redirect_to(root_path)
20
+ end
21
+ end
22
+
23
+ context 'with logged in editor user' do
24
+ let(:user) { build(:alchemy_dummy_user, :as_editor) }
25
+
26
+ before { authorize_user(user) }
27
+
28
+ describe '#index' do
29
+ let(:language) { build_stubbed(:language) }
30
+ let(:language_root) { build_stubbed(:language_root_page) }
31
+
32
+ context 'with existing language root page' do
33
+ before do
34
+ expect(Language).to receive(:current_root_page).and_return(language_root)
35
+ end
36
+
37
+ it "assigns @page_root variable" do
38
+ alchemy_get :index
39
+ expect(assigns(:page_root)).to be(language_root)
40
+ end
41
+ end
42
+
43
+ context 'without language root page' do
44
+ before do
45
+ expect(Language).to receive(:current_root_page).and_return(nil)
46
+ expect(Language).to receive(:find_by).and_return(language)
47
+ expect(Language).to receive(:all).and_return([language])
48
+ expect(Language).to receive(:with_root_page).and_return([language])
49
+ end
50
+
51
+ it "it assigns current language" do
52
+ alchemy_get :index
53
+ expect(assigns(:language)).to be(language)
54
+ end
55
+ end
56
+ end
57
+
58
+ describe "#flush" do
59
+ let(:language) { mock_model('Language', code: 'en', pages: double(flushables: [page_1, page_2])) }
60
+ let(:page_1) { build_stubbed(:page) }
61
+ let(:page_2) { build_stubbed(:page) }
62
+
63
+ before do
64
+ expect(Language).to receive(:current).at_least(:once).and_return(language)
65
+ end
66
+
67
+ it "should remove the cache of all pages" do
68
+ expect(page_1).to receive(:publish!)
69
+ expect(page_2).to receive(:publish!)
70
+ alchemy_xhr :post, :flush
71
+ end
72
+ end
73
+
74
+ describe '#new' do
75
+ context "pages in clipboard" do
76
+ let(:clipboard) { session[:alchemy_clipboard] = {} }
77
+ let(:page) { mock_model(Alchemy::Page, name: 'Foobar') }
78
+
79
+ before { clipboard['pages'] = [{'id' => page.id.to_s, 'action' => 'copy'}] }
80
+
81
+ it "should load all pages from clipboard" do
82
+ alchemy_xhr :get, :new, {page_id: page.id}
83
+ expect(assigns(:clipboard_items)).to be_kind_of(Array)
84
+ end
85
+ end
86
+ end
87
+
88
+ describe '#show' do
89
+ let(:page) { build_stubbed(:page, language_code: 'nl') }
90
+
91
+ before do
92
+ expect(Page).to receive(:find).with("#{page.id}").and_return(page)
93
+ allow(Page).to receive(:language_root_for).and_return(mock_model(Alchemy::Page))
94
+ end
95
+
96
+ it "should assign @preview_mode with true" do
97
+ alchemy_get :show, id: page.id
98
+ expect(assigns(:preview_mode)).to eq(true)
99
+ end
100
+
101
+ it "should store page as current preview" do
102
+ Page.current_preview = nil
103
+ alchemy_get :show, id: page.id
104
+ expect(Page.current_preview).to eq(page)
105
+ end
106
+
107
+ it "should set the I18n locale to the pages language code" do
108
+ alchemy_get :show, id: page.id
109
+ expect(::I18n.locale).to eq(:nl)
110
+ end
111
+
112
+ it "renders the application layout" do
113
+ alchemy_get :show, id: page.id
114
+ expect(response).to render_template(layout: 'application')
115
+ end
116
+ end
117
+
118
+ describe '#order' do
119
+ let(:page_1) { FactoryGirl.create(:page, visible: true) }
120
+ let(:page_2) { FactoryGirl.create(:page, visible: true) }
121
+ let(:page_3) { FactoryGirl.create(:page, visible: true) }
122
+ let(:page_item_1) { {id: page_1.id, slug: page_1.slug, restricted: false, external: page_1.redirects_to_external?, visible: page_1.visible?, children: [page_item_2]} }
123
+ let(:page_item_2) { {id: page_2.id, slug: page_2.slug, restricted: false, external: page_2.redirects_to_external?, visible: page_2.visible?, children: [page_item_3]} }
124
+ let(:page_item_3) { {id: page_3.id, slug: page_3.slug, restricted: false, external: page_3.redirects_to_external?, visible: page_3.visible? } }
125
+ let(:set_of_pages) { [page_item_1] }
126
+
127
+ it "stores the new order" do
128
+ alchemy_xhr :post, :order, set: set_of_pages.to_json
129
+ page_1.reload
130
+ expect(page_1.descendants).to eq([page_2, page_3])
131
+ end
132
+
133
+ context 'with url nesting enabled' do
134
+ before do
135
+ expect(Alchemy::Config).to receive(:get).with(:url_nesting).at_least(:once).and_return(true)
136
+ end
137
+
138
+ it "updates the pages urlnames" do
139
+ alchemy_xhr :post, :order, set: set_of_pages.to_json
140
+ [page_1, page_2, page_3].map(&:reload)
141
+ expect(page_1.urlname).to eq("#{page_1.slug}")
142
+ expect(page_2.urlname).to eq("#{page_1.slug}/#{page_2.slug}")
143
+ expect(page_3.urlname).to eq("#{page_1.slug}/#{page_2.slug}/#{page_3.slug}")
144
+ end
145
+
146
+ context 'with invisible page in tree' do
147
+ let(:page_item_2) do
148
+ {
149
+ id: page_2.id,
150
+ slug: page_2.slug,
151
+ children: [page_item_3],
152
+ visible: false
153
+ }
154
+ end
155
+
156
+ it "does not use this pages slug in urlnames of descendants" do
157
+ alchemy_xhr :post, :order, set: set_of_pages.to_json
158
+ [page_1, page_2, page_3].map(&:reload)
159
+ expect(page_1.urlname).to eq("#{page_1.slug}")
160
+ expect(page_2.urlname).to eq("#{page_1.slug}/#{page_2.slug}")
161
+ expect(page_3.urlname).to eq("#{page_1.slug}/#{page_3.slug}")
162
+ end
163
+ end
164
+
165
+ context 'with external page in tree' do
166
+ let(:page_item_2) do
167
+ {
168
+ id: page_2.id,
169
+ slug: page_2.slug,
170
+ children: [page_item_3],
171
+ external: true
172
+ }
173
+ end
174
+
175
+ it "does not use this pages slug in urlnames of descendants" do
176
+ alchemy_xhr :post, :order, set: set_of_pages.to_json
177
+ [page_1, page_2, page_3].map(&:reload)
178
+ expect(page_3.urlname).to eq("#{page_1.slug}/#{page_3.slug}")
179
+ end
180
+ end
181
+
182
+ context 'with restricted page in tree' do
183
+ let(:page_2) { FactoryGirl.create(:page, restricted: true) }
184
+ let(:page_item_2) do
185
+ {
186
+ id: page_2.id,
187
+ slug: page_2.slug,
188
+ children: [page_item_3],
189
+ restricted: true
190
+ }
191
+ end
192
+
193
+ it "updates restricted status of descendants" do
194
+ alchemy_xhr :post, :order, set: set_of_pages.to_json
195
+ page_3.reload
196
+ expect(page_3.restricted).to be_truthy
197
+ end
198
+ end
199
+
200
+ context 'with page having number as slug' do
201
+ let(:page_item_2) do
202
+ {
203
+ id: page_2.id,
204
+ slug: 42,
205
+ children: [page_item_3]
206
+ }
207
+ end
208
+
209
+ it "does not raise error" do
210
+ expect {
211
+ alchemy_xhr :post, :order, set: set_of_pages.to_json
212
+ }.not_to raise_error
213
+ end
214
+
215
+ it "still generates the correct urlname on page_3" do
216
+ alchemy_xhr :post, :order, set: set_of_pages.to_json
217
+ [page_1, page_2, page_3].map(&:reload)
218
+ expect(page_3.urlname).to eq("#{page_1.slug}/#{page_2.slug}/#{page_3.slug}")
219
+ end
220
+ end
221
+
222
+ it "creates legacy urls" do
223
+ alchemy_xhr :post, :order, set: set_of_pages.to_json
224
+ [page_2, page_3].map(&:reload)
225
+ expect(page_2.legacy_urls.size).to eq(1)
226
+ expect(page_3.legacy_urls.size).to eq(1)
227
+ end
228
+ end
229
+ end
230
+
231
+ describe "#configure" do
232
+ render_views
233
+
234
+ context "with page having nested urlname" do
235
+ let(:page) { create(:page, name: 'Foobar', urlname: 'foobar') }
236
+
237
+ it "should always show the slug" do
238
+ alchemy_xhr :get, :configure, {id: page.id}
239
+ expect(response.body).to match /value="foobar"/
240
+ end
241
+ end
242
+ end
243
+
244
+ describe '#create' do
245
+ let(:language) { mock_model('Language', code: 'kl') }
246
+ let(:parent) { mock_model('Page', language: language) }
247
+ let(:page_params) { {parent_id: parent.id, name: 'new Page'} }
248
+
249
+ context "a new page" do
250
+ before do
251
+ allow_any_instance_of(Page).to receive(:set_language_from_parent_or_default)
252
+ allow_any_instance_of(Page).to receive(:save).and_return(true)
253
+ end
254
+
255
+ it "is nested under given parent" do
256
+ allow(controller).to receive(:edit_admin_page_path).and_return('bla')
257
+ alchemy_xhr :post, :create, {page: page_params}
258
+ expect(assigns(:page).parent_id).to eq(parent.id)
259
+ end
260
+
261
+ it "redirects to edit page template" do
262
+ page = mock_model('Page')
263
+ expect(controller).to receive(:edit_admin_page_path).and_return('bla')
264
+ alchemy_post :create, page: page_params
265
+ expect(response).to redirect_to('bla')
266
+ end
267
+
268
+ context "if new page can not be saved" do
269
+ it "renders the create form" do
270
+ allow_any_instance_of(Page).to receive(:save).and_return(false)
271
+ alchemy_post :create, page: {name: 'page'}
272
+ expect(response).to render_template('new')
273
+ end
274
+ end
275
+
276
+ context "with redirect_to in params" do
277
+ let(:page_params) do
278
+ {name: "Foobar", page_layout: 'standard', parent_id: parent.id}
279
+ end
280
+
281
+ it "should redirect to given url" do
282
+ alchemy_post :create, page: page_params, redirect_to: admin_pictures_path
283
+ expect(response).to redirect_to(admin_pictures_path)
284
+ end
285
+
286
+ context "but new page can not be saved" do
287
+ render_views
288
+
289
+ it "should render the `new` template" do
290
+ allow_any_instance_of(Page).to receive(:save).and_return(false)
291
+ alchemy_xhr :post, :create, page: {name: 'page'}, redirect_to: admin_pictures_path
292
+ expect(response.body).to match /form.+action=\"\/admin\/pages\"/
293
+ end
294
+ end
295
+ end
296
+
297
+ context 'with page redirecting to external' do
298
+ it "redirects to sitemap" do
299
+ expect_any_instance_of(Page).to receive(:redirects_to_external?).and_return(true)
300
+ alchemy_post :create, page: page_params
301
+ expect(response).to redirect_to(admin_pages_path)
302
+ end
303
+ end
304
+ end
305
+
306
+ context "with paste_from_clipboard in parameters" do
307
+ let(:page_in_clipboard) { mock_model(Alchemy::Page) }
308
+
309
+ before do
310
+ allow(Page).to receive(:find_by).with(id: "#{parent.id}").and_return(parent)
311
+ allow(Page).to receive(:find).with("#{page_in_clipboard.id}").and_return(page_in_clipboard)
312
+ end
313
+
314
+ it "should call Page#copy_and_paste" do
315
+ expect(Page).to receive(:copy_and_paste).with(
316
+ page_in_clipboard,
317
+ parent,
318
+ 'pasted Page'
319
+ ).and_return(
320
+ mock_model('Page', save: true, name: 'pasted Page', redirects_to_external?: false)
321
+ )
322
+ alchemy_xhr :post, :create, {paste_from_clipboard: page_in_clipboard.id, page: {parent_id: parent.id, name: 'pasted Page'}}
323
+ end
324
+ end
325
+ end
326
+
327
+ describe '#copy_language_tree' do
328
+ let(:params) { {languages: {new_lang_id: '2', old_lang_id: '1'}} }
329
+ let(:language_root_to_copy_from) { build_stubbed(:language_root_page) }
330
+ let(:copy_of_language_root) { build_stubbed(:language_root_page) }
331
+ let(:root_page) { mock_model('Page') }
332
+
333
+ before do
334
+ allow(Page).to receive(:copy).and_return(copy_of_language_root)
335
+ allow(Page).to receive(:root).and_return(root_page)
336
+ allow(Page).to receive(:language_root_for).and_return(language_root_to_copy_from)
337
+ allow_any_instance_of(Page).to receive(:move_to_child_of)
338
+ allow_any_instance_of(Page).to receive(:copy_children_to)
339
+ allow(controller).to receive(:store_current_language)
340
+ allow(Language).to receive(:current).and_return(mock_model('Language', language_code: 'it', code: 'it'))
341
+ end
342
+
343
+ it "should copy the language root page over to the other language" do
344
+ expect(Page).to receive(:copy).with(language_root_to_copy_from, {language_id: '2', language_code: 'it'})
345
+ alchemy_post :copy_language_tree, params
346
+ end
347
+
348
+ it "should move the newly created language-root-page below the absolute root page" do
349
+ expect(copy_of_language_root).to receive(:move_to_child_of).with(root_page)
350
+ alchemy_post :copy_language_tree, params
351
+ end
352
+
353
+ it "should copy all childs of the original page over to the new created one" do
354
+ expect(controller).to receive(:language_root_to_copy_from).and_return(language_root_to_copy_from)
355
+ expect(controller).to receive(:copy_of_language_root).and_return(copy_of_language_root)
356
+ expect(language_root_to_copy_from).to receive(:copy_children_to).with(copy_of_language_root)
357
+ alchemy_post :copy_language_tree, params
358
+ end
359
+
360
+ it "should redirect to admin_pages_path" do
361
+ allow(controller).to receive(:copy_of_language_root)
362
+ allow(controller).to receive(:language_root_to_copy_from).and_return(double(copy_children_to: nil))
363
+ alchemy_post :copy_language_tree, params
364
+ expect(response).to redirect_to(admin_pages_path)
365
+ end
366
+ end
367
+
368
+ describe '#edit' do
369
+ let!(:page) { create(:page) }
370
+ let!(:other_user) { create(:alchemy_dummy_user, :as_author) }
371
+
372
+ context 'if page is locked by another user' do
373
+ before { page.lock_to!(other_user) }
374
+
375
+ context 'that is signed in' do
376
+ before do
377
+ expect_any_instance_of(DummyUser).to receive(:logged_in?).and_return(true)
378
+ end
379
+
380
+ it 'redirects to sitemap' do
381
+ alchemy_get :edit, id: page.id
382
+ expect(response).to redirect_to(admin_pages_path)
383
+ end
384
+ end
385
+
386
+ context 'that is not signed in' do
387
+ before do
388
+ expect_any_instance_of(DummyUser).to receive(:logged_in?).and_return(false)
389
+ end
390
+
391
+ it 'renders the edit view' do
392
+ alchemy_get :edit, id: page.id
393
+ expect(response).to render_template(:edit)
394
+ end
395
+ end
396
+ end
397
+
398
+ context 'if page is locked by myself' do
399
+ before do
400
+ expect_any_instance_of(Page).to receive(:locker).and_return(user)
401
+ expect(user).to receive(:logged_in?).and_return(true)
402
+ end
403
+
404
+ it 'renders the edit view' do
405
+ alchemy_get :edit, id: page.id
406
+ expect(response).to render_template(:edit)
407
+ end
408
+ end
409
+
410
+ context 'if page is not locked' do
411
+ before do
412
+ expect_any_instance_of(Page).to receive(:locker).and_return(nil)
413
+ end
414
+
415
+ it 'renders the edit view' do
416
+ alchemy_get :edit, id: page.id
417
+ expect(response).to render_template(:edit)
418
+ end
419
+
420
+ it "lockes the page to myself" do
421
+ expect_any_instance_of(Page).to receive(:lock_to!)
422
+ alchemy_get :edit, id: page.id
423
+ end
424
+ end
425
+ end
426
+
427
+ describe '#destroy' do
428
+ let(:clipboard) { session[:alchemy_clipboard] = {} }
429
+ let(:page) { FactoryGirl.create(:public_page) }
430
+
431
+ before { clipboard['pages'] = [{'id' => page.id.to_s}] }
432
+
433
+ it "should also remove the page from clipboard" do
434
+ alchemy_xhr :post, :destroy, {id: page.id, _method: :delete}
435
+ expect(clipboard['pages']).to be_empty
436
+ end
437
+ end
438
+
439
+ describe '#publish' do
440
+ let(:page) { stub_model(Page, published_at: nil, public: false, name: "page", parent_id: 1, urlname: "page", language: stub_model(Language), page_layout: "bla") }
441
+
442
+ before do
443
+ allow(@controller).to receive(:load_page).and_return(page)
444
+ @controller.instance_variable_set("@page", page)
445
+ end
446
+
447
+ it "should publish the page" do
448
+ expect(page).to receive(:publish!)
449
+ alchemy_post :publish, { id: page.id }
450
+ end
451
+ end
452
+
453
+ describe '#visit' do
454
+ let(:page) { mock_model(Alchemy::Page, urlname: 'home') }
455
+
456
+ before do
457
+ allow(Page).to receive(:find).with("#{page.id}").and_return(page)
458
+ allow(page).to receive(:unlock!).and_return(true)
459
+ allow(@controller).to receive(:multi_language?).and_return(false)
460
+ end
461
+
462
+ it "should redirect to the page path" do
463
+ expect(alchemy_post :visit, id: page.id).to redirect_to(show_page_path(urlname: 'home'))
464
+ end
465
+ end
466
+
467
+ describe '#fold' do
468
+ let(:page) { mock_model(Alchemy::Page) }
469
+ before { allow(Page).to receive(:find).and_return(page) }
470
+
471
+ context "if page is currently not folded" do
472
+ before { allow(page).to receive(:folded?).and_return(false) }
473
+
474
+ it "should fold the page" do
475
+ expect(page).to receive(:fold!).with(user.id, true).and_return(true)
476
+ alchemy_xhr :post, :fold, id: page.id
477
+ end
478
+ end
479
+
480
+ context "if page is already folded" do
481
+ before { allow(page).to receive(:folded?).and_return(true) }
482
+
483
+ it "should unfold the page" do
484
+ expect(page).to receive(:fold!).with(user.id, false).and_return(true)
485
+ alchemy_xhr :post, :fold, id: page.id
486
+ end
487
+ end
488
+ end
489
+
490
+ describe '#sort' do
491
+ before { allow(Page).to receive(:language_root_for).and_return(mock_model(Alchemy::Page)) }
492
+
493
+ it "should assign @sorting with true" do
494
+ alchemy_xhr :get, :sort
495
+ expect(assigns(:sorting)).to eq(true)
496
+ end
497
+ end
498
+
499
+ describe '#unlock' do
500
+ let(:page) { mock_model(Alchemy::Page, name: 'Best practices') }
501
+
502
+ before do
503
+ allow(Page).to receive(:find).with("#{page.id}").and_return(page)
504
+ allow(Page).to receive(:from_current_site).and_return(double(all_locked_by: nil))
505
+ expect(page).to receive(:unlock!).and_return(true)
506
+ end
507
+
508
+ it "should unlock the page" do
509
+ alchemy_xhr :post, :unlock, id: "#{page.id}"
510
+ end
511
+
512
+ context 'requesting for html format' do
513
+ it "should redirect to admin_pages_path" do
514
+ expect(alchemy_post :unlock, id: page.id).to redirect_to(admin_pages_path)
515
+ end
516
+
517
+ context 'if passing :redirect_to through params' do
518
+ it "should redirect to the given path" do
519
+ expect(alchemy_post :unlock, id: page.id, redirect_to: 'this/path').to redirect_to('this/path')
520
+ end
521
+ end
522
+ end
523
+ end
524
+
525
+ describe "#switch_language" do
526
+ let(:language) { build_stubbed(:klingonian)}
527
+
528
+ before do
529
+ allow(Language).to receive(:find_by).and_return(language)
530
+ end
531
+
532
+ it "should store the current language in session" do
533
+ alchemy_get :switch_language, {language_id: language.id}
534
+ expect(session[:alchemy_language_id]).to eq(language.id)
535
+ end
536
+
537
+ it "should redirect to sitemap" do
538
+ expect(alchemy_get :switch_language, {language_id: language.id}).to redirect_to(admin_pages_path)
539
+ end
540
+
541
+ context "coming from layoutpages" do
542
+ before {
543
+ allow(request).to receive(:referer).and_return('admin/layoutpages')
544
+ }
545
+
546
+ it "should redirect to layoutpages" do
547
+ expect(alchemy_get :switch_language, {language_id: language.id}).to redirect_to(admin_layoutpages_path)
548
+ end
549
+ end
550
+ end
551
+ end
552
+ end
553
+ end