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
@@ -1,27 +1,93 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
module Alchemy
|
4
5
|
describe Attachment do
|
6
|
+
let(:file) { File.new(File.expand_path('../../support/image with spaces.png', __FILE__)) }
|
7
|
+
let(:attachment) { Attachment.new(:file => file) }
|
5
8
|
|
6
|
-
describe '
|
9
|
+
describe 'after create' do
|
10
|
+
before { attachment.save! }
|
7
11
|
|
8
|
-
|
9
|
-
|
12
|
+
it "should have a humanized name" do
|
13
|
+
attachment.name.should == "image with spaces"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have a valid file_name" do
|
17
|
+
attachment.file_name.should == "image-with-spaces.png"
|
18
|
+
end
|
19
|
+
|
20
|
+
after { attachment.destroy }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'urlname sanitizing' do
|
24
|
+
it "should sanitize url characters in the filename" do
|
25
|
+
attachment.file_name = 'f#%&cking cute kitten pic.png'
|
26
|
+
attachment.save!
|
27
|
+
attachment.urlname.should == 'f-cking-cute-kitten-pic.png'
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should sanitize lot of dots in the name" do
|
31
|
+
attachment.file_name = 'cute.kitten.pic.png'
|
32
|
+
attachment.save!
|
33
|
+
attachment.urlname.should == 'cute-kitten-pic.png'
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should sanitize umlauts in the name" do
|
37
|
+
attachment.file_name = 'süßes katzenbild.png'
|
38
|
+
attachment.save!
|
39
|
+
attachment.urlname.should == 'suesses-katzenbild.png'
|
40
|
+
end
|
41
|
+
|
42
|
+
after { attachment.destroy }
|
43
|
+
end
|
10
44
|
|
11
|
-
|
12
|
-
|
45
|
+
describe 'validations' do
|
46
|
+
|
47
|
+
context "having a png, but only pdf allowed" do
|
48
|
+
before { Config.stub!(:get).and_return({'allowed_filetypes' => {'attachments' => ['pdf']}}) }
|
49
|
+
|
50
|
+
it "should not be valid" do
|
51
|
+
attachment.should_not be_valid
|
13
52
|
end
|
14
53
|
end
|
15
54
|
|
16
|
-
context "
|
17
|
-
|
55
|
+
context "having a png and everything allowed" do
|
56
|
+
before { Config.stub!(:get).and_return({'allowed_filetypes' => {'attachments' => ['*']}}) }
|
18
57
|
|
19
|
-
it "should
|
20
|
-
|
58
|
+
it "should be valid" do
|
59
|
+
attachment.should be_valid
|
21
60
|
end
|
22
61
|
end
|
23
62
|
|
24
63
|
end
|
25
64
|
|
65
|
+
context 'PNG image' do
|
66
|
+
subject { stub_model(Attachment, :file_name => 'kitten.png') }
|
67
|
+
its(:extension) { should == "png" }
|
68
|
+
end
|
69
|
+
|
70
|
+
describe 'css classes' do
|
71
|
+
context 'mp3 file' do
|
72
|
+
subject { stub_model(Attachment, :file_mime_type => 'audio/mpeg') }
|
73
|
+
its(:icon_css_class) { should == "audio" }
|
74
|
+
end
|
75
|
+
|
76
|
+
context 'png file' do
|
77
|
+
subject { stub_model(Attachment, :file_mime_type => 'image/png') }
|
78
|
+
its(:icon_css_class) { should == "image" }
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'vcf file' do
|
82
|
+
subject { stub_model(Attachment, :file_mime_type => 'application/vcard') }
|
83
|
+
its(:icon_css_class) { should == "vcard" }
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'zip file' do
|
87
|
+
subject { stub_model(Attachment, :file_mime_type => 'application/zip') }
|
88
|
+
its(:icon_css_class) { should == "archive" }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
26
92
|
end
|
27
93
|
end
|
data/spec/models/element_spec.rb
CHANGED
@@ -422,5 +422,12 @@ module Alchemy
|
|
422
422
|
|
423
423
|
end
|
424
424
|
|
425
|
+
describe '#save_contents' do
|
426
|
+
it "should return true if attributes hash is nil" do
|
427
|
+
element = FactoryGirl.create(:element, create_contents_after_create: true)
|
428
|
+
element.save_contents(nil).should be_true
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
425
432
|
end
|
426
433
|
end
|
data/spec/models/page_spec.rb
CHANGED
@@ -176,6 +176,16 @@ module Alchemy
|
|
176
176
|
page.legacy_urls.should be_empty
|
177
177
|
end
|
178
178
|
|
179
|
+
it "should not store legacy url twice for same urlname" do
|
180
|
+
page.urlname = 'new-urlname'
|
181
|
+
page.save!
|
182
|
+
page.urlname = 'my-testpage'
|
183
|
+
page.save!
|
184
|
+
page.urlname = 'another-urlname'
|
185
|
+
page.save!
|
186
|
+
page.legacy_urls.select { |u| u.urlname == 'my-testpage' }.size.should == 1
|
187
|
+
end
|
188
|
+
|
179
189
|
end
|
180
190
|
|
181
191
|
context "urlname has not changed" do
|
@@ -340,6 +350,7 @@ module Alchemy
|
|
340
350
|
end
|
341
351
|
|
342
352
|
describe "#elements_grouped_by_cells" do
|
353
|
+
let(:page) { FactoryGirl.create(:public_page, :do_not_autogenerate => false) }
|
343
354
|
|
344
355
|
before do
|
345
356
|
PageLayout.stub(:get).and_return({
|
@@ -352,16 +363,16 @@ module Alchemy
|
|
352
363
|
'name' => "header",
|
353
364
|
'elements' => ["header"]
|
354
365
|
}])
|
355
|
-
@page = FactoryGirl.create(:public_page, :do_not_autogenerate => false)
|
356
366
|
end
|
357
367
|
|
358
368
|
it "should return elements grouped by cell" do
|
359
|
-
|
360
|
-
|
369
|
+
elements = page.elements_grouped_by_cells
|
370
|
+
elements.keys.first.should be_instance_of(Cell)
|
371
|
+
elements.values.first.first.should be_instance_of(Element)
|
361
372
|
end
|
362
373
|
|
363
374
|
it "should only include elements beeing in a cell " do
|
364
|
-
|
375
|
+
page.elements_grouped_by_cells.keys.should_not include(nil)
|
365
376
|
end
|
366
377
|
|
367
378
|
end
|
@@ -410,35 +421,54 @@ module Alchemy
|
|
410
421
|
|
411
422
|
end
|
412
423
|
|
413
|
-
describe "
|
424
|
+
describe "Validations: " do
|
414
425
|
|
415
|
-
context "
|
426
|
+
context "Creating a normal content page" do
|
416
427
|
|
417
|
-
|
418
|
-
contentpage = FactoryGirl.create(:page, :urlname => "existing_twice")
|
419
|
-
global_with_same_urlname = FactoryGirl.create(:page, :urlname => "existing_twice", :layoutpage => true)
|
420
|
-
contentpage.title = "new Title"
|
421
|
-
contentpage.save.should == true
|
422
|
-
end
|
428
|
+
let(:contentpage) { FactoryGirl.build(:page) }
|
423
429
|
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
+
context "when its urlname exists as global page" do
|
431
|
+
it "it should be possible to save." do
|
432
|
+
contentpage.urlname = "existing_twice"
|
433
|
+
global_with_same_urlname = FactoryGirl.create(:page, :urlname => "existing_twice", :layoutpage => true)
|
434
|
+
contentpage.should be_valid
|
435
|
+
end
|
430
436
|
end
|
431
437
|
|
432
438
|
it "should validate the page_layout" do
|
433
|
-
|
434
|
-
|
435
|
-
|
439
|
+
contentpage.page_layout = nil
|
440
|
+
contentpage.save
|
441
|
+
contentpage.should have(1).error_on(:page_layout)
|
436
442
|
end
|
437
443
|
|
438
444
|
it "should validate the parent_id" do
|
439
|
-
|
440
|
-
|
441
|
-
|
445
|
+
contentpage.parent_id = nil
|
446
|
+
contentpage.save
|
447
|
+
contentpage.should have(1).error_on(:parent_id)
|
448
|
+
end
|
449
|
+
|
450
|
+
it "should validate the uniqueness of urlname" do
|
451
|
+
with_same_urlname = FactoryGirl.create(:page, :urlname => "existing_twice")
|
452
|
+
contentpage.urlname = 'existing_twice'
|
453
|
+
contentpage.should_not be_valid
|
454
|
+
end
|
455
|
+
|
456
|
+
context "with url_nesting set to true" do
|
457
|
+
before { Config.stub!(:get).and_return(true) }
|
458
|
+
|
459
|
+
it "should only validate urlname dependent of parent" do
|
460
|
+
other_parent = FactoryGirl.create(:page, parent_id: Page.root.id)
|
461
|
+
with_same_urlname = FactoryGirl.create(:page, :urlname => "existing_twice")
|
462
|
+
contentpage.urlname = 'existing_twice'
|
463
|
+
contentpage.parent_id = other_parent.id
|
464
|
+
contentpage.should be_valid
|
465
|
+
end
|
466
|
+
|
467
|
+
it "should validate urlname dependent of parent" do
|
468
|
+
with_same_urlname = FactoryGirl.create(:page, :urlname => "existing_twice")
|
469
|
+
contentpage.urlname = 'existing_twice'
|
470
|
+
contentpage.should_not be_valid
|
471
|
+
end
|
442
472
|
end
|
443
473
|
|
444
474
|
end
|
@@ -763,7 +793,7 @@ module Alchemy
|
|
763
793
|
end
|
764
794
|
|
765
795
|
describe "#publish!" do
|
766
|
-
let(:page) {
|
796
|
+
let(:page) { FactoryGirl.create(:page) }
|
767
797
|
before { page.publish! }
|
768
798
|
|
769
799
|
it "sets public attribute to true" do
|
@@ -771,5 +801,94 @@ module Alchemy
|
|
771
801
|
end
|
772
802
|
end
|
773
803
|
|
804
|
+
describe 'urlname updating' do
|
805
|
+
let(:parentparent) { FactoryGirl.create(:page, name: 'parentparent', visible: true) }
|
806
|
+
let(:parent) { FactoryGirl.create(:page, parent_id: parentparent.id, name: 'parent', visible: true) }
|
807
|
+
let(:page) { FactoryGirl.create(:page, parent_id: parent.id, name: 'page', visible: true) }
|
808
|
+
let(:invisible) { FactoryGirl.create(:page, parent_id: page.id, name: 'invisible', visible: false) }
|
809
|
+
let(:contact) { FactoryGirl.create(:page, parent_id: invisible.id, name: 'contact', visible: true) }
|
810
|
+
|
811
|
+
context "with activated url_nesting" do
|
812
|
+
before { Config.stub!(:get).and_return(true) }
|
813
|
+
|
814
|
+
it "should store all parents urlnames delimited by slash" do
|
815
|
+
page.urlname.should == 'parentparent/parent/page'
|
816
|
+
end
|
817
|
+
|
818
|
+
it "should not include the root page" do
|
819
|
+
page.urlname.should_not =~ /root/
|
820
|
+
end
|
821
|
+
|
822
|
+
it "should not include the language root page" do
|
823
|
+
page.urlname.should_not =~ /startseite/
|
824
|
+
end
|
825
|
+
|
826
|
+
it "should not include invisible pages" do
|
827
|
+
contact.urlname.should_not =~ /invisible/
|
828
|
+
end
|
829
|
+
|
830
|
+
context "after changing my urlname" do
|
831
|
+
it "should update urlnames of descendants" do
|
832
|
+
page
|
833
|
+
parentparent.urlname = 'new-urlname'
|
834
|
+
parentparent.save!
|
835
|
+
page.reload
|
836
|
+
page.urlname.should == 'new-urlname/parent/page'
|
837
|
+
end
|
838
|
+
|
839
|
+
it "should create a legacy url" do
|
840
|
+
page.stub!(:slug).and_return('foo')
|
841
|
+
page.update_urlname!
|
842
|
+
page.legacy_urls.should_not be_empty
|
843
|
+
page.legacy_urls.collect(&:urlname).should include('parentparent/parent/page')
|
844
|
+
end
|
845
|
+
end
|
846
|
+
|
847
|
+
context "after updating my visibility" do
|
848
|
+
it "should update urlnames of descendants" do
|
849
|
+
page
|
850
|
+
parentparent.visible = false
|
851
|
+
parentparent.save!
|
852
|
+
page.reload
|
853
|
+
page.urlname.should == 'parent/page'
|
854
|
+
end
|
855
|
+
end
|
856
|
+
end
|
857
|
+
|
858
|
+
context "with disabled url_nesting" do
|
859
|
+
before { Config.stub!(:get).and_return(false) }
|
860
|
+
|
861
|
+
it "should only store my urlname" do
|
862
|
+
page.urlname.should == 'page'
|
863
|
+
end
|
864
|
+
end
|
865
|
+
end
|
866
|
+
|
867
|
+
describe '#slug' do
|
868
|
+
context "with parents path saved in urlname" do
|
869
|
+
let(:page) { FactoryGirl.build(:page, urlname: 'root/parent/my-name')}
|
870
|
+
|
871
|
+
it "should return the last part of the urlname" do
|
872
|
+
page.slug.should == 'my-name'
|
873
|
+
end
|
874
|
+
end
|
875
|
+
|
876
|
+
context "with single urlname" do
|
877
|
+
let(:page) { FactoryGirl.build(:page, urlname: 'my-name')}
|
878
|
+
|
879
|
+
it "should return the last part of the urlname" do
|
880
|
+
page.slug.should == 'my-name'
|
881
|
+
end
|
882
|
+
end
|
883
|
+
|
884
|
+
context "with nil as urlname" do
|
885
|
+
let(:page) { FactoryGirl.build(:page, urlname: nil)}
|
886
|
+
|
887
|
+
it "should return nil" do
|
888
|
+
page.slug.should be_nil
|
889
|
+
end
|
890
|
+
end
|
891
|
+
end
|
892
|
+
|
774
893
|
end
|
775
894
|
end
|
data/spec/models/picture_spec.rb
CHANGED
@@ -52,21 +52,21 @@ module Alchemy
|
|
52
52
|
it "should return a humanized version of original filename" do
|
53
53
|
pic = stub_model(Picture, :image_file_name => 'cute_kitten.JPG')
|
54
54
|
pic.stub(:image_file).and_return(OpenStruct.new({:ext => 'jpg'}))
|
55
|
-
pic.humanized_name.should == "
|
55
|
+
pic.humanized_name.should == "cute kitten"
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should not remove incidents of suffix from filename" do
|
59
59
|
pic = stub_model(Picture, :image_file_name => 'cute_kitten_mo.jpgi.JPG')
|
60
60
|
pic.stub(:image_file).and_return(OpenStruct.new({:ext => 'jpg'}))
|
61
|
-
pic.humanized_name.should == "
|
62
|
-
pic.humanized_name.should_not == "
|
61
|
+
pic.humanized_name.should == "cute kitten mo.jpgi"
|
62
|
+
pic.humanized_name.should_not == "cute kitten moi"
|
63
63
|
end
|
64
64
|
|
65
65
|
context "image has no suffix" do
|
66
66
|
it "should return humanized name" do
|
67
67
|
pic = stub_model(Picture, :image_file_name => 'cute_kitten')
|
68
68
|
pic.stub(:suffix).and_return("")
|
69
|
-
pic.humanized_name.should == "
|
69
|
+
pic.humanized_name.should == "cute kitten"
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -116,7 +116,7 @@ module Alchemy
|
|
116
116
|
|
117
117
|
describe '.recent' do
|
118
118
|
|
119
|
-
before
|
119
|
+
before do
|
120
120
|
now = Time.now
|
121
121
|
@recent = Picture.create!(:image_file => image_file)
|
122
122
|
@old_picture = Picture.create!(:image_file => image_file)
|
@@ -44,9 +44,9 @@ module Alchemy
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
describe "#
|
47
|
+
describe "#resource_name" do
|
48
48
|
it "should return the model name (singularized and as a string)" do
|
49
|
-
resource.
|
49
|
+
resource.resource_name.should == "event"
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -94,28 +94,65 @@ module Alchemy
|
|
94
94
|
|
95
95
|
context "when resource_relations defined as class-method in the model" do
|
96
96
|
before do
|
97
|
+
::ActiveSupport::Deprecation.silenced = true
|
97
98
|
Event.class_eval do
|
98
99
|
def self.resource_relations
|
99
100
|
{
|
100
|
-
:
|
101
|
-
:organizer_id => {:attr_method => "organizer#name", :attr_type => :string}
|
101
|
+
:location => {:attr_method => "location#name", :attr_type => :string}
|
102
102
|
}
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
106
|
+
|
107
|
+
it "should contain model_association from ActiveRecord::Reflections" do
|
108
|
+
relation = resource.resource_relations[:location_id]
|
109
|
+
relation.keys.should include(:model_association)
|
110
|
+
relation[:model_association].class.should be(ActiveRecord::Reflection::AssociationReflection)
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should skip default alchemy model associations" do
|
114
|
+
resource.model_associations.collect(&:name).should_not include(*resource.class.const_get(:DEFAULT_SKIPPED_ASSOCIATIONS).map(&:to_sym))
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should add _id to relation key" do
|
118
|
+
resource.resource_relations[:location_id].should_not be_nil
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should store the relation name" do
|
122
|
+
relation = resource.resource_relations[:location_id]
|
123
|
+
relation.keys.should include(:name)
|
124
|
+
relation[:name].should == 'location'
|
125
|
+
end
|
126
|
+
|
127
|
+
context "with old hash delimited attr_method style" do
|
128
|
+
it "should show deprecation warnings" do
|
129
|
+
ActiveSupport::Deprecation.should_receive(:warn)
|
130
|
+
resource.resource_relations
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should return the last part as attr_method" do
|
134
|
+
resource.resource_relations[:location_id][:attr_method].should == 'name'
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
context "#attributes" do
|
139
|
+
it "should contain the relation" do
|
140
|
+
resource.attributes.detect { |a| a[:name] == 'location_id' }.keys.should include(:relation)
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should have the relation column type as type" do
|
144
|
+
resource.attributes.detect { |a| a[:name] == "location_id" }[:type].should == :string
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
106
148
|
after do
|
149
|
+
::ActiveSupport::Deprecation.silenced = false
|
107
150
|
Event.class_eval do
|
108
151
|
class << self
|
109
152
|
undef :resource_relations
|
110
153
|
end
|
111
154
|
end
|
112
155
|
end
|
113
|
-
it "should use the attribute location#name instead of location_id" do
|
114
|
-
resource.attributes.detect { |a| a[:name] == "location#name" }.should == {:name => "location#name", :type => :string}
|
115
|
-
end
|
116
|
-
it "should use the attribute organizer#name instead of organizer_id" do
|
117
|
-
resource.attributes.detect { |a| a[:name] == "organizer#name" }.should == {:name => "organizer#name", :type => :string}
|
118
|
-
end
|
119
156
|
end
|
120
157
|
|
121
158
|
context "when resource_relation is not defined" do
|