alchemy_cms 2.5.3.1 → 2.6.0.rc5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module Alchemy
|
|
4
|
+
describe Admin::TagsHelper do
|
|
5
|
+
|
|
6
|
+
let(:tag) do
|
|
7
|
+
mock_model(ActsAsTaggableOn::Tag, :name => "foo")
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe "#filtered_by_tag?" do
|
|
11
|
+
it "should return true if the filterlist contains the given tag" do
|
|
12
|
+
controller.params[:tagged_with] = "foo,bar,baz"
|
|
13
|
+
helper.filtered_by_tag?(tag).should == true
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "should return false if the filterlist does not contain the given tag" do
|
|
17
|
+
controller.params[:tagged_with] = "bar,baz"
|
|
18
|
+
helper.filtered_by_tag?(tag).should == false
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe "#add_to_tag_filter" do
|
|
23
|
+
context "if params[:tagged_with] is not present" do
|
|
24
|
+
it "should return an Array with the given tag name" do
|
|
25
|
+
helper.add_to_tag_filter(tag).should == ["foo"]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
context "if params[:tagged_with] contains some tag names" do
|
|
30
|
+
it "should return an Array of tag names including the given one" do
|
|
31
|
+
controller.params[:tagged_with] = "bar,baz"
|
|
32
|
+
helper.add_to_tag_filter(tag).should == ["bar", "baz", "foo"]
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe "#remove_from_tag_filter" do
|
|
38
|
+
context "if params[:tagged_with] is not present" do
|
|
39
|
+
it "should return an empty Array" do
|
|
40
|
+
helper.remove_from_tag_filter(tag).should be_empty
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
context "if params[:tagged_with] contains some tag names" do
|
|
45
|
+
it "should return an Array of tag names without the given one" do
|
|
46
|
+
controller.params[:tagged_with] = "bar,baz,foo"
|
|
47
|
+
helper.remove_from_tag_filter(tag).should == ["bar", "baz"]
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -4,7 +4,6 @@ module Alchemy
|
|
|
4
4
|
describe BaseHelper do
|
|
5
5
|
|
|
6
6
|
describe "#render_message" do
|
|
7
|
-
|
|
8
7
|
context "if no argument is passed" do
|
|
9
8
|
it "should render a div with an info icon and the given content" do
|
|
10
9
|
helper.render_message{ content_tag(:p, "my notice") }.should match(/<div class="info message"><span class="icon info"><\/span><p>my notice/)
|
|
@@ -16,7 +15,6 @@ module Alchemy
|
|
|
16
15
|
helper.render_message(:error){ content_tag(:p, "my notice") }.should match(/<div class="error message"><span class="icon error">/)
|
|
17
16
|
end
|
|
18
17
|
end
|
|
19
|
-
|
|
20
18
|
end
|
|
21
19
|
|
|
22
20
|
describe "#configuration" do
|
|
@@ -27,7 +25,6 @@ module Alchemy
|
|
|
27
25
|
end
|
|
28
26
|
|
|
29
27
|
describe "#multi_language?" do
|
|
30
|
-
|
|
31
28
|
context "if more than one published language exists" do
|
|
32
29
|
it "should return true" do
|
|
33
30
|
Alchemy::Language.stub_chain(:published, :count).and_return(2)
|
|
@@ -41,7 +38,26 @@ module Alchemy
|
|
|
41
38
|
helper.multi_language?.should == false
|
|
42
39
|
end
|
|
43
40
|
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe '#breadcrumb' do
|
|
44
|
+
let(:lang_root) { Page.language_root_for(Language.get_default.id) }
|
|
45
|
+
let(:parent) { FactoryGirl.create(:public_page) }
|
|
46
|
+
let(:page) { FactoryGirl.create(:public_page, parent_id: parent.id) }
|
|
44
47
|
|
|
48
|
+
it "returns an array of all parents including self" do
|
|
49
|
+
helper.breadcrumb(page).should == [lang_root, parent, page]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "does not include the root page" do
|
|
53
|
+
helper.breadcrumb(page).should_not include(Page.root)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
context "with current page nil" do
|
|
57
|
+
it "should return an empty array" do
|
|
58
|
+
helper.breadcrumb(nil).should == []
|
|
59
|
+
end
|
|
60
|
+
end
|
|
45
61
|
end
|
|
46
62
|
|
|
47
63
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
1
2
|
require 'spec_helper'
|
|
2
3
|
|
|
3
4
|
include Alchemy::BaseHelper
|
|
@@ -11,6 +12,7 @@ module Alchemy
|
|
|
11
12
|
let(:language_root) { FactoryGirl.create(:language_root_page) }
|
|
12
13
|
let(:public_page) { FactoryGirl.create(:public_page) }
|
|
13
14
|
let(:visible_page) { FactoryGirl.create(:public_page, :visible => true) }
|
|
15
|
+
let(:restricted_page) { FactoryGirl.create(:public_page, :visible => true, :restricted => true) }
|
|
14
16
|
let(:level_2_page) { FactoryGirl.create(:public_page, :parent_id => visible_page.id, :visible => true, :name => 'Level 2') }
|
|
15
17
|
let(:level_3_page) { FactoryGirl.create(:public_page, :parent_id => level_2_page.id, :visible => true, :name => 'Level 3') }
|
|
16
18
|
let(:level_4_page) { FactoryGirl.create(:public_page, :parent_id => level_3_page.id, :visible => true, :name => 'Level 4') }
|
|
@@ -19,8 +21,8 @@ module Alchemy
|
|
|
19
21
|
let(:klingonian_public_page) { FactoryGirl.create(:public_page, :language => klingonian, :parent_id => klingonian_language_root.id) }
|
|
20
22
|
|
|
21
23
|
before do
|
|
24
|
+
Config.stub!(:get) { |arg| arg == :url_nesting ? true : Config.parameter(arg) }
|
|
22
25
|
@root_page = language_root # We need this instance variable in the helpers
|
|
23
|
-
helper.stub(:configuration).and_return(false)
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
it "should render the current page layout" do
|
|
@@ -29,19 +31,32 @@ module Alchemy
|
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
describe "#render_navigation" do
|
|
32
|
-
|
|
33
|
-
before do
|
|
34
|
-
visible_page
|
|
35
|
-
end
|
|
34
|
+
before { visible_page }
|
|
36
35
|
|
|
37
36
|
context "not in multi_language mode" do
|
|
37
|
+
before { helper.stub(:multi_language?).and_return(false) }
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
helper.
|
|
39
|
+
it "should render the page navigation" do
|
|
40
|
+
helper.render_navigation.should have_selector("ul.navigation.level_1 li.#{visible_page.urlname} a[href=\"/#{visible_page.urlname}\"]")
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
context "as guest user" do
|
|
44
|
+
before { restricted_page }
|
|
45
|
+
|
|
46
|
+
it "should not render restricted pages" do
|
|
47
|
+
helper.render_navigation.should_not have_selector("ul.navigation.level_1 li a[href=\"/#{restricted_page.urlname}\"]")
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
context "as registered user" do
|
|
52
|
+
before do
|
|
53
|
+
restricted_page
|
|
54
|
+
Authorization.stub!(:current_user).and_return(FactoryGirl.build(:registered_user))
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it "should render restricted pages" do
|
|
58
|
+
helper.render_navigation.should have_selector("ul.navigation.level_1 li a[href=\"/#{restricted_page.urlname}\"]")
|
|
59
|
+
end
|
|
45
60
|
end
|
|
46
61
|
|
|
47
62
|
context "with enabled url nesting" do
|
|
@@ -52,7 +67,7 @@ module Alchemy
|
|
|
52
67
|
end
|
|
53
68
|
|
|
54
69
|
it "should render nested page links" do
|
|
55
|
-
helper.render_navigation(:all_sub_menues => true).should have_selector("ul li a[href=\"
|
|
70
|
+
helper.render_navigation(:all_sub_menues => true).should have_selector("ul li a[href=\"/#{level_3_page.urlname}\"]")
|
|
56
71
|
end
|
|
57
72
|
|
|
58
73
|
end
|
|
@@ -71,6 +86,34 @@ module Alchemy
|
|
|
71
86
|
|
|
72
87
|
end
|
|
73
88
|
|
|
89
|
+
context "with options[:deepness] set" do
|
|
90
|
+
before { level_3_page }
|
|
91
|
+
|
|
92
|
+
it "shows only pages up to this depth" do
|
|
93
|
+
output = helper.render_navigation(deepness: 3, all_sub_menues: true)
|
|
94
|
+
output.should have_selector("ul li a[href=\"/#{level_2_page.urlname}\"]")
|
|
95
|
+
output.should_not have_selector("ul li a[href=\"/#{level_3_page.urlname}\"]")
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
context "with options[:spacer] set" do
|
|
100
|
+
before { visible_page }
|
|
101
|
+
|
|
102
|
+
context "with two pages on same level" do
|
|
103
|
+
before { FactoryGirl.create(:public_page, visible: true) }
|
|
104
|
+
|
|
105
|
+
it "should render the given spacer" do
|
|
106
|
+
helper.render_navigation(spacer: '•').should match(/•/)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
context "only one page in current level" do
|
|
111
|
+
it "should not render the spacer" do
|
|
112
|
+
helper.render_navigation(spacer: '•').should_not match(/•/)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
74
117
|
end
|
|
75
118
|
|
|
76
119
|
describe '#render_subnavigation' do
|
|
@@ -88,11 +131,11 @@ module Alchemy
|
|
|
88
131
|
before { @page = level_2_page }
|
|
89
132
|
|
|
90
133
|
it "should render the navigation from current page" do
|
|
91
|
-
helper.render_subnavigation.should have_selector("ul > li > a[href='
|
|
134
|
+
helper.render_subnavigation.should have_selector("ul > li > a[href='/#{level_2_page.urlname}']")
|
|
92
135
|
end
|
|
93
136
|
|
|
94
137
|
it "should set current page active" do
|
|
95
|
-
helper.render_subnavigation.should have_selector("a[href='
|
|
138
|
+
helper.render_subnavigation.should have_selector("a[href='/#{level_2_page.urlname}'].active")
|
|
96
139
|
end
|
|
97
140
|
|
|
98
141
|
end
|
|
@@ -102,11 +145,11 @@ module Alchemy
|
|
|
102
145
|
before { @page = level_3_page }
|
|
103
146
|
|
|
104
147
|
it "should render the navigation from current pages parent" do
|
|
105
|
-
helper.render_subnavigation.should have_selector("ul > li > ul > li > a[href='
|
|
148
|
+
helper.render_subnavigation.should have_selector("ul > li > ul > li > a[href='/#{level_3_page.urlname}']")
|
|
106
149
|
end
|
|
107
150
|
|
|
108
151
|
it "should set current page active" do
|
|
109
|
-
helper.render_subnavigation.should have_selector("a[href='
|
|
152
|
+
helper.render_subnavigation.should have_selector("a[href='/#{level_3_page.urlname}'].active")
|
|
110
153
|
end
|
|
111
154
|
|
|
112
155
|
end
|
|
@@ -116,17 +159,17 @@ module Alchemy
|
|
|
116
159
|
before { @page = level_4_page }
|
|
117
160
|
|
|
118
161
|
it "should render the navigation from current pages parents parent" do
|
|
119
|
-
helper.render_subnavigation.should have_selector("ul > li > ul > li > ul > li > a[href='
|
|
162
|
+
helper.render_subnavigation.should have_selector("ul > li > ul > li > ul > li > a[href='/#{level_4_page.urlname}']")
|
|
120
163
|
end
|
|
121
164
|
|
|
122
165
|
it "should set current page active" do
|
|
123
|
-
helper.render_subnavigation.should have_selector("a[href='
|
|
166
|
+
helper.render_subnavigation.should have_selector("a[href='/#{level_4_page.urlname}'].active")
|
|
124
167
|
end
|
|
125
168
|
|
|
126
169
|
context "beginning with level 3" do
|
|
127
170
|
|
|
128
171
|
it "should render the navigation beginning from its parent" do
|
|
129
|
-
helper.render_subnavigation(:level => 3).should have_selector("ul > li > ul > li > a[href='
|
|
172
|
+
helper.render_subnavigation(:level => 3).should have_selector("ul > li > ul > li > a[href='/#{level_4_page.urlname}']")
|
|
130
173
|
end
|
|
131
174
|
|
|
132
175
|
end
|
|
@@ -136,56 +179,61 @@ module Alchemy
|
|
|
136
179
|
end
|
|
137
180
|
|
|
138
181
|
describe "#render_breadcrumb" do
|
|
182
|
+
let(:parent) { FactoryGirl.create(:public_page, visible: true) }
|
|
183
|
+
let(:page) { FactoryGirl.create(:public_page, parent_id: parent.id, visible: true) }
|
|
139
184
|
|
|
140
185
|
before do
|
|
141
186
|
helper.stub(:multi_language?).and_return(false)
|
|
142
|
-
@root = mock_model('Page', :urlname => 'root', :name => 'Root', :title => 'Root', :visible? => false, :public? => false, :restricted? => false, :parent => nil)
|
|
143
|
-
@language_root = mock_model('Page', :urlname => 'language_root', :name => 'Language Root', :title => 'Language Root', :visible? => true, :public? => true, :restricted? => false, :parent => @root)
|
|
144
|
-
@page = mock_model('Page', :urlname => 'a-public-page', :name => 'A Public Page', :title => 'A Public Page', :visible? => true, :public? => true, :restricted? => false, :parent => @language_root)
|
|
145
187
|
end
|
|
146
188
|
|
|
147
189
|
it "should render a breadcrumb to current page" do
|
|
148
|
-
helper.render_breadcrumb.should have_selector(
|
|
190
|
+
helper.render_breadcrumb(page: page).should have_selector(".active.last[contains('#{page.name}')]")
|
|
149
191
|
end
|
|
150
192
|
|
|
151
|
-
|
|
152
|
-
|
|
193
|
+
context "with options[:seperator] given" do
|
|
194
|
+
it "should render a breadcrumb with an alternative seperator" do
|
|
195
|
+
helper.render_breadcrumb(page: page, seperator: '<span>###</span>').should have_selector('span[contains("###")]')
|
|
196
|
+
end
|
|
153
197
|
end
|
|
154
198
|
|
|
155
|
-
|
|
156
|
-
|
|
199
|
+
context "with options[:reverse] set to true" do
|
|
200
|
+
it "should render a breadcrumb in reversed order" do
|
|
201
|
+
helper.render_breadcrumb(page: page, reverse: true).should have_selector('.active.first[contains("A Public Page")]')
|
|
202
|
+
end
|
|
157
203
|
end
|
|
158
204
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
helper.render_breadcrumb(:restricted_only => true).should match(/^(<span(.[^>]+)>)A restricted Public Page/)
|
|
162
|
-
end
|
|
205
|
+
context "with options[:restricted_only] set to true" do
|
|
206
|
+
before { Authorization.current_user = FactoryGirl.build(:registered_user) }
|
|
163
207
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
208
|
+
it "should render a breadcrumb of restricted pages only" do
|
|
209
|
+
page.update_attributes!(restricted: true, urlname: 'a-restricted-public-page', name: 'A restricted Public Page', title: 'A restricted Public Page')
|
|
210
|
+
helper.render_breadcrumb(page: page, restricted_only: true).strip.should match(/^(<span(.[^>]+)>)A restricted Public Page/)
|
|
211
|
+
end
|
|
167
212
|
end
|
|
168
213
|
|
|
169
|
-
it "should render a breadcrumb of visible
|
|
170
|
-
|
|
171
|
-
helper.render_breadcrumb(:visible_only
|
|
214
|
+
it "should render a breadcrumb of visible pages only." do
|
|
215
|
+
page.update_attributes!(visible: false, urlname: 'a-invisible-public-page', name: 'A invisible Public Page', title: 'A invisible Public Page')
|
|
216
|
+
helper.render_breadcrumb(page: page, visible_only: true).should_not match(/A invisible Public Page/)
|
|
172
217
|
end
|
|
173
218
|
|
|
174
219
|
it "should render a breadcrumb of published pages only" do
|
|
175
|
-
|
|
176
|
-
helper.render_breadcrumb(:public_only
|
|
220
|
+
page.update_attributes!(public: false, urlname: 'a-unpublic-page', name: 'A Unpublic Page', title: 'A Unpublic Page')
|
|
221
|
+
helper.render_breadcrumb(page: page, public_only: true).should_not match(/A Unpublic Page/)
|
|
177
222
|
end
|
|
178
223
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
224
|
+
context "with options[:without]" do
|
|
225
|
+
it "should render a breadcrumb without this page" do
|
|
226
|
+
page.update_attributes!(urlname: 'not-me', name: 'Not Me', title: 'Not Me')
|
|
227
|
+
helper.render_breadcrumb(page: page, without: page).should_not match(/Not Me/)
|
|
228
|
+
end
|
|
182
229
|
end
|
|
183
230
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
231
|
+
context "with options[:without] as array" do
|
|
232
|
+
it "should render a breadcrumb without these pages." do
|
|
233
|
+
page.update_attributes!(urlname: 'not-me', name: 'Not Me', title: 'Not Me')
|
|
234
|
+
helper.render_breadcrumb(page: page, without: [page]).should_not match(/Not Me/)
|
|
235
|
+
end
|
|
187
236
|
end
|
|
188
|
-
|
|
189
237
|
end
|
|
190
238
|
|
|
191
239
|
describe "#render_meta_data" do
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe "
|
|
3
|
+
describe "Picture url helpers" do
|
|
4
4
|
|
|
5
5
|
it "should generate a url string for cropped picture" do
|
|
6
6
|
p = show_picture_path(:id => 3, :crop => "crop", :size => "100x33", :name => "kitten", :format => "jpg")
|
|
7
|
-
p.should == "/
|
|
7
|
+
p.should == "/pictures/3/show/100x33/crop/kitten.jpg"
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
it "should generate a url string for cropped and masked picture" do
|
|
11
11
|
p = show_picture_path(:id => 3, :crop => "crop", :crop_from => "0x0", :crop_size => "900x300", :size => "100x33", :name => "kitten", :format => :jpg)
|
|
12
|
-
p.should == "/
|
|
12
|
+
p.should == "/pictures/3/show/100x33/crop/0x0/900x300/kitten.jpg"
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
it "should generate a url string for cropped thumbnail" do
|
|
16
16
|
p = thumbnail_path(:id => 3, :crop => "crop", :size => "100x33", :name => "kitten", :format => :jpg)
|
|
17
|
-
p.should == "/
|
|
17
|
+
p.should == "/pictures/3/thumbnails/100x33/crop/kitten.jpg"
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it "should generate a url string for thumbnail with default name and format" do
|
|
21
21
|
p = thumbnail_path(:id => 3, :size => "100x33")
|
|
22
|
-
p.should == "/
|
|
22
|
+
p.should == "/pictures/3/thumbnails/100x33/thumbnail.png"
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it "should generate a url string for cropped and masked thumbnail" do
|
|
26
26
|
p = thumbnail_path(:id => 3, :crop_from => "0x0", :crop_size => "900x300", :size => "100x33", :name => "kitten", :format => :jpg)
|
|
27
|
-
p.should == "/
|
|
27
|
+
p.should == "/pictures/3/thumbnails/100x33/0x0/900x300/kitten.jpg"
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
it "should generate a url string for zoomed image" do
|
|
31
31
|
p = zoom_picture_path(:id => 3, :name => "kitten", :format => :jpg)
|
|
32
|
-
p.should == "/
|
|
32
|
+
p.should == "/pictures/3/zoom/kitten.jpg"
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
end
|
|
@@ -5,130 +5,134 @@ include Alchemy::BaseHelper
|
|
|
5
5
|
module Alchemy
|
|
6
6
|
describe UrlHelper do
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
@page = mock_model(Page, :urlname => 'testpage', :language_code => 'en')
|
|
10
|
-
end
|
|
8
|
+
context 'page path helpers' do
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
before do
|
|
11
|
+
@page = mock_model(Page, :urlname => 'testpage', :language_code => 'en')
|
|
12
|
+
end
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
describe "#show_page_path_params" do
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
helper.stub!(:multi_language?).and_return(true)
|
|
18
|
-
end
|
|
16
|
+
context "when multi_language" do
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
before do
|
|
19
|
+
helper.stub!(:multi_language?).and_return(true)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "should return a Hash with urlname and language_id parameter" do
|
|
23
|
+
helper.stub!(:multi_language?).and_return(true)
|
|
24
|
+
helper.show_page_path_params(@page).should include(:urlname => 'testpage', :lang => 'en')
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "should return a Hash with urlname, language_id and query parameter" do
|
|
28
|
+
helper.stub!(:multi_language?).and_return(true)
|
|
29
|
+
helper.show_page_path_params(@page, {:query => 'test'}).should include(:urlname => 'testpage', :lang => 'en', :query => 'test')
|
|
30
|
+
end
|
|
24
31
|
|
|
25
|
-
it "should return a Hash with urlname, language_id and query parameter" do
|
|
26
|
-
helper.stub!(:multi_language?).and_return(true)
|
|
27
|
-
helper.show_page_path_params(@page, {:query => 'test'}).should include(:urlname => 'testpage', :lang => 'en', :query => 'test')
|
|
28
32
|
end
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
context "not multi_language" do
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
before do
|
|
37
|
+
helper.stub!(:multi_language?).and_return(false)
|
|
38
|
+
end
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
it "should return a Hash with the urlname but without language_id parameter" do
|
|
41
|
+
helper.show_page_path_params(@page).should include(:urlname => 'testpage')
|
|
42
|
+
helper.show_page_path_params(@page).should_not include(:lang => 'en')
|
|
43
|
+
end
|
|
37
44
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
it "should return a Hash with urlname and query parameter" do
|
|
46
|
+
helper.show_page_path_params(@page, {:query => 'test'}).should include(:urlname => 'testpage', :query => 'test')
|
|
47
|
+
helper.show_page_path_params(@page).should_not include(:lang => 'en')
|
|
48
|
+
end
|
|
42
49
|
|
|
43
|
-
it "should return a Hash with urlname and query parameter" do
|
|
44
|
-
helper.show_page_path_params(@page, {:query => 'test'}).should include(:urlname => 'testpage', :query => 'test')
|
|
45
|
-
helper.show_page_path_params(@page).should_not include(:lang => 'en')
|
|
46
50
|
end
|
|
47
51
|
|
|
48
52
|
end
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
describe "#show_alchemy_page_path" do
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
context "when multi_language" do
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
before do
|
|
59
|
+
helper.stub!(:multi_language?).and_return(true)
|
|
60
|
+
end
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
it "should return the correct relative path string" do
|
|
63
|
+
helper.show_alchemy_page_path(@page).should == "/#{@page.language_code}/testpage"
|
|
64
|
+
end
|
|
59
65
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
it "should return the correct relative path string with additional parameters" do
|
|
67
|
+
helper.show_alchemy_page_path(@page, {:query => 'test'}).should == "/#{@page.language_code}/testpage?query=test"
|
|
68
|
+
end
|
|
63
69
|
|
|
64
|
-
it "should return the correct relative path string with additional parameters" do
|
|
65
|
-
helper.show_alchemy_page_path(@page, {:query => 'test'}).should == "/alchemy/#{@page.language_code}/testpage?query=test"
|
|
66
70
|
end
|
|
67
71
|
|
|
68
|
-
|
|
72
|
+
context "not multi_language" do
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
before do
|
|
75
|
+
helper.stub!(:multi_language?).and_return(false)
|
|
76
|
+
end
|
|
71
77
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
it "should return the correct relative path string" do
|
|
79
|
+
helper.show_alchemy_page_path(@page).should == "/testpage"
|
|
80
|
+
end
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
it "should return the correct relative path string with additional parameter" do
|
|
83
|
+
helper.show_alchemy_page_path(@page, {:query => 'test'}).should == "/testpage?query=test"
|
|
84
|
+
end
|
|
79
85
|
|
|
80
|
-
it "should return the correct relative path string with additional parameter" do
|
|
81
|
-
helper.show_alchemy_page_path(@page, {:query => 'test'}).should == "/alchemy/testpage?query=test"
|
|
82
86
|
end
|
|
83
87
|
|
|
84
88
|
end
|
|
85
89
|
|
|
86
|
-
|
|
90
|
+
describe "#show_alchemy_page_url" do
|
|
87
91
|
|
|
88
|
-
|
|
92
|
+
context "when multi_language" do
|
|
89
93
|
|
|
90
|
-
|
|
94
|
+
before do
|
|
95
|
+
helper.stub!(:multi_language?).and_return(true)
|
|
96
|
+
end
|
|
91
97
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
it "should return the correct url string" do
|
|
99
|
+
helper.show_alchemy_page_url(@page).should == "http://#{helper.request.host}/#{@page.language_code}/testpage"
|
|
100
|
+
end
|
|
95
101
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
it "should return the correct url string with additional parameters" do
|
|
103
|
+
helper.show_alchemy_page_url(@page, {:query => 'test'}).should == "http://#{helper.request.host}/#{@page.language_code}/testpage?query=test"
|
|
104
|
+
end
|
|
99
105
|
|
|
100
|
-
it "should return the correct url string with additional parameters" do
|
|
101
|
-
helper.show_alchemy_page_url(@page, {:query => 'test'}).should == "http://#{helper.request.host}/alchemy/#{@page.language_code}/testpage?query=test"
|
|
102
106
|
end
|
|
103
107
|
|
|
104
|
-
|
|
108
|
+
context "not multi_language" do
|
|
105
109
|
|
|
106
|
-
|
|
110
|
+
before do
|
|
111
|
+
helper.stub!(:multi_language?).and_return(false)
|
|
112
|
+
end
|
|
107
113
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
114
|
+
it "should return the correct url string" do
|
|
115
|
+
helper.show_alchemy_page_url(@page).should == "http://#{helper.request.host}/testpage"
|
|
116
|
+
end
|
|
111
117
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
it "should return the correct url string with additional parameter" do
|
|
119
|
+
helper.show_alchemy_page_url(@page, {:query => 'test'}).should == "http://#{helper.request.host}/testpage?query=test"
|
|
120
|
+
end
|
|
115
121
|
|
|
116
|
-
it "should return the correct url string with additional parameter" do
|
|
117
|
-
helper.show_alchemy_page_url(@page, {:query => 'test'}).should == "http://#{helper.request.host}/alchemy/testpage?query=test"
|
|
118
122
|
end
|
|
119
123
|
|
|
120
124
|
end
|
|
121
125
|
|
|
122
126
|
end
|
|
123
127
|
|
|
124
|
-
|
|
128
|
+
context 'picture path helpers' do
|
|
125
129
|
|
|
126
130
|
let(:picture) { stub_model(Picture, :urlname => 'cute_kitten', :id => 42) }
|
|
127
131
|
|
|
128
132
|
describe '#show_alchemy_picture_path' do
|
|
129
133
|
|
|
130
134
|
it "should return the correct relative path string" do
|
|
131
|
-
helper.show_alchemy_picture_path(picture).should =~ Regexp.new("/
|
|
135
|
+
helper.show_alchemy_picture_path(picture).should =~ Regexp.new("/pictures/42/show/cute_kitten.jpg")
|
|
132
136
|
end
|
|
133
137
|
|
|
134
138
|
end
|
|
@@ -136,7 +140,7 @@ module Alchemy
|
|
|
136
140
|
describe '#show_alchemy_picture_url' do
|
|
137
141
|
|
|
138
142
|
it "should return the correct url string" do
|
|
139
|
-
helper.show_alchemy_picture_url(picture).should =~ Regexp.new("http://#{helper.request.host}/
|
|
143
|
+
helper.show_alchemy_picture_url(picture).should =~ Regexp.new("http://#{helper.request.host}/pictures/42/show/cute_kitten.jpg")
|
|
140
144
|
end
|
|
141
145
|
|
|
142
146
|
end
|
|
@@ -172,5 +176,21 @@ module Alchemy
|
|
|
172
176
|
|
|
173
177
|
end
|
|
174
178
|
|
|
179
|
+
context 'attachment path helpers' do
|
|
180
|
+
|
|
181
|
+
before do
|
|
182
|
+
@attachment = mock_model(Attachment, :urlname => 'test-attachment.pdf')
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
it 'should return the correct relative path to download an attachment' do
|
|
186
|
+
helper.download_alchemy_attachment_path(@attachment).should == "/attachment/#{@attachment.id}/download/#{@attachment.urlname}"
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
it 'should return the correct url to download an attachment' do
|
|
190
|
+
helper.download_alchemy_attachment_url(@attachment).should == "http://#{helper.request.host}/attachment/#{@attachment.id}/download/#{@attachment.urlname}"
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
end
|
|
194
|
+
|
|
175
195
|
end
|
|
176
196
|
end
|