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.
- data/.gitignore +1 -1
- data/.travis.yml +5 -13
- data/Gemfile +6 -3
- data/README.md +3 -2
- data/alchemy_cms.gemspec +22 -22
- data/app/assets/fonts/alchemy-icons.eot +0 -0
- data/app/assets/fonts/alchemy-icons.svg +54 -0
- data/app/assets/fonts/alchemy-icons.ttf +0 -0
- data/app/assets/fonts/alchemy-icons.woff +0 -0
- data/app/assets/images/alchemy/icons.png +0 -0
- data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +151 -0
- data/app/assets/javascripts/alchemy/alchemy.buttons.js.coffee +3 -2
- data/app/assets/javascripts/alchemy/alchemy.datepicker.js.coffee +31 -0
- data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +1 -1
- data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +98 -0
- data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +23 -24
- data/app/assets/javascripts/alchemy/alchemy.growler.js.coffee +27 -0
- data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +11 -8
- data/app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee +32 -0
- data/app/assets/javascripts/alchemy/alchemy.image_cropper.js.coffee +46 -0
- data/app/assets/javascripts/alchemy/alchemy.js +8 -2
- data/app/assets/javascripts/alchemy/alchemy.link_overlay.js.coffee +5 -4
- data/app/assets/javascripts/alchemy/alchemy.list_filter.js.coffee +49 -0
- data/app/assets/javascripts/alchemy/alchemy.onload.js.coffee +3 -0
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +71 -0
- data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +61 -0
- data/app/assets/javascripts/alchemy/alchemy.spinner.js.coffee +35 -0
- data/app/assets/javascripts/alchemy/alchemy.string_extension.js.coffee +11 -0
- data/app/assets/javascripts/alchemy/alchemy.windows.js.coffee +278 -0
- data/app/assets/stylesheets/alchemy/admin.css.scss +2 -0
- data/app/assets/stylesheets/alchemy/archive.scss +109 -65
- data/app/assets/stylesheets/alchemy/base.scss +16 -188
- data/app/assets/stylesheets/alchemy/dashboard.scss +2 -2
- data/app/assets/stylesheets/alchemy/defaults.scss +2 -1
- data/app/assets/stylesheets/alchemy/elements.scss +58 -94
- data/app/assets/stylesheets/alchemy/errors.scss +2 -2
- data/app/assets/stylesheets/alchemy/{mixins.scss → extends.scss} +104 -80
- data/app/assets/stylesheets/alchemy/flash.scss +4 -6
- data/app/assets/stylesheets/alchemy/fonts.scss +46 -0
- data/app/assets/stylesheets/alchemy/form_elements.scss +46 -45
- data/app/assets/stylesheets/alchemy/frame.scss +20 -15
- data/app/assets/stylesheets/alchemy/icons.scss +22 -9
- data/app/assets/stylesheets/alchemy/jquery-ui.scss +476 -399
- data/app/assets/stylesheets/alchemy/login.scss +1 -1
- data/app/assets/stylesheets/alchemy/menubar.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/notices.scss +5 -5
- data/app/assets/stylesheets/alchemy/pagination.scss +25 -13
- data/app/assets/stylesheets/alchemy/search.scss +29 -17
- data/app/assets/stylesheets/alchemy/sitemap.scss +41 -36
- data/app/assets/stylesheets/alchemy/tables.scss +102 -50
- data/app/assets/stylesheets/alchemy/tinymce_dialog.css.scss +18 -16
- data/app/assets/stylesheets/alchemy/toolbar.scss +84 -24
- data/app/assets/stylesheets/alchemy/upload.scss +14 -9
- data/app/assets/stylesheets/alchemy/variables.scss +1 -0
- data/app/assets/stylesheets/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css.scss +18 -21
- data/app/controllers/alchemy/admin/attachments_controller.rb +29 -39
- data/app/controllers/alchemy/admin/base_controller.rb +3 -9
- data/app/controllers/alchemy/admin/clipboard_controller.rb +1 -1
- data/app/controllers/alchemy/admin/contents_controller.rb +1 -1
- data/app/controllers/alchemy/admin/dashboard_controller.rb +1 -1
- data/app/controllers/alchemy/admin/elements_controller.rb +3 -3
- data/app/controllers/alchemy/admin/essence_files_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +5 -5
- data/app/controllers/alchemy/admin/languages_controller.rb +1 -1
- data/app/controllers/alchemy/admin/pages_controller.rb +18 -16
- data/app/controllers/alchemy/admin/pictures_controller.rb +11 -10
- data/app/controllers/alchemy/admin/resources_controller.rb +87 -14
- data/app/controllers/alchemy/admin/tags_controller.rb +3 -3
- data/app/controllers/alchemy/admin/trash_controller.rb +3 -3
- data/app/controllers/alchemy/admin/users_controller.rb +6 -11
- data/app/controllers/alchemy/attachments_controller.rb +8 -9
- data/app/controllers/alchemy/base_controller.rb +17 -10
- data/app/controllers/alchemy/pages_controller.rb +7 -19
- data/app/controllers/alchemy/passwords_controller.rb +15 -3
- data/app/controllers/alchemy/user_sessions_controller.rb +5 -4
- data/app/controllers/alchemy/users_controller.rb +1 -1
- data/app/helpers/alchemy/admin/attachments_helper.rb +2 -2
- data/app/helpers/alchemy/admin/base_helper.rb +62 -90
- data/app/helpers/alchemy/admin/elements_helper.rb +13 -5
- data/app/helpers/alchemy/admin/essences_helper.rb +3 -5
- data/app/helpers/alchemy/admin/pages_helper.rb +6 -3
- data/app/helpers/alchemy/admin/tags_helper.rb +60 -0
- data/app/helpers/alchemy/base_helper.rb +16 -20
- data/app/helpers/alchemy/elements_helper.rb +7 -11
- data/app/helpers/alchemy/essences_helper.rb +2 -2
- data/app/helpers/alchemy/pages_helper.rb +31 -69
- data/app/helpers/alchemy/url_helper.rb +11 -3
- data/app/models/alchemy/attachment.rb +73 -45
- data/app/models/alchemy/cell.rb +1 -1
- data/app/models/alchemy/content.rb +20 -9
- data/app/models/alchemy/element.rb +9 -7
- data/app/models/alchemy/page.rb +15 -248
- data/app/models/alchemy/page/cells.rb +71 -0
- data/app/models/alchemy/page/elements.rb +147 -0
- data/app/models/alchemy/page/naming.rb +90 -0
- data/app/models/alchemy/picture.rb +18 -13
- data/app/models/alchemy/tag.rb +1 -1
- data/app/models/alchemy/user.rb +38 -6
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +14 -7
- data/app/views/alchemy/admin/attachments/_attachment.html.erb +17 -12
- data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +3 -8
- data/app/views/alchemy/admin/attachments/_files_list.html.erb +20 -12
- data/app/views/alchemy/admin/attachments/_overlay_file_list.html.erb +11 -0
- data/app/views/alchemy/admin/attachments/_tag_list.html.erb +31 -0
- data/app/views/alchemy/admin/attachments/archive_overlay.js.erb +4 -0
- data/app/views/alchemy/admin/attachments/edit.html.erb +8 -7
- data/app/views/alchemy/admin/attachments/index.html.erb +19 -12
- data/app/views/alchemy/admin/attachments/new.html.erb +2 -2
- data/app/views/alchemy/admin/attachments/show.html.erb +3 -0
- data/app/views/alchemy/admin/contents/_missing.html.erb +4 -4
- data/app/views/alchemy/admin/contents/create.js.erb +1 -1
- data/app/views/alchemy/admin/contents/new.html.erb +6 -3
- data/app/views/alchemy/admin/dashboard/_locked_pages.html.erb +1 -1
- data/app/views/alchemy/admin/dashboard/_users.html.erb +1 -1
- data/app/views/alchemy/admin/dashboard/index.html.erb +3 -3
- data/app/views/alchemy/admin/dashboard/info.html.erb +16 -13
- data/app/views/alchemy/admin/elements/_add_picture.html.erb +1 -1
- data/app/views/alchemy/admin/elements/_element_foot.html.erb +4 -4
- data/app/views/alchemy/admin/elements/_element_head.html.erb +1 -7
- data/app/views/alchemy/admin/elements/_elements_select.html.erb +2 -2
- data/app/views/alchemy/admin/elements/_new_element_form.html.erb +4 -4
- data/app/views/alchemy/admin/elements/_picture_gallery_editor.html.erb +1 -1
- data/app/views/alchemy/admin/elements/create.js.erb +2 -2
- data/app/views/alchemy/admin/elements/fold.js.erb +3 -6
- data/app/views/alchemy/admin/elements/new.html.erb +1 -1
- data/app/views/alchemy/admin/elements/order.js.erb +1 -1
- data/app/views/alchemy/admin/elements/trash.js.erb +1 -1
- data/app/views/alchemy/admin/elements/update.js.erb +2 -2
- data/app/views/alchemy/admin/essence_files/edit.html.erb +4 -4
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +17 -18
- data/app/views/alchemy/admin/essence_pictures/edit.html.erb +2 -2
- data/app/views/alchemy/admin/essence_pictures/update.js.erb +1 -0
- data/app/views/alchemy/admin/languages/_form.html.erb +12 -10
- data/app/views/alchemy/admin/languages/_language.html.erb +2 -1
- data/app/views/alchemy/admin/languages/_table.html.erb +3 -3
- data/app/views/alchemy/admin/languages/index.html.erb +15 -15
- data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +6 -6
- data/app/views/alchemy/admin/layoutpages/index.html.erb +41 -40
- data/app/views/alchemy/admin/pages/_contactform_links.html.erb +4 -4
- data/app/views/alchemy/admin/pages/_create_language_form.html.erb +6 -6
- data/app/views/alchemy/admin/pages/_external_link.html.erb +2 -2
- data/app/views/alchemy/admin/pages/_file_link.html.erb +3 -3
- data/app/views/alchemy/admin/pages/_internal_link.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_page.html.erb +13 -13
- data/app/views/alchemy/admin/pages/_page_for_links.html.erb +2 -4
- data/app/views/alchemy/admin/pages/_sitemap.html.erb +5 -0
- data/app/views/alchemy/admin/pages/configure.html.erb +7 -7
- data/app/views/alchemy/admin/pages/configure_external.html.erb +4 -4
- data/app/views/alchemy/admin/pages/edit.html.erb +23 -30
- data/app/views/alchemy/admin/pages/index.html.erb +34 -23
- data/app/views/alchemy/admin/pages/new.html.erb +1 -1
- data/app/views/alchemy/admin/pages/sort.js.erb +1 -1
- data/app/views/alchemy/admin/partials/_flash_upload.html.erb +2 -3
- data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +2 -2
- data/app/views/alchemy/admin/partials/_search_form.html.erb +3 -3
- data/app/views/alchemy/admin/partials/_upload_form.html.erb +2 -2
- data/app/views/alchemy/admin/pictures/_archive.html.erb +7 -7
- data/app/views/alchemy/admin/pictures/_archive_overlay.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +6 -6
- data/app/views/alchemy/admin/pictures/_filter_bar.html.erb +4 -4
- data/app/views/alchemy/admin/pictures/_overlay_picture_list.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_picture.html.erb +3 -8
- data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +9 -14
- data/app/views/alchemy/admin/pictures/_tag_list.html.erb +27 -25
- data/app/views/alchemy/admin/pictures/archive_overlay.js.erb +3 -1
- data/app/views/alchemy/admin/pictures/index.html.erb +49 -42
- data/app/views/alchemy/admin/pictures/new.html.erb +2 -2
- data/app/views/alchemy/admin/pictures/show.html.erb +11 -0
- data/app/views/alchemy/admin/resources/_boolean.html.erb +2 -2
- data/app/views/alchemy/admin/resources/_datetime.html.erb +2 -2
- data/app/views/alchemy/admin/resources/_form.html.erb +9 -8
- data/app/views/alchemy/admin/resources/_resource.html.erb +15 -21
- data/app/views/alchemy/admin/resources/_string.html.erb +2 -2
- data/app/views/alchemy/admin/resources/_table.html.erb +11 -13
- data/app/views/alchemy/admin/resources/_text.html.erb +2 -2
- data/app/views/alchemy/admin/resources/index.csv.erb +13 -0
- data/app/views/alchemy/admin/resources/index.html.erb +24 -15
- data/app/views/alchemy/admin/sites/index.html.erb +23 -0
- data/app/views/alchemy/admin/tags/_radio_tag.html.erb +1 -1
- data/app/views/alchemy/admin/tags/_tag.html.erb +2 -1
- data/app/views/alchemy/admin/tags/edit.html.erb +1 -1
- data/app/views/alchemy/admin/tags/index.html.erb +16 -11
- data/app/views/alchemy/admin/tags/new.html.erb +3 -3
- data/app/views/alchemy/admin/trash/clear.js.coffee +1 -1
- data/app/views/alchemy/admin/users/_table.html.erb +12 -5
- data/app/views/alchemy/admin/users/_user.html.erb +16 -16
- data/app/views/alchemy/admin/users/index.html.erb +28 -16
- data/app/views/alchemy/breadcrumb/_page.html.erb +15 -0
- data/app/views/alchemy/breadcrumb/_spacer.html.erb +1 -0
- data/app/views/alchemy/elements/_editor_not_found.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +16 -16
- data/app/views/alchemy/essences/_essence_file_view.html.erb +8 -9
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +3 -6
- data/app/views/alchemy/essences/_essence_picture_tools.html.erb +9 -8
- data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +0 -5
- data/app/views/alchemy/essences/_linkable_essence_tools.html.erb +2 -2
- data/app/views/alchemy/navigation/_link.html.erb +7 -7
- data/app/views/alchemy/navigation/_renderer.html.erb +29 -36
- data/app/views/alchemy/notifications/admin_user_created.de.text.erb +5 -1
- data/app/views/alchemy/notifications/admin_user_created.en.text.erb +5 -1
- data/app/views/alchemy/notifications/registered_user_created.de.text.erb +13 -0
- data/app/views/alchemy/notifications/registered_user_created.en.text.erb +13 -0
- data/app/views/alchemy/search/_result.html.erb +4 -6
- data/app/views/alchemy/search/_results.html.erb +4 -5
- data/app/views/alchemy/user_sessions/leave.html.erb +1 -1
- data/app/views/alchemy/user_sessions/new.html.erb +2 -2
- data/app/views/kaminari/_first_page.html.erb +11 -0
- data/app/views/kaminari/_gap.html.erb +1 -1
- data/app/views/kaminari/_last_page.html.erb +11 -0
- data/app/views/kaminari/_next_page.html.erb +2 -2
- data/app/views/kaminari/_page.html.erb +1 -1
- data/app/views/kaminari/_paginator.html.erb +2 -0
- data/app/views/kaminari/_prev_page.html.erb +2 -2
- data/app/views/layouts/alchemy/admin.html.erb +4 -5
- data/config/alchemy/config.yml +8 -12
- data/config/authorization_rules.rb +4 -3
- data/config/initializers/dragonfly.rb +20 -12
- data/config/locales/alchemy.de.yml +20 -15
- data/config/locales/alchemy.en.yml +15 -10
- data/config/locales/devise.de.yml +1 -0
- data/config/routes.rb +3 -3
- data/{spec/dummy/db/migrate/20121118000000_alchemy_two_point_four.rb → db/migrate/20130214233001_alchemy_two_point_five.rb} +50 -36
- data/db/migrate/20130221200514_migrate_attachments_to_dragonfly.rb +21 -0
- data/db/migrate/20130312205327_change_alchemy_users_role_to_roles.rb +11 -0
- data/lib/alchemy/capistrano.rb +10 -8
- data/lib/alchemy/errors.rb +7 -0
- data/lib/alchemy/filetypes.rb +33 -0
- data/lib/alchemy/i18n.rb +9 -1
- data/lib/alchemy/name_conversions.rb +28 -0
- data/lib/alchemy/page_layout.rb +5 -3
- data/lib/alchemy/resource.rb +132 -29
- data/lib/alchemy/resources_helper.rb +81 -12
- data/lib/alchemy/upgrader.rb +14 -276
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +17 -2
- data/lib/rails/generators/alchemy/deploy_script/templates/deploy.rb.tt +1 -1
- data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +1 -1
- data/lib/tasks/alchemy/convert.rake +39 -0
- data/lib/tasks/alchemy/install.rake +4 -6
- data/lib/tasks/alchemy/upgrade.rake +18 -1
- data/spec/controllers/admin/clipboard_controller_spec.rb +4 -4
- data/spec/controllers/admin/elements_controller_spec.rb +23 -23
- data/spec/controllers/admin/pages_controller_spec.rb +15 -0
- data/spec/controllers/admin/resources_controller_spec.rb +1 -11
- data/spec/controllers/admin/trash_controller_spec.rb +9 -9
- data/spec/controllers/attachments_controller_spec.rb +3 -3
- data/spec/controllers/elements_controller_spec.rb +2 -2
- data/spec/controllers/pages_controller_spec.rb +160 -129
- data/spec/controllers/pictures_controller_spec.rb +2 -2
- data/spec/controllers/user_sessions_controller_spec.rb +3 -3
- data/spec/controllers/users_controller_spec.rb +2 -2
- data/spec/dummy/app/models/event.rb +2 -2
- data/spec/dummy/app/models/location.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +6 -42
- data/spec/dummy/config/routes.rb +1 -1
- data/spec/dummy/db/migrate/20121026104128_create_events.rb +0 -1
- data/{db/migrate/20121118000000_alchemy_two_point_four.rb → spec/dummy/db/migrate/20130214233001_alchemy_two_point_five.rb} +50 -36
- data/spec/dummy/db/migrate/20130221200514_migrate_attachments_to_dragonfly.rb +21 -0
- data/spec/dummy/db/migrate/20130312205327_change_alchemy_users_role_to_roles.rb +11 -0
- data/spec/dummy/db/migrate/20130328101418_create_locations.rb +9 -0
- data/spec/dummy/db/schema.rb +15 -6
- data/spec/factories.rb +4 -4
- data/spec/{integration → features}/admin/link_overlay_spec.rb +0 -0
- data/spec/{integration → features}/admin/modules_integration_spec.rb +1 -1
- data/spec/{integration → features}/admin/pages_controller_spec.rb +9 -4
- data/spec/{integration → features}/admin/picture_library_integration_spec.rb +5 -5
- data/spec/{integration → features}/admin/resources_integration_spec.rb +1 -1
- data/spec/{integration → features}/navigation_spec.rb +0 -0
- data/spec/{integration → features}/pages_controller_spec.rb +42 -112
- data/spec/{integration → features}/picture_security_spec.rb +2 -2
- data/spec/{integration → features}/security_spec.rb +7 -7
- data/spec/{integration → features}/translation_integration_spec.rb +0 -0
- data/spec/helpers/admin/base_helper_spec.rb +0 -50
- data/spec/helpers/admin/tags_helper_spec.rb +53 -0
- data/spec/helpers/base_helper_spec.rb +19 -3
- data/spec/helpers/pages_helper_spec.rb +92 -44
- data/spec/{url_helpers_spec.rb → helpers/picture_url_helpers_spec.rb} +7 -7
- data/spec/helpers/url_helper_spec.rb +92 -72
- data/spec/{config_spec.rb → libraries/config_spec.rb} +0 -0
- data/spec/libraries/resource_spec.rb +215 -76
- data/spec/libraries/resources_helper_spec.rb +70 -28
- data/spec/models/attachment_spec.rb +75 -9
- data/spec/models/clipboard_spec.rb +1 -1
- data/spec/models/element_spec.rb +7 -0
- data/spec/models/page_spec.rb +144 -25
- data/spec/models/picture_spec.rb +5 -5
- data/spec/models/resource_spec.rb +47 -10
- data/spec/models/user_spec.rb +115 -3
- data/spec/{routing_spec.rb → routing/routing_spec.rb} +8 -20
- data/spec/spec_helper.rb +5 -6
- data/spec/support/alchemy/specs_helpers.rb +1 -1
- data/spec/support/ci/install_phantomjs +1 -1
- data/spec/support/image with spaces.png +0 -0
- data/vendor/assets/javascripts/jquery_plugins/jquery.Jcrop.min.js +18 -18
- data/vendor/assets/javascripts/jquery_plugins/{jquery.dialogextend.1_0_1.js → jquery.dialogextend.js} +25 -17
- data/vendor/assets/javascripts/jquery_plugins/jquery.scrollTo.min.js +7 -0
- data/vendor/assets/javascripts/jquery_plugins/jquery.ui.tabspaging.js +7 -7
- data/vendor/assets/javascripts/keymage.min.js +6 -0
- data/vendor/assets/javascripts/spin.min.js +1 -0
- metadata +122 -124
- data/app/assets/images/alchemy/ajax_loader.gif +0 -0
- data/app/assets/images/alchemy/gui/toggle.png +0 -0
- data/app/assets/images/alchemy/image_loader.gif +0 -0
- data/app/assets/images/alchemy/shading.png +0 -0
- data/app/assets/images/alchemy/tabs.gif +0 -0
- data/app/assets/javascripts/alchemy/alchemy.base.js +0 -172
- data/app/assets/javascripts/alchemy/alchemy.datepicker.js +0 -47
- data/app/assets/javascripts/alchemy/alchemy.element_editor_selector.js +0 -91
- data/app/assets/javascripts/alchemy/alchemy.growler.js +0 -46
- data/app/assets/javascripts/alchemy/alchemy.image_cropper.js +0 -60
- data/app/assets/javascripts/alchemy/alchemy.js_extensions.js +0 -15
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js +0 -97
- data/app/assets/javascripts/alchemy/alchemy.windows.js +0 -321
- data/app/models/alchemy/clipboard_spec.rb +0 -0
- data/app/views/alchemy/admin/pictures/show_in_window.html.erb +0 -8
- data/app/views/alchemy/notifications/registered_user_created.text.erb +0 -11
- data/db/migrate/20121121162313_switch_from_fleximage_to_dragonfly.rb +0 -21
- data/db/migrate/20121205155004_create_alchemy_sites.rb +0 -14
- data/db/migrate/20121211163003_add_public_to_alchemy_sites.rb +0 -6
- data/db/migrate/20121220102223_add_aliases_to_site.rb +0 -6
- data/db/migrate/20130110212411_create_alchemy_legacy_page_urls.rb +0 -11
- data/db/migrate/20130121092645_migrate_to_devise.rb +0 -24
- data/spec/alchemy_spec.rb +0 -7
- data/spec/dummy/db/migrate/20121121162313_switch_from_fleximage_to_dragonfly.rb +0 -21
- data/spec/dummy/db/migrate/20121205155004_create_alchemy_sites.rb +0 -14
- data/spec/dummy/db/migrate/20121211163003_add_public_to_alchemy_sites.rb +0 -6
- data/spec/dummy/db/migrate/20121220102223_add_aliases_to_site.rb +0 -6
- data/spec/dummy/db/migrate/20130110212411_create_alchemy_legacy_page_urls.rb +0 -11
- data/spec/dummy/db/migrate/20130121092645_migrate_to_devise.rb +0 -24
- data/vendor/assets/javascripts/jquery_plugins/jquery.scrollTo-1.4.2-min.js +0 -11
data/lib/alchemy/version.rb
CHANGED
data/lib/alchemy_cms.rb
CHANGED
@@ -3,7 +3,6 @@ require 'rails'
|
|
3
3
|
if Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR == 2
|
4
4
|
require 'acts_as_list'
|
5
5
|
require 'acts-as-taggable-on'
|
6
|
-
require 'attachment_magic'
|
7
6
|
require 'devise'
|
8
7
|
require 'devise-encryptable'
|
9
8
|
require 'awesome_nested_set'
|
@@ -12,6 +11,7 @@ if Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR == 2
|
|
12
11
|
require 'jquery-rails'
|
13
12
|
require 'jquery-ui-rails'
|
14
13
|
require 'rails3-jquery-autocomplete'
|
14
|
+
require 'handles_sortable_columns'
|
15
15
|
require 'kaminari'
|
16
16
|
require 'userstamp'
|
17
17
|
require 'yaml'
|
@@ -28,7 +28,22 @@ if Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR == 2
|
|
28
28
|
require 'alchemy/auth_engine'
|
29
29
|
require 'alchemy/engine'
|
30
30
|
require 'alchemy/picture_attributes'
|
31
|
-
|
31
|
+
[
|
32
|
+
'config',
|
33
|
+
'logger',
|
34
|
+
'errors',
|
35
|
+
'essence',
|
36
|
+
'page_layout',
|
37
|
+
'modules',
|
38
|
+
'tinymce',
|
39
|
+
'i18n',
|
40
|
+
'scoped_pagination_url_helper',
|
41
|
+
'resource',
|
42
|
+
'resources_helper',
|
43
|
+
'ferret_search',
|
44
|
+
'filetypes',
|
45
|
+
'name_conversions'
|
46
|
+
].each do |class_name|
|
32
47
|
require File.join(File.dirname(__FILE__), "alchemy", class_name)
|
33
48
|
end
|
34
49
|
require File.join(File.dirname(__FILE__), "alchemy", "seeder")
|
@@ -94,7 +94,7 @@ namespace :deploy do
|
|
94
94
|
|
95
95
|
desc 'Seeds the database'
|
96
96
|
task :seed, :roles => :app, :except => { :no_release => true } do
|
97
|
-
run "cd #{release_path} && RAILS_ENV=#{rails_env}
|
97
|
+
run "cd #{release_path} #{rake} && RAILS_ENV=#{rails_env} db:seed"
|
98
98
|
end
|
99
99
|
|
100
100
|
end
|
@@ -37,7 +37,7 @@ module Alchemy
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def copy_alchemy_views
|
40
|
-
%w(messages navigation notifications search).each do |dir|
|
40
|
+
%w(breadcrumb messages navigation notifications search).each do |dir|
|
41
41
|
src = File.expand_path("../../../../../app/views/alchemy/#{dir}", File.dirname(__FILE__))
|
42
42
|
dest = Rails.root.join('app/views/alchemy', dir)
|
43
43
|
directory src, dest
|
@@ -0,0 +1,39 @@
|
|
1
|
+
namespace :alchemy do
|
2
|
+
namespace :convert do
|
3
|
+
|
4
|
+
namespace :urlnames do
|
5
|
+
|
6
|
+
desc "Converts the urlname of all pages to nested url paths."
|
7
|
+
task :to_nested => [:environment] do
|
8
|
+
unless Alchemy::Config.get(:url_nesting)
|
9
|
+
raise "\nURL nesting is disabled! Please enable url_nesting in `config/alchemy/config.yml` first.\n\n"
|
10
|
+
end
|
11
|
+
puts "Converting..."
|
12
|
+
pages = Alchemy::Page.contentpages
|
13
|
+
count = pages.count
|
14
|
+
pages.each_with_index do |page, n|
|
15
|
+
puts "Updating page #{n+1} of #{count}"
|
16
|
+
page.update_urlname!
|
17
|
+
end
|
18
|
+
puts "Done."
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Converts the urlname of all pages to contain the slug only."
|
22
|
+
task :to_slug => [:environment] do
|
23
|
+
if Alchemy::Config.get(:url_nesting)
|
24
|
+
raise "\nURL nesting is enabled! Please disable url_nesting in `config/alchemy/config.yml` first.\n\n"
|
25
|
+
end
|
26
|
+
puts "Converting..."
|
27
|
+
pages = Alchemy::Page.contentpages
|
28
|
+
count = pages.count
|
29
|
+
pages.each_with_index do |page, n|
|
30
|
+
puts "Updating page #{n+1} of #{count}"
|
31
|
+
page.update_attribute :urlname, page.slug
|
32
|
+
end
|
33
|
+
puts "Done."
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -17,14 +17,12 @@ end
|
|
17
17
|
|
18
18
|
namespace :alchemy do
|
19
19
|
|
20
|
+
desc "Creates, migrates and seeds the database to run Alchemy."
|
21
|
+
task :prepare => ["db:create", "alchemy:install:migrations", "db:migrate", "alchemy:db:seed"]
|
22
|
+
|
20
23
|
desc "Installs Alchemy CMS into your app."
|
21
|
-
task :install do
|
22
|
-
Rake::Task["db:create"].invoke
|
23
|
-
Rake::Task["alchemy:install:migrations"].invoke
|
24
|
-
Rake::Task["alchemy:mount"].invoke
|
24
|
+
task :install => ["alchemy:prepare", "alchemy:mount"] do
|
25
25
|
system("rails g alchemy:scaffold")
|
26
|
-
Rake::Task["db:migrate"].invoke
|
27
|
-
Rake::Task["alchemy:db:seed"].invoke
|
28
26
|
puts <<-EOF
|
29
27
|
|
30
28
|
\\o/ Successfully installed Alchemy CMS \\o/
|
@@ -2,9 +2,26 @@ require File.join(File.dirname(__FILE__), '../../alchemy/upgrader.rb')
|
|
2
2
|
|
3
3
|
namespace :alchemy do
|
4
4
|
|
5
|
-
desc "Upgrades database to Alchemy CMS v#{Alchemy::VERSION}."
|
5
|
+
desc "Upgrades database content to Alchemy CMS v#{Alchemy::VERSION} (Set UPGRADE env variable to only run a specific task)."
|
6
6
|
task :upgrade => :environment do
|
7
7
|
Alchemy::Upgrader.run!
|
8
8
|
end
|
9
9
|
|
10
|
+
namespace :upgrade do
|
11
|
+
desc "List all available upgrade tasks."
|
12
|
+
task :list => [:environment] do
|
13
|
+
puts "\nAvailable upgrade tasks"
|
14
|
+
puts "-----------------------\n"
|
15
|
+
methods = (Alchemy::Upgrader.private_methods - Object.private_methods - Alchemy::Upgrader.superclass.private_methods)
|
16
|
+
if methods.any?
|
17
|
+
methods.each { |method| puts method }
|
18
|
+
puts "\nUsage:"
|
19
|
+
puts "------"
|
20
|
+
puts "Run one or more tasks with `bundle exec rake alchemy:upgrade UPGRADE=task_name1,task_name2`\n"
|
21
|
+
else
|
22
|
+
puts "No upgrades available."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
10
27
|
end
|
@@ -3,9 +3,9 @@ require 'spec_helper'
|
|
3
3
|
module Alchemy
|
4
4
|
describe Admin::ClipboardController do
|
5
5
|
|
6
|
-
let(:
|
7
|
-
let(:element) { FactoryGirl.create(:element, :page =>
|
8
|
-
let(:another_element) { FactoryGirl.create(:element, :page =>
|
6
|
+
let(:public_page) { FactoryGirl.create(:public_page) }
|
7
|
+
let(:element) { FactoryGirl.create(:element, :page => public_page) }
|
8
|
+
let(:another_element) { FactoryGirl.create(:element, :page => public_page) }
|
9
9
|
|
10
10
|
before do
|
11
11
|
sign_in :user, FactoryGirl.create(:admin_user)
|
@@ -48,7 +48,7 @@ module Alchemy
|
|
48
48
|
|
49
49
|
context "with pages as remarkable_type" do
|
50
50
|
it "should clear the pages clipboard" do
|
51
|
-
session[:clipboard][:pages] = {:id =>
|
51
|
+
session[:clipboard][:pages] = {:id => public_page.id}
|
52
52
|
delete(:clear, {:remarkable_type => :pages, :format => :js})
|
53
53
|
session[:clipboard].should be_empty
|
54
54
|
end
|
@@ -7,9 +7,9 @@ module Alchemy
|
|
7
7
|
sign_in :user, FactoryGirl.create(:admin_user)
|
8
8
|
end
|
9
9
|
|
10
|
-
let(:
|
11
|
-
let(:element) { FactoryGirl.create(:element, :page_id =>
|
12
|
-
let(:element_in_clipboard) { FactoryGirl.create(:element, :page_id =>
|
10
|
+
let(:alchemy_page) { FactoryGirl.create(:page, :urlname => 'lulu') }
|
11
|
+
let(:element) { FactoryGirl.create(:element, :page_id => alchemy_page.id) }
|
12
|
+
let(:element_in_clipboard) { FactoryGirl.create(:element, :page_id => alchemy_page.id) }
|
13
13
|
let(:clipboard) { session[:clipboard] = Clipboard.new }
|
14
14
|
|
15
15
|
describe '#create' do
|
@@ -17,9 +17,9 @@ module Alchemy
|
|
17
17
|
before { element }
|
18
18
|
|
19
19
|
it "should insert the element at bottom of list" do
|
20
|
-
post :create, {:element => {:name => 'news', :page_id =>
|
21
|
-
|
22
|
-
|
20
|
+
post :create, {:element => {:name => 'news', :page_id => alchemy_page.id}, :format => :js}
|
21
|
+
alchemy_page.elements.count.should == 2
|
22
|
+
alchemy_page.elements.last.name.should == 'news'
|
23
23
|
end
|
24
24
|
|
25
25
|
context "on a page with a setting for insert_elements_at of top" do
|
@@ -33,9 +33,9 @@ module Alchemy
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should insert the element at top of list" do
|
36
|
-
post :create, {:element => {:name => 'news', :page_id =>
|
37
|
-
|
38
|
-
|
36
|
+
post :create, {:element => {:name => 'news', :page_id => alchemy_page.id}, :format => :js}
|
37
|
+
alchemy_page.elements.count.should == 2
|
38
|
+
alchemy_page.elements.first.name.should == 'news'
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -44,7 +44,7 @@ module Alchemy
|
|
44
44
|
|
45
45
|
before do
|
46
46
|
Cell.stub!(:definition_for).and_return({'name' => 'header', 'elements' => ['header']})
|
47
|
-
controller.instance_variable_set(:@page,
|
47
|
+
controller.instance_variable_set(:@page, alchemy_page)
|
48
48
|
end
|
49
49
|
|
50
50
|
context "with element name and cell name in the params" do
|
@@ -59,18 +59,18 @@ module Alchemy
|
|
59
59
|
it "should create the cell" do
|
60
60
|
expect {
|
61
61
|
controller.send(:find_or_create_cell)
|
62
|
-
}.to change(
|
62
|
+
}.to change(alchemy_page.cells, :count).from(0).to(1)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
context "with the cell already present" do
|
67
67
|
|
68
|
-
before { FactoryGirl.create(:cell, :page =>
|
68
|
+
before { FactoryGirl.create(:cell, :page => alchemy_page, :name => 'header') }
|
69
69
|
|
70
70
|
it "should load the cell" do
|
71
71
|
expect {
|
72
72
|
controller.send(:find_or_create_cell)
|
73
|
-
}.to_not change(
|
73
|
+
}.to_not change(alchemy_page.cells, :count)
|
74
74
|
end
|
75
75
|
|
76
76
|
end
|
@@ -98,9 +98,9 @@ module Alchemy
|
|
98
98
|
render_views
|
99
99
|
|
100
100
|
it "should return a select tag with elements" do
|
101
|
-
Alchemy::Page.should_receive(:find_by_urlname_and_language_id).and_return(
|
101
|
+
Alchemy::Page.should_receive(:find_by_urlname_and_language_id).and_return(alchemy_page)
|
102
102
|
Alchemy::Element.stub_chain([:published, :find_all_by_page_id]).and_return([element])
|
103
|
-
get :list, {:page_urlname =>
|
103
|
+
get :list, {:page_urlname => alchemy_page.urlname, :format => :js}
|
104
104
|
response.body.should match(/select(.*)elements_from_page_selector(.*)option/)
|
105
105
|
end
|
106
106
|
|
@@ -145,7 +145,7 @@ module Alchemy
|
|
145
145
|
end
|
146
146
|
|
147
147
|
it "should load all elements from clipboard" do
|
148
|
-
get :new, {:page_id =>
|
148
|
+
get :new, {:page_id => alchemy_page.id, :format => :js}
|
149
149
|
assigns(:clipboard_items).should be_kind_of(Array)
|
150
150
|
end
|
151
151
|
|
@@ -232,10 +232,10 @@ module Alchemy
|
|
232
232
|
end
|
233
233
|
|
234
234
|
context "on a page with a setting for insert_elements_at of top" do
|
235
|
-
let(:
|
236
|
-
let(:element_in_clipboard) { FactoryGirl.create(:element, :page =>
|
237
|
-
let(:cell) {
|
238
|
-
let(:element) { FactoryGirl.create(:element, :name => 'news', :page =>
|
235
|
+
let(:alchemy_page) { FactoryGirl.create(:public_page, :name => 'News') }
|
236
|
+
let(:element_in_clipboard) { FactoryGirl.create(:element, :page => alchemy_page, :name => 'news') }
|
237
|
+
let(:cell) { alchemy_page.cells.first }
|
238
|
+
let(:element) { FactoryGirl.create(:element, :name => 'news', :page => alchemy_page, :cell => cell) }
|
239
239
|
|
240
240
|
before do
|
241
241
|
PageLayout.stub(:get).and_return({
|
@@ -250,7 +250,7 @@ module Alchemy
|
|
250
250
|
end
|
251
251
|
|
252
252
|
it "should insert the element at top of list" do
|
253
|
-
post :create, {:element => {:name => 'news', :page_id =>
|
253
|
+
post :create, {:element => {:name => 'news', :page_id => alchemy_page.id}, :paste_from_clipboard => "#{element_in_clipboard.id}##{cell.name}", :format => :js}
|
254
254
|
cell.elements.count.should == 2
|
255
255
|
cell.elements.first.name.should == 'news'
|
256
256
|
cell.elements.first.should_not == element
|
@@ -270,7 +270,7 @@ module Alchemy
|
|
270
270
|
end
|
271
271
|
|
272
272
|
it "should create an element from clipboard" do
|
273
|
-
post :create, {:paste_from_clipboard => element_in_clipboard.id, :element => {:page_id =>
|
273
|
+
post :create, {:paste_from_clipboard => element_in_clipboard.id, :element => {:page_id => alchemy_page.id}, :format => :js}
|
274
274
|
response.status.should == 200
|
275
275
|
response.body.should match(/Succesfully added new element/)
|
276
276
|
end
|
@@ -278,7 +278,7 @@ module Alchemy
|
|
278
278
|
context "and with cut as action parameter" do
|
279
279
|
|
280
280
|
it "should also remove the element id from clipboard" do
|
281
|
-
post :create, {:paste_from_clipboard => element_in_clipboard.id, :element => {:page_id =>
|
281
|
+
post :create, {:paste_from_clipboard => element_in_clipboard.id, :element => {:page_id => alchemy_page.id}, :format => :js}
|
282
282
|
session[:clipboard].contains?(:elements, element_in_clipboard.id).should_not be_true
|
283
283
|
end
|
284
284
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'ostruct'
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
module Alchemy
|
@@ -36,6 +37,20 @@ module Alchemy
|
|
36
37
|
|
37
38
|
end
|
38
39
|
|
40
|
+
describe "#configure" do
|
41
|
+
render_views
|
42
|
+
|
43
|
+
context "with page having nested urlname" do
|
44
|
+
let(:page) { mock_model(Page, {name: 'Foobar', slug: 'foobar', urlname: 'root/parent/foobar', redirects_to_external?: false, layoutpage?: false, taggable?: false}) }
|
45
|
+
|
46
|
+
it "should always show the slug" do
|
47
|
+
Page.stub!(:find).and_return(page)
|
48
|
+
get :configure, {:id => page.id, :format => :js}
|
49
|
+
response.body.should match /value="foobar"/
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
39
54
|
describe '#create' do
|
40
55
|
|
41
56
|
let(:parent) { FactoryGirl.create(:public_page) }
|
@@ -1,14 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require File.dirname(__FILE__) + "/../../../lib/alchemy/resources_helper"
|
3
|
-
|
4
|
-
module Alchemy
|
5
|
-
module Admin
|
6
|
-
class ResourcesController
|
7
|
-
helper Alchemy::ResourcesHelper
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
1
|
+
require "spec_helper"
|
12
2
|
|
13
3
|
describe Alchemy::Admin::ResourcesController do
|
14
4
|
describe "index" do
|
@@ -7,12 +7,12 @@ module Alchemy
|
|
7
7
|
|
8
8
|
render_views
|
9
9
|
|
10
|
-
let(:
|
10
|
+
let(:alchemy_page) do
|
11
11
|
FactoryGirl.create(:page, :parent_id => Page.rootpage.id)
|
12
12
|
end
|
13
13
|
|
14
14
|
let(:element) do
|
15
|
-
FactoryGirl.create(:element, :public => false, :page =>
|
15
|
+
FactoryGirl.create(:element, :public => false, :page => alchemy_page)
|
16
16
|
end
|
17
17
|
|
18
18
|
before do
|
@@ -21,13 +21,13 @@ module Alchemy
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should hold trashed elements" do
|
24
|
-
get :index, :page_id =>
|
24
|
+
get :index, :page_id => alchemy_page.id
|
25
25
|
response.body.should have_selector("#element_#{element.id}.element_editor")
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should not hold elements that are not trashed" do
|
29
|
-
element = FactoryGirl.create(:element, :page =>
|
30
|
-
get :index, :page_id =>
|
29
|
+
element = FactoryGirl.create(:element, :page => alchemy_page, :public => false)
|
30
|
+
get :index, :page_id => alchemy_page.id
|
31
31
|
response.body.should_not have_selector("#element_#{element.id}.element_editor")
|
32
32
|
end
|
33
33
|
|
@@ -42,7 +42,7 @@ module Alchemy
|
|
42
42
|
context "and no unique elements on the page" do
|
43
43
|
|
44
44
|
it "unique elements should be draggable" do
|
45
|
-
get :index, :page_id =>
|
45
|
+
get :index, :page_id => alchemy_page.id
|
46
46
|
response.body.should have_selector("#element_#{element.id}.element_editor.draggable")
|
47
47
|
end
|
48
48
|
|
@@ -51,8 +51,8 @@ module Alchemy
|
|
51
51
|
context "and with an unique element on the page" do
|
52
52
|
|
53
53
|
it "unique elements should not be draggable" do
|
54
|
-
FactoryGirl.create(:element, :page =>
|
55
|
-
get :index, :page_id =>
|
54
|
+
FactoryGirl.create(:element, :page => alchemy_page, :public => false)
|
55
|
+
get :index, :page_id => alchemy_page.id
|
56
56
|
response.body.should have_selector("#element_#{element.id}.element_editor.not-draggable")
|
57
57
|
end
|
58
58
|
|
@@ -63,7 +63,7 @@ module Alchemy
|
|
63
63
|
context "#clear" do
|
64
64
|
|
65
65
|
it "should destroy all containing elements" do
|
66
|
-
post :clear, {:page_id =>
|
66
|
+
post :clear, {:page_id => alchemy_page.id, :format => :js}
|
67
67
|
Element.trashed.should be_empty
|
68
68
|
end
|
69
69
|
|
@@ -8,9 +8,9 @@ end
|
|
8
8
|
module Alchemy
|
9
9
|
describe AttachmentsController do
|
10
10
|
|
11
|
-
let(:
|
12
|
-
let(:element)
|
13
|
-
let(:attachment)
|
11
|
+
let(:public_page) { FactoryGirl.create(:public_page, :restricted => true) }
|
12
|
+
let(:element) { FactoryGirl.create(:element, :page => public_page, :name => 'download', :create_contents_after_create => true) }
|
13
|
+
let(:attachment) { Attachment.create(:file => File.new(File.expand_path('../../support/image.png', __FILE__))) }
|
14
14
|
|
15
15
|
before do
|
16
16
|
essence = element.contents.where(:name => 'file').first.essence
|
@@ -3,8 +3,8 @@ require 'spec_helper'
|
|
3
3
|
module Alchemy
|
4
4
|
describe ElementsController do
|
5
5
|
|
6
|
-
let(:
|
7
|
-
let(:element) { FactoryGirl.create(:element, :page =>
|
6
|
+
let(:public_page) { FactoryGirl.create(:public_page) }
|
7
|
+
let(:element) { FactoryGirl.create(:element, :page => public_page, :name => 'download') }
|
8
8
|
let(:restricted_page) { FactoryGirl.create(:public_page, :restricted => true) }
|
9
9
|
let(:restricted_element) { FactoryGirl.create(:element, :page => restricted_page, :name => 'download') }
|
10
10
|
|
@@ -1,200 +1,231 @@
|
|
1
|
+
require 'ostruct'
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
|
-
|
4
|
+
module Alchemy
|
5
|
+
describe PagesController do
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
+
let(:default_language) { Language.get_default }
|
8
|
+
let(:default_language_root) { FactoryGirl.create(:language_root_page, :language => default_language, :name => 'Home', :public => true) }
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
+
context "requested for a page containing a feed" do
|
11
|
+
render_views
|
10
12
|
|
11
|
-
|
13
|
+
let(:page) { FactoryGirl.create(:public_page, :parent_id => default_language_root.id, :page_layout => 'news', :name => 'News', :language => default_language, :do_not_autogenerate => false) }
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
it "should render a rss feed" do
|
16
|
+
get :show, :urlname => page.urlname, :format => :rss
|
17
|
+
response.content_type.should == 'application/rss+xml'
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should include content" do
|
21
|
+
page.elements.first.content_by_name('news_headline').essence.update_attributes({:body => 'Peters Petshop'})
|
22
|
+
get :show, :urlname => 'news', :format => :rss
|
23
|
+
response.body.should match /Peters Petshop/
|
24
|
+
end
|
17
25
|
|
18
|
-
it "should include content" do
|
19
|
-
page.elements.first.content_by_name('news_headline').essence.update_attributes({:body => 'Peters Petshop'})
|
20
|
-
get :show, :urlname => 'news', :format => :rss
|
21
|
-
response.body.should match /Peters Petshop/
|
22
26
|
end
|
23
27
|
|
24
|
-
|
28
|
+
context "requested for a page that does not contain a feed" do
|
25
29
|
|
26
|
-
|
30
|
+
it "should render xml 404 error" do
|
31
|
+
get :show, :urlname => default_language_root.urlname, :format => :rss
|
32
|
+
response.status.should == 404
|
33
|
+
end
|
27
34
|
|
28
|
-
it "should render xml 404 error" do
|
29
|
-
get :show, :urlname => default_language_root.urlname, :format => :rss
|
30
|
-
response.status.should == 404
|
31
35
|
end
|
32
36
|
|
33
|
-
|
37
|
+
describe "Layout rendering" do
|
34
38
|
|
35
|
-
|
39
|
+
context "with param layout set to none" do
|
36
40
|
|
37
|
-
|
41
|
+
it "should not render a layout" do
|
42
|
+
get :show, :urlname => :home, :layout => 'none'
|
43
|
+
response.body.should_not match /<head>/
|
44
|
+
end
|
38
45
|
|
39
|
-
it "should not render a layout" do
|
40
|
-
get :show, :urlname => :home, :layout => 'none'
|
41
|
-
response.body.should_not match /<head>/
|
42
46
|
end
|
43
47
|
|
44
|
-
|
48
|
+
context "with param layout set to false" do
|
45
49
|
|
46
|
-
|
50
|
+
it "should not render a layout" do
|
51
|
+
get :show, :urlname => :home, :layout => 'false'
|
52
|
+
response.body.should_not match /<head>/
|
53
|
+
end
|
47
54
|
|
48
|
-
it "should not render a layout" do
|
49
|
-
get :show, :urlname => :home, :layout => 'false'
|
50
|
-
response.body.should_not match /<head>/
|
51
55
|
end
|
52
56
|
|
53
|
-
|
57
|
+
context "with params layout set to not existing layout" do
|
58
|
+
it "should raise ActionView::MissingTemplate" do
|
59
|
+
expect {
|
60
|
+
get :show, :urlname => default_language_root.urlname, :layout => 'lkuiuk'
|
61
|
+
}.to raise_error(ActionView::MissingTemplate)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context "with param layout set to a custom layout" do
|
66
|
+
render_views
|
67
|
+
|
68
|
+
before do
|
69
|
+
@custom_layout = Rails.root.join('app/views/layouts', 'custom.html.erb')
|
70
|
+
File.open(@custom_layout, 'w') do |custom_layout|
|
71
|
+
custom_layout.puts "<html>I am a custom layout</html>"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should render the custom layout" do
|
76
|
+
get :show, :urlname => default_language_root.urlname, :layout => 'custom'
|
77
|
+
response.body.should have_content('I am a custom layout')
|
78
|
+
end
|
79
|
+
|
80
|
+
after do
|
81
|
+
FileUtils.rm(@custom_layout)
|
82
|
+
end
|
54
83
|
|
55
|
-
context "with params layout set to not existing layout" do
|
56
|
-
it "should raise ActionView::MissingTemplate" do
|
57
|
-
expect {
|
58
|
-
get :show, :urlname => default_language_root.urlname, :layout => 'lkuiuk'
|
59
|
-
}.to raise_error(ActionView::MissingTemplate)
|
60
84
|
end
|
61
85
|
end
|
62
86
|
|
63
|
-
|
87
|
+
describe "url nesting" do
|
64
88
|
render_views
|
65
89
|
|
90
|
+
let(:catalog) { FactoryGirl.create(:public_page, :name => "Catalog", :parent_id => default_language_root.id, :language => default_language, :visible => true) }
|
91
|
+
let(:products) { FactoryGirl.create(:public_page, :name => "Products", :parent_id => catalog.id, :language => default_language, :visible => true) }
|
92
|
+
let(:product) { FactoryGirl.create(:public_page, :name => "Screwdriver", :parent_id => products.id, :language => default_language, :do_not_autogenerate => false, :visible => true) }
|
93
|
+
|
66
94
|
before do
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
95
|
+
User.stub!(:admins).and_return(OpenStruct.new(count: 1))
|
96
|
+
Config.stub!(:get) { |arg| arg == :url_nesting ? true : false }
|
97
|
+
product.elements.find_by_name('article').contents.essence_texts.first.essence.update_column(:body, 'screwdriver')
|
71
98
|
end
|
72
99
|
|
73
|
-
|
74
|
-
get :show, :urlname => default_language_root.urlname, :layout => 'custom'
|
75
|
-
response.body.should have_content('I am a custom layout')
|
76
|
-
end
|
100
|
+
context "with correct levelnames in params" do
|
77
101
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end
|
102
|
+
it "should show the requested page" do
|
103
|
+
get :show, {:urlname => 'catalog/products/screwdriver'}
|
104
|
+
response.status.should == 200
|
105
|
+
response.body.should have_content("screwdriver")
|
106
|
+
end
|
84
107
|
|
85
|
-
|
86
|
-
render_views
|
108
|
+
end
|
87
109
|
|
88
|
-
|
89
|
-
@catalog = FactoryGirl.create(:public_page, :name => "Catalog", :parent_id => default_language_root.id, :language => default_language)
|
90
|
-
@products = FactoryGirl.create(:public_page, :name => "Products", :parent_id => @catalog.id, :language => default_language)
|
91
|
-
@product = FactoryGirl.create(:public_page, :name => "Screwdriver", :parent_id => @products.id, :language => default_language, :do_not_autogenerate => false)
|
92
|
-
@product.elements.find_by_name('article').contents.essence_texts.first.essence.update_column(:body, 'screwdriver')
|
93
|
-
controller.stub!(:configuration) { |arg| arg == :url_nesting ? true : false }
|
94
|
-
end
|
110
|
+
context "with incorrect levelnames in params" do
|
95
111
|
|
96
|
-
|
112
|
+
it "should render a 404 page" do
|
113
|
+
get :show, {:urlname => 'catalog/faqs/screwdriver'}
|
114
|
+
response.status.should == 404
|
115
|
+
response.body.should have_content('The page you were looking for doesn\'t exist')
|
116
|
+
end
|
97
117
|
|
98
|
-
it "should show the requested page" do
|
99
|
-
get :show, {:level1 => 'catalog', :level2 => 'products', :urlname => 'screwdriver'}
|
100
|
-
response.status.should == 200
|
101
|
-
response.body.should have_content("screwdriver")
|
102
118
|
end
|
103
119
|
|
104
120
|
end
|
105
121
|
|
106
|
-
context "
|
107
|
-
|
108
|
-
|
109
|
-
get :show, {:
|
122
|
+
context "when a non-existent page is requested" do
|
123
|
+
it "should rescue a RoutingError with rendering a 404 page." do
|
124
|
+
FactoryGirl.create(:admin_user) # otherwise we are redirected to create_user
|
125
|
+
get :show, {:urlname => 'doesntexist'}
|
110
126
|
response.status.should == 404
|
111
127
|
response.body.should have_content('The page you were looking for doesn\'t exist')
|
112
128
|
end
|
113
|
-
|
114
129
|
end
|
115
130
|
|
116
|
-
|
131
|
+
describe '#redirect_to_public_child' do
|
117
132
|
|
118
|
-
|
119
|
-
|
120
|
-
FactoryGirl.create(:
|
121
|
-
get :show, {:urlname => 'doesntexist'}
|
122
|
-
response.status.should == 404
|
123
|
-
response.body.should have_content('The page you were looking for doesn\'t exist')
|
124
|
-
end
|
125
|
-
end
|
133
|
+
let(:root_page) { FactoryGirl.create(:language_root_page, :public => false) }
|
134
|
+
let(:page) { FactoryGirl.create(:page, :parent_id => root_page.id) }
|
135
|
+
let(:public_page) { FactoryGirl.create(:public_page, :parent_id => page.id) }
|
126
136
|
|
127
|
-
|
137
|
+
before { controller.instance_variable_set("@page", root_page) }
|
128
138
|
|
129
|
-
|
130
|
-
let(:page) { FactoryGirl.create(:page, :parent_id => root_page.id) }
|
131
|
-
let(:public_page) { FactoryGirl.create(:public_page, :parent_id => page.id) }
|
139
|
+
context "with unpublished and published pages in page tree" do
|
132
140
|
|
133
|
-
|
141
|
+
before do
|
142
|
+
public_page
|
143
|
+
root_page.reload
|
144
|
+
end
|
134
145
|
|
135
|
-
|
146
|
+
it "should redirect to first public child" do
|
147
|
+
controller.should_receive(:redirect_page)
|
148
|
+
controller.send(:redirect_to_public_child)
|
149
|
+
controller.instance_variable_get('@page').should == public_page
|
150
|
+
end
|
136
151
|
|
137
|
-
before do
|
138
|
-
public_page
|
139
|
-
root_page.reload
|
140
152
|
end
|
141
153
|
|
142
|
-
|
143
|
-
controller.should_receive(:redirect_page)
|
144
|
-
controller.send(:redirect_to_public_child)
|
145
|
-
controller.instance_variable_get('@page').should == public_page
|
146
|
-
end
|
154
|
+
context "with only unpublished pages in page tree" do
|
147
155
|
|
148
|
-
|
156
|
+
before do
|
157
|
+
page
|
158
|
+
root_page.reload
|
159
|
+
end
|
149
160
|
|
150
|
-
|
161
|
+
it "should raise not found error" do
|
162
|
+
expect {
|
163
|
+
controller.send(:redirect_to_public_child)
|
164
|
+
}.to raise_error(ActionController::RoutingError)
|
165
|
+
end
|
151
166
|
|
152
|
-
before do
|
153
|
-
page
|
154
|
-
root_page.reload
|
155
167
|
end
|
168
|
+
end
|
156
169
|
|
157
|
-
|
158
|
-
|
159
|
-
controller.send(:redirect_to_public_child)
|
160
|
-
}.to raise_error(ActionController::RoutingError)
|
161
|
-
end
|
170
|
+
describe 'Redirecting to legacy page urls' do
|
171
|
+
context 'Request a page with legacy url' do
|
162
172
|
|
163
|
-
|
164
|
-
|
173
|
+
# otherwise we are redirected to signup
|
174
|
+
before { FactoryGirl.create(:admin_user) }
|
165
175
|
|
166
|
-
|
167
|
-
|
176
|
+
let(:page) { FactoryGirl.create(:public_page, :name => 'New page name') }
|
177
|
+
let(:second_page) { FactoryGirl.create(:public_page, :name => 'Second Page') }
|
178
|
+
let(:legacy_page) { FactoryGirl.create(:public_page, :name => 'Legacy Url') }
|
179
|
+
let(:legacy_url) { LegacyPageUrl.create(:urlname => 'legacy-url', :page => page) }
|
180
|
+
let(:legacy_url2) { LegacyPageUrl.create(:urlname => 'legacy-url', :page => second_page) }
|
168
181
|
|
169
|
-
|
170
|
-
|
182
|
+
it "should redirect permanently to page that belongs to legacy page url." do
|
183
|
+
get :show, :urlname => legacy_url.urlname
|
184
|
+
response.status.should == 301
|
185
|
+
response.should redirect_to('/new-page-name')
|
186
|
+
end
|
171
187
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
188
|
+
it "should only redirect to legacy url if no page was found for urlname" do
|
189
|
+
legacy_url
|
190
|
+
get :show, :urlname => legacy_page.urlname
|
191
|
+
response.status.should == 200
|
192
|
+
response.should_not redirect_to('/new-page-name')
|
193
|
+
end
|
177
194
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
195
|
+
it "should redirect to last page that has that legacy url" do
|
196
|
+
legacy_url
|
197
|
+
get :show, :urlname => legacy_url2.urlname
|
198
|
+
response.should redirect_to('/second-page')
|
199
|
+
end
|
183
200
|
|
184
|
-
it "should only redirect to legacy url if no page was found for urlname" do
|
185
|
-
legacy_url
|
186
|
-
get :show, :urlname => legacy_page.urlname
|
187
|
-
response.status.should == 200
|
188
|
-
response.should_not redirect_to('/alchemy/new-page-name')
|
189
201
|
end
|
202
|
+
end
|
203
|
+
|
204
|
+
describe "while redirecting" do
|
205
|
+
|
206
|
+
context "not in multi language mode" do
|
207
|
+
|
208
|
+
before do
|
209
|
+
PagesController.any_instance.stub(:multi_language?).and_return(false)
|
210
|
+
end
|
211
|
+
|
212
|
+
context "with no lang parameter present" do
|
213
|
+
|
214
|
+
it "should store defaults language id in the session." do
|
215
|
+
get :show, :urlname => 'a-public-page'
|
216
|
+
controller.session[:language_id].should == Language.get_default.id
|
217
|
+
end
|
218
|
+
|
219
|
+
it "should store defaults language code in the session." do
|
220
|
+
get :show, :urlname => 'a-public-page'
|
221
|
+
controller.session[:language_code].should == Language.get_default.code
|
222
|
+
end
|
223
|
+
|
224
|
+
end
|
190
225
|
|
191
|
-
it "should redirect to last page that has that legacy url" do
|
192
|
-
legacy_url
|
193
|
-
get :show, :urlname => legacy_url2.urlname
|
194
|
-
response.should redirect_to('/alchemy/second-page')
|
195
226
|
end
|
196
227
|
|
197
228
|
end
|
198
|
-
end
|
199
229
|
|
230
|
+
end
|
200
231
|
end
|