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