alchemy_cms 2.5.3.1 → 2.6.0.rc5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/.travis.yml +5 -13
- data/Gemfile +6 -3
- data/README.md +3 -2
- data/alchemy_cms.gemspec +22 -22
- data/app/assets/fonts/alchemy-icons.eot +0 -0
- data/app/assets/fonts/alchemy-icons.svg +54 -0
- data/app/assets/fonts/alchemy-icons.ttf +0 -0
- data/app/assets/fonts/alchemy-icons.woff +0 -0
- data/app/assets/images/alchemy/icons.png +0 -0
- data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +151 -0
- data/app/assets/javascripts/alchemy/alchemy.buttons.js.coffee +3 -2
- data/app/assets/javascripts/alchemy/alchemy.datepicker.js.coffee +31 -0
- data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +1 -1
- data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +98 -0
- data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +23 -24
- data/app/assets/javascripts/alchemy/alchemy.growler.js.coffee +27 -0
- data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +11 -8
- data/app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee +32 -0
- data/app/assets/javascripts/alchemy/alchemy.image_cropper.js.coffee +46 -0
- data/app/assets/javascripts/alchemy/alchemy.js +8 -2
- data/app/assets/javascripts/alchemy/alchemy.link_overlay.js.coffee +5 -4
- data/app/assets/javascripts/alchemy/alchemy.list_filter.js.coffee +49 -0
- data/app/assets/javascripts/alchemy/alchemy.onload.js.coffee +3 -0
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +71 -0
- data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +61 -0
- data/app/assets/javascripts/alchemy/alchemy.spinner.js.coffee +35 -0
- data/app/assets/javascripts/alchemy/alchemy.string_extension.js.coffee +11 -0
- data/app/assets/javascripts/alchemy/alchemy.windows.js.coffee +278 -0
- data/app/assets/stylesheets/alchemy/admin.css.scss +2 -0
- data/app/assets/stylesheets/alchemy/archive.scss +109 -65
- data/app/assets/stylesheets/alchemy/base.scss +16 -188
- data/app/assets/stylesheets/alchemy/dashboard.scss +2 -2
- data/app/assets/stylesheets/alchemy/defaults.scss +2 -1
- data/app/assets/stylesheets/alchemy/elements.scss +58 -94
- data/app/assets/stylesheets/alchemy/errors.scss +2 -2
- data/app/assets/stylesheets/alchemy/{mixins.scss → extends.scss} +104 -80
- data/app/assets/stylesheets/alchemy/flash.scss +4 -6
- data/app/assets/stylesheets/alchemy/fonts.scss +46 -0
- data/app/assets/stylesheets/alchemy/form_elements.scss +46 -45
- data/app/assets/stylesheets/alchemy/frame.scss +20 -15
- data/app/assets/stylesheets/alchemy/icons.scss +22 -9
- data/app/assets/stylesheets/alchemy/jquery-ui.scss +476 -399
- data/app/assets/stylesheets/alchemy/login.scss +1 -1
- data/app/assets/stylesheets/alchemy/menubar.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/notices.scss +5 -5
- data/app/assets/stylesheets/alchemy/pagination.scss +25 -13
- data/app/assets/stylesheets/alchemy/search.scss +29 -17
- data/app/assets/stylesheets/alchemy/sitemap.scss +41 -36
- data/app/assets/stylesheets/alchemy/tables.scss +102 -50
- data/app/assets/stylesheets/alchemy/tinymce_dialog.css.scss +18 -16
- data/app/assets/stylesheets/alchemy/toolbar.scss +84 -24
- data/app/assets/stylesheets/alchemy/upload.scss +14 -9
- data/app/assets/stylesheets/alchemy/variables.scss +1 -0
- data/app/assets/stylesheets/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css.scss +18 -21
- data/app/controllers/alchemy/admin/attachments_controller.rb +29 -39
- data/app/controllers/alchemy/admin/base_controller.rb +3 -9
- data/app/controllers/alchemy/admin/clipboard_controller.rb +1 -1
- data/app/controllers/alchemy/admin/contents_controller.rb +1 -1
- data/app/controllers/alchemy/admin/dashboard_controller.rb +1 -1
- data/app/controllers/alchemy/admin/elements_controller.rb +3 -3
- data/app/controllers/alchemy/admin/essence_files_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +5 -5
- data/app/controllers/alchemy/admin/languages_controller.rb +1 -1
- data/app/controllers/alchemy/admin/pages_controller.rb +18 -16
- data/app/controllers/alchemy/admin/pictures_controller.rb +11 -10
- data/app/controllers/alchemy/admin/resources_controller.rb +87 -14
- data/app/controllers/alchemy/admin/tags_controller.rb +3 -3
- data/app/controllers/alchemy/admin/trash_controller.rb +3 -3
- data/app/controllers/alchemy/admin/users_controller.rb +6 -11
- data/app/controllers/alchemy/attachments_controller.rb +8 -9
- data/app/controllers/alchemy/base_controller.rb +17 -10
- data/app/controllers/alchemy/pages_controller.rb +7 -19
- data/app/controllers/alchemy/passwords_controller.rb +15 -3
- data/app/controllers/alchemy/user_sessions_controller.rb +5 -4
- data/app/controllers/alchemy/users_controller.rb +1 -1
- data/app/helpers/alchemy/admin/attachments_helper.rb +2 -2
- data/app/helpers/alchemy/admin/base_helper.rb +62 -90
- data/app/helpers/alchemy/admin/elements_helper.rb +13 -5
- data/app/helpers/alchemy/admin/essences_helper.rb +3 -5
- data/app/helpers/alchemy/admin/pages_helper.rb +6 -3
- data/app/helpers/alchemy/admin/tags_helper.rb +60 -0
- data/app/helpers/alchemy/base_helper.rb +16 -20
- data/app/helpers/alchemy/elements_helper.rb +7 -11
- data/app/helpers/alchemy/essences_helper.rb +2 -2
- data/app/helpers/alchemy/pages_helper.rb +31 -69
- data/app/helpers/alchemy/url_helper.rb +11 -3
- data/app/models/alchemy/attachment.rb +73 -45
- data/app/models/alchemy/cell.rb +1 -1
- data/app/models/alchemy/content.rb +20 -9
- data/app/models/alchemy/element.rb +9 -7
- data/app/models/alchemy/page.rb +15 -248
- data/app/models/alchemy/page/cells.rb +71 -0
- data/app/models/alchemy/page/elements.rb +147 -0
- data/app/models/alchemy/page/naming.rb +90 -0
- data/app/models/alchemy/picture.rb +18 -13
- data/app/models/alchemy/tag.rb +1 -1
- data/app/models/alchemy/user.rb +38 -6
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +14 -7
- data/app/views/alchemy/admin/attachments/_attachment.html.erb +17 -12
- data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +3 -8
- data/app/views/alchemy/admin/attachments/_files_list.html.erb +20 -12
- data/app/views/alchemy/admin/attachments/_overlay_file_list.html.erb +11 -0
- data/app/views/alchemy/admin/attachments/_tag_list.html.erb +31 -0
- data/app/views/alchemy/admin/attachments/archive_overlay.js.erb +4 -0
- data/app/views/alchemy/admin/attachments/edit.html.erb +8 -7
- data/app/views/alchemy/admin/attachments/index.html.erb +19 -12
- data/app/views/alchemy/admin/attachments/new.html.erb +2 -2
- data/app/views/alchemy/admin/attachments/show.html.erb +3 -0
- data/app/views/alchemy/admin/contents/_missing.html.erb +4 -4
- data/app/views/alchemy/admin/contents/create.js.erb +1 -1
- data/app/views/alchemy/admin/contents/new.html.erb +6 -3
- data/app/views/alchemy/admin/dashboard/_locked_pages.html.erb +1 -1
- data/app/views/alchemy/admin/dashboard/_users.html.erb +1 -1
- data/app/views/alchemy/admin/dashboard/index.html.erb +3 -3
- data/app/views/alchemy/admin/dashboard/info.html.erb +16 -13
- data/app/views/alchemy/admin/elements/_add_picture.html.erb +1 -1
- data/app/views/alchemy/admin/elements/_element_foot.html.erb +4 -4
- data/app/views/alchemy/admin/elements/_element_head.html.erb +1 -7
- data/app/views/alchemy/admin/elements/_elements_select.html.erb +2 -2
- data/app/views/alchemy/admin/elements/_new_element_form.html.erb +4 -4
- data/app/views/alchemy/admin/elements/_picture_gallery_editor.html.erb +1 -1
- data/app/views/alchemy/admin/elements/create.js.erb +2 -2
- data/app/views/alchemy/admin/elements/fold.js.erb +3 -6
- data/app/views/alchemy/admin/elements/new.html.erb +1 -1
- data/app/views/alchemy/admin/elements/order.js.erb +1 -1
- data/app/views/alchemy/admin/elements/trash.js.erb +1 -1
- data/app/views/alchemy/admin/elements/update.js.erb +2 -2
- data/app/views/alchemy/admin/essence_files/edit.html.erb +4 -4
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +17 -18
- data/app/views/alchemy/admin/essence_pictures/edit.html.erb +2 -2
- data/app/views/alchemy/admin/essence_pictures/update.js.erb +1 -0
- data/app/views/alchemy/admin/languages/_form.html.erb +12 -10
- data/app/views/alchemy/admin/languages/_language.html.erb +2 -1
- data/app/views/alchemy/admin/languages/_table.html.erb +3 -3
- data/app/views/alchemy/admin/languages/index.html.erb +15 -15
- data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +6 -6
- data/app/views/alchemy/admin/layoutpages/index.html.erb +41 -40
- data/app/views/alchemy/admin/pages/_contactform_links.html.erb +4 -4
- data/app/views/alchemy/admin/pages/_create_language_form.html.erb +6 -6
- data/app/views/alchemy/admin/pages/_external_link.html.erb +2 -2
- data/app/views/alchemy/admin/pages/_file_link.html.erb +3 -3
- data/app/views/alchemy/admin/pages/_internal_link.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_page.html.erb +13 -13
- data/app/views/alchemy/admin/pages/_page_for_links.html.erb +2 -4
- data/app/views/alchemy/admin/pages/_sitemap.html.erb +5 -0
- data/app/views/alchemy/admin/pages/configure.html.erb +7 -7
- data/app/views/alchemy/admin/pages/configure_external.html.erb +4 -4
- data/app/views/alchemy/admin/pages/edit.html.erb +23 -30
- data/app/views/alchemy/admin/pages/index.html.erb +34 -23
- data/app/views/alchemy/admin/pages/new.html.erb +1 -1
- data/app/views/alchemy/admin/pages/sort.js.erb +1 -1
- data/app/views/alchemy/admin/partials/_flash_upload.html.erb +2 -3
- data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +2 -2
- data/app/views/alchemy/admin/partials/_search_form.html.erb +3 -3
- data/app/views/alchemy/admin/partials/_upload_form.html.erb +2 -2
- data/app/views/alchemy/admin/pictures/_archive.html.erb +7 -7
- data/app/views/alchemy/admin/pictures/_archive_overlay.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +6 -6
- data/app/views/alchemy/admin/pictures/_filter_bar.html.erb +4 -4
- data/app/views/alchemy/admin/pictures/_overlay_picture_list.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_picture.html.erb +3 -8
- data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +9 -14
- data/app/views/alchemy/admin/pictures/_tag_list.html.erb +27 -25
- data/app/views/alchemy/admin/pictures/archive_overlay.js.erb +3 -1
- data/app/views/alchemy/admin/pictures/index.html.erb +49 -42
- data/app/views/alchemy/admin/pictures/new.html.erb +2 -2
- data/app/views/alchemy/admin/pictures/show.html.erb +11 -0
- data/app/views/alchemy/admin/resources/_boolean.html.erb +2 -2
- data/app/views/alchemy/admin/resources/_datetime.html.erb +2 -2
- data/app/views/alchemy/admin/resources/_form.html.erb +9 -8
- data/app/views/alchemy/admin/resources/_resource.html.erb +15 -21
- data/app/views/alchemy/admin/resources/_string.html.erb +2 -2
- data/app/views/alchemy/admin/resources/_table.html.erb +11 -13
- data/app/views/alchemy/admin/resources/_text.html.erb +2 -2
- data/app/views/alchemy/admin/resources/index.csv.erb +13 -0
- data/app/views/alchemy/admin/resources/index.html.erb +24 -15
- data/app/views/alchemy/admin/sites/index.html.erb +23 -0
- data/app/views/alchemy/admin/tags/_radio_tag.html.erb +1 -1
- data/app/views/alchemy/admin/tags/_tag.html.erb +2 -1
- data/app/views/alchemy/admin/tags/edit.html.erb +1 -1
- data/app/views/alchemy/admin/tags/index.html.erb +16 -11
- data/app/views/alchemy/admin/tags/new.html.erb +3 -3
- data/app/views/alchemy/admin/trash/clear.js.coffee +1 -1
- data/app/views/alchemy/admin/users/_table.html.erb +12 -5
- data/app/views/alchemy/admin/users/_user.html.erb +16 -16
- data/app/views/alchemy/admin/users/index.html.erb +28 -16
- data/app/views/alchemy/breadcrumb/_page.html.erb +15 -0
- data/app/views/alchemy/breadcrumb/_spacer.html.erb +1 -0
- data/app/views/alchemy/elements/_editor_not_found.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +16 -16
- data/app/views/alchemy/essences/_essence_file_view.html.erb +8 -9
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +3 -6
- data/app/views/alchemy/essences/_essence_picture_tools.html.erb +9 -8
- data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +0 -5
- data/app/views/alchemy/essences/_linkable_essence_tools.html.erb +2 -2
- data/app/views/alchemy/navigation/_link.html.erb +7 -7
- data/app/views/alchemy/navigation/_renderer.html.erb +29 -36
- data/app/views/alchemy/notifications/admin_user_created.de.text.erb +5 -1
- data/app/views/alchemy/notifications/admin_user_created.en.text.erb +5 -1
- data/app/views/alchemy/notifications/registered_user_created.de.text.erb +13 -0
- data/app/views/alchemy/notifications/registered_user_created.en.text.erb +13 -0
- data/app/views/alchemy/search/_result.html.erb +4 -6
- data/app/views/alchemy/search/_results.html.erb +4 -5
- data/app/views/alchemy/user_sessions/leave.html.erb +1 -1
- data/app/views/alchemy/user_sessions/new.html.erb +2 -2
- data/app/views/kaminari/_first_page.html.erb +11 -0
- data/app/views/kaminari/_gap.html.erb +1 -1
- data/app/views/kaminari/_last_page.html.erb +11 -0
- data/app/views/kaminari/_next_page.html.erb +2 -2
- data/app/views/kaminari/_page.html.erb +1 -1
- data/app/views/kaminari/_paginator.html.erb +2 -0
- data/app/views/kaminari/_prev_page.html.erb +2 -2
- data/app/views/layouts/alchemy/admin.html.erb +4 -5
- data/config/alchemy/config.yml +8 -12
- data/config/authorization_rules.rb +4 -3
- data/config/initializers/dragonfly.rb +20 -12
- data/config/locales/alchemy.de.yml +20 -15
- data/config/locales/alchemy.en.yml +15 -10
- data/config/locales/devise.de.yml +1 -0
- data/config/routes.rb +3 -3
- data/{spec/dummy/db/migrate/20121118000000_alchemy_two_point_four.rb → db/migrate/20130214233001_alchemy_two_point_five.rb} +50 -36
- data/db/migrate/20130221200514_migrate_attachments_to_dragonfly.rb +21 -0
- data/db/migrate/20130312205327_change_alchemy_users_role_to_roles.rb +11 -0
- data/lib/alchemy/capistrano.rb +10 -8
- data/lib/alchemy/errors.rb +7 -0
- data/lib/alchemy/filetypes.rb +33 -0
- data/lib/alchemy/i18n.rb +9 -1
- data/lib/alchemy/name_conversions.rb +28 -0
- data/lib/alchemy/page_layout.rb +5 -3
- data/lib/alchemy/resource.rb +132 -29
- data/lib/alchemy/resources_helper.rb +81 -12
- data/lib/alchemy/upgrader.rb +14 -276
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +17 -2
- data/lib/rails/generators/alchemy/deploy_script/templates/deploy.rb.tt +1 -1
- data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +1 -1
- data/lib/tasks/alchemy/convert.rake +39 -0
- data/lib/tasks/alchemy/install.rake +4 -6
- data/lib/tasks/alchemy/upgrade.rake +18 -1
- data/spec/controllers/admin/clipboard_controller_spec.rb +4 -4
- data/spec/controllers/admin/elements_controller_spec.rb +23 -23
- data/spec/controllers/admin/pages_controller_spec.rb +15 -0
- data/spec/controllers/admin/resources_controller_spec.rb +1 -11
- data/spec/controllers/admin/trash_controller_spec.rb +9 -9
- data/spec/controllers/attachments_controller_spec.rb +3 -3
- data/spec/controllers/elements_controller_spec.rb +2 -2
- data/spec/controllers/pages_controller_spec.rb +160 -129
- data/spec/controllers/pictures_controller_spec.rb +2 -2
- data/spec/controllers/user_sessions_controller_spec.rb +3 -3
- data/spec/controllers/users_controller_spec.rb +2 -2
- data/spec/dummy/app/models/event.rb +2 -2
- data/spec/dummy/app/models/location.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +6 -42
- data/spec/dummy/config/routes.rb +1 -1
- data/spec/dummy/db/migrate/20121026104128_create_events.rb +0 -1
- data/{db/migrate/20121118000000_alchemy_two_point_four.rb → spec/dummy/db/migrate/20130214233001_alchemy_two_point_five.rb} +50 -36
- data/spec/dummy/db/migrate/20130221200514_migrate_attachments_to_dragonfly.rb +21 -0
- data/spec/dummy/db/migrate/20130312205327_change_alchemy_users_role_to_roles.rb +11 -0
- data/spec/dummy/db/migrate/20130328101418_create_locations.rb +9 -0
- data/spec/dummy/db/schema.rb +15 -6
- data/spec/factories.rb +4 -4
- data/spec/{integration → features}/admin/link_overlay_spec.rb +0 -0
- data/spec/{integration → features}/admin/modules_integration_spec.rb +1 -1
- data/spec/{integration → features}/admin/pages_controller_spec.rb +9 -4
- data/spec/{integration → features}/admin/picture_library_integration_spec.rb +5 -5
- data/spec/{integration → features}/admin/resources_integration_spec.rb +1 -1
- data/spec/{integration → features}/navigation_spec.rb +0 -0
- data/spec/{integration → features}/pages_controller_spec.rb +42 -112
- data/spec/{integration → features}/picture_security_spec.rb +2 -2
- data/spec/{integration → features}/security_spec.rb +7 -7
- data/spec/{integration → features}/translation_integration_spec.rb +0 -0
- data/spec/helpers/admin/base_helper_spec.rb +0 -50
- data/spec/helpers/admin/tags_helper_spec.rb +53 -0
- data/spec/helpers/base_helper_spec.rb +19 -3
- data/spec/helpers/pages_helper_spec.rb +92 -44
- data/spec/{url_helpers_spec.rb → helpers/picture_url_helpers_spec.rb} +7 -7
- data/spec/helpers/url_helper_spec.rb +92 -72
- data/spec/{config_spec.rb → libraries/config_spec.rb} +0 -0
- data/spec/libraries/resource_spec.rb +215 -76
- data/spec/libraries/resources_helper_spec.rb +70 -28
- data/spec/models/attachment_spec.rb +75 -9
- data/spec/models/clipboard_spec.rb +1 -1
- data/spec/models/element_spec.rb +7 -0
- data/spec/models/page_spec.rb +144 -25
- data/spec/models/picture_spec.rb +5 -5
- data/spec/models/resource_spec.rb +47 -10
- data/spec/models/user_spec.rb +115 -3
- data/spec/{routing_spec.rb → routing/routing_spec.rb} +8 -20
- data/spec/spec_helper.rb +5 -6
- data/spec/support/alchemy/specs_helpers.rb +1 -1
- data/spec/support/ci/install_phantomjs +1 -1
- data/spec/support/image with spaces.png +0 -0
- data/vendor/assets/javascripts/jquery_plugins/jquery.Jcrop.min.js +18 -18
- data/vendor/assets/javascripts/jquery_plugins/{jquery.dialogextend.1_0_1.js → jquery.dialogextend.js} +25 -17
- data/vendor/assets/javascripts/jquery_plugins/jquery.scrollTo.min.js +7 -0
- data/vendor/assets/javascripts/jquery_plugins/jquery.ui.tabspaging.js +7 -7
- data/vendor/assets/javascripts/keymage.min.js +6 -0
- data/vendor/assets/javascripts/spin.min.js +1 -0
- metadata +122 -124
- data/app/assets/images/alchemy/ajax_loader.gif +0 -0
- data/app/assets/images/alchemy/gui/toggle.png +0 -0
- data/app/assets/images/alchemy/image_loader.gif +0 -0
- data/app/assets/images/alchemy/shading.png +0 -0
- data/app/assets/images/alchemy/tabs.gif +0 -0
- data/app/assets/javascripts/alchemy/alchemy.base.js +0 -172
- data/app/assets/javascripts/alchemy/alchemy.datepicker.js +0 -47
- data/app/assets/javascripts/alchemy/alchemy.element_editor_selector.js +0 -91
- data/app/assets/javascripts/alchemy/alchemy.growler.js +0 -46
- data/app/assets/javascripts/alchemy/alchemy.image_cropper.js +0 -60
- data/app/assets/javascripts/alchemy/alchemy.js_extensions.js +0 -15
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js +0 -97
- data/app/assets/javascripts/alchemy/alchemy.windows.js +0 -321
- data/app/models/alchemy/clipboard_spec.rb +0 -0
- data/app/views/alchemy/admin/pictures/show_in_window.html.erb +0 -8
- data/app/views/alchemy/notifications/registered_user_created.text.erb +0 -11
- data/db/migrate/20121121162313_switch_from_fleximage_to_dragonfly.rb +0 -21
- data/db/migrate/20121205155004_create_alchemy_sites.rb +0 -14
- data/db/migrate/20121211163003_add_public_to_alchemy_sites.rb +0 -6
- data/db/migrate/20121220102223_add_aliases_to_site.rb +0 -6
- data/db/migrate/20130110212411_create_alchemy_legacy_page_urls.rb +0 -11
- data/db/migrate/20130121092645_migrate_to_devise.rb +0 -24
- data/spec/alchemy_spec.rb +0 -7
- data/spec/dummy/db/migrate/20121121162313_switch_from_fleximage_to_dragonfly.rb +0 -21
- data/spec/dummy/db/migrate/20121205155004_create_alchemy_sites.rb +0 -14
- data/spec/dummy/db/migrate/20121211163003_add_public_to_alchemy_sites.rb +0 -6
- data/spec/dummy/db/migrate/20121220102223_add_aliases_to_site.rb +0 -6
- data/spec/dummy/db/migrate/20130110212411_create_alchemy_legacy_page_urls.rb +0 -11
- data/spec/dummy/db/migrate/20130121092645_migrate_to_devise.rb +0 -24
- data/vendor/assets/javascripts/jquery_plugins/jquery.scrollTo-1.4.2-min.js +0 -11
data/app/models/alchemy/cell.rb
CHANGED
@@ -54,7 +54,7 @@ module Alchemy
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def self.translated_label_for(cell_name)
|
57
|
-
I18n.t(cell_name, :
|
57
|
+
I18n.t(cell_name, scope: 'cell_names', default: cell_name.to_s.humanize)
|
58
58
|
end
|
59
59
|
|
60
60
|
# Returns the cell definition defined in +config/alchemy/cells.yml+
|
@@ -25,12 +25,17 @@ module Alchemy
|
|
25
25
|
#validates_uniqueness_of :name, :scope => :element_id
|
26
26
|
validates_uniqueness_of :position, :scope => [:element_id, :essence_type]
|
27
27
|
|
28
|
+
# Essence scopes
|
29
|
+
scope :essence_booleans, where(:essence_type => "Alchemy::EssenceBoolean")
|
30
|
+
scope :essence_dates, where(:essence_type => "Alchemy::EssenceDate")
|
31
|
+
scope :essence_files, where(:essence_type => "Alchemy::EssenceFile")
|
32
|
+
scope :essence_htmls, where(:essence_type => "Alchemy::EssenceHtml")
|
33
|
+
scope :essence_links, where(:essence_type => "Alchemy::EssenceLink")
|
28
34
|
scope :essence_pictures, where(:essence_type => "Alchemy::EssencePicture")
|
29
35
|
scope :gallery_pictures, essence_pictures.where("#{self.table_name}.name LIKE 'essence_picture_%'")
|
30
|
-
scope :essence_texts, where(:essence_type => "Alchemy::EssenceText")
|
31
36
|
scope :essence_richtexts, where(:essence_type => "Alchemy::EssenceRichtext")
|
32
37
|
scope :essence_selects, where(:essence_type => "Alchemy::EssenceSelect")
|
33
|
-
scope :
|
38
|
+
scope :essence_texts, where(:essence_type => "Alchemy::EssenceText")
|
34
39
|
|
35
40
|
class << self
|
36
41
|
|
@@ -97,17 +102,21 @@ module Alchemy
|
|
97
102
|
#
|
98
103
|
# alchemy:
|
99
104
|
# content_names:
|
100
|
-
#
|
105
|
+
# foo: Bar
|
101
106
|
#
|
102
107
|
# Optionally you can scope your content name to an element:
|
103
108
|
#
|
104
109
|
# alchemy:
|
105
110
|
# content_names:
|
106
|
-
#
|
107
|
-
#
|
111
|
+
# article:
|
112
|
+
# foo: Baz
|
108
113
|
#
|
109
114
|
def translated_label_for(content_name, element_name = nil)
|
110
|
-
|
115
|
+
I18n.t(
|
116
|
+
content_name,
|
117
|
+
scope: "content_names.#{element_name}",
|
118
|
+
default: I18n.t("content_names.#{content_name}", default: content_name.humanize)
|
119
|
+
)
|
111
120
|
end
|
112
121
|
|
113
122
|
# Returns all content descriptions from elements.yml
|
@@ -261,10 +270,12 @@ module Alchemy
|
|
261
270
|
end
|
262
271
|
end
|
263
272
|
|
273
|
+
# Returns the default value from content description
|
274
|
+
# If the value is a symbol it gets passed through i18n inside the +alchemy.default_content_texts+ scope
|
264
275
|
def default_text(default)
|
265
|
-
|
266
|
-
|
267
|
-
I18n.t(default, :
|
276
|
+
case default
|
277
|
+
when Symbol
|
278
|
+
I18n.t(default, scope: :default_content_texts)
|
268
279
|
else
|
269
280
|
default
|
270
281
|
end
|
@@ -326,14 +326,15 @@ module Alchemy
|
|
326
326
|
# Translate the name in your config/locales language file. Example:
|
327
327
|
#
|
328
328
|
# de:
|
329
|
-
#
|
330
|
-
#
|
329
|
+
# alchemy:
|
330
|
+
# element_names:
|
331
|
+
# contactform: 'Kontakt Formular'
|
331
332
|
#
|
332
|
-
# If no translation is found
|
333
|
+
# If no translation is found a humanized name is used.
|
333
334
|
#
|
334
335
|
def display_name
|
335
|
-
return name.
|
336
|
-
I18n.t(description['name'], :
|
336
|
+
return name.humanize if description.blank?
|
337
|
+
I18n.t(description['name'], scope: 'element_names', default: description['name'].to_s.humanize)
|
337
338
|
end
|
338
339
|
|
339
340
|
# Gets the preview text from the first Content found in the +elements.yml+ Element description file.
|
@@ -402,9 +403,10 @@ module Alchemy
|
|
402
403
|
self.ingredient(name).present?
|
403
404
|
end
|
404
405
|
|
405
|
-
def save_contents(
|
406
|
+
def save_contents(contents_attributes)
|
407
|
+
return true if contents_attributes.nil?
|
406
408
|
contents.each do |content|
|
407
|
-
unless content.update_essence(
|
409
|
+
unless content.update_essence(contents_attributes["content_#{content.id}"])
|
408
410
|
errors.add(:base, :essence_validation_failed)
|
409
411
|
end
|
410
412
|
end
|
data/app/models/alchemy/page.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
module Alchemy
|
3
2
|
class Page < ActiveRecord::Base
|
4
3
|
|
5
|
-
RESERVED_URLNAMES = %w(admin messages new)
|
6
4
|
DEFAULT_ATTRIBUTES_FOR_COPY = {
|
7
5
|
:do_not_autogenerate => true,
|
8
6
|
:do_not_sweep => true,
|
@@ -45,36 +43,20 @@ module Alchemy
|
|
45
43
|
stampable(:stamper_class_name => 'Alchemy::User')
|
46
44
|
|
47
45
|
has_many :folded_pages
|
48
|
-
has_many :cells, :dependent => :destroy
|
49
|
-
has_many :elements, :order => :position
|
50
|
-
has_many :contents, :through => :elements
|
51
46
|
has_many :legacy_urls, :class_name => 'Alchemy::LegacyPageUrl'
|
52
|
-
has_and_belongs_to_many :to_be_sweeped_elements, :class_name => 'Alchemy::Element', :uniq => true, :join_table => 'alchemy_elements_alchemy_pages'
|
53
47
|
belongs_to :language
|
54
48
|
|
55
49
|
validates_presence_of :language, :on => :create, :unless => :root
|
56
|
-
validates_presence_of :name
|
57
50
|
validates_presence_of :page_layout, :unless => :systempage?
|
58
51
|
validates_presence_of :parent_id, :if => proc { Page.count > 1 }
|
59
|
-
validates_length_of :urlname, :minimum => 3, :if => :urlname_entered?
|
60
|
-
validates_uniqueness_of :urlname, :scope => [:language_id, :layoutpage], :if => :urlname_entered?
|
61
|
-
validates :urlname, :exclusion => {:in => RESERVED_URLNAMES}
|
62
52
|
|
63
|
-
attr_accessor :do_not_autogenerate
|
64
53
|
attr_accessor :do_not_sweep
|
65
54
|
attr_accessor :do_not_validate_language
|
66
55
|
|
67
|
-
before_validation :set_url_name, :unless => proc { |page| page.systempage? || page.redirects_to_external? }
|
68
|
-
before_save :set_title, :unless => proc { |page| page.systempage? || page.redirects_to_external? || !page.title.blank? }
|
69
56
|
before_save :set_language_code, :unless => :systempage?
|
70
|
-
before_save :set_restrictions_to_child_pages, :if =>
|
71
|
-
before_save :inherit_restricted_status, :if => proc {
|
72
|
-
|
73
|
-
after_create :autogenerate_elements, :unless => proc { |page| page.systempage? || page.do_not_autogenerate }
|
74
|
-
after_update :trash_not_allowed_elements, :if => :page_layout_changed?
|
75
|
-
after_update :autogenerate_elements, :if => :page_layout_changed?
|
76
|
-
after_update :create_legacy_url, :if => proc { |page| page.urlname_changed? && !page.redirects_to_external? }
|
77
|
-
after_destroy { elements.each {|el| el.destroy unless el.trashed? } }
|
57
|
+
before_save :set_restrictions_to_child_pages, :if => :restricted_changed?, :unless => :systempage?
|
58
|
+
before_save :inherit_restricted_status, :if => proc { parent && parent.restricted? }, :unless => :systempage?
|
59
|
+
after_update :create_legacy_url, :if => :urlname_changed?, :unless => :redirects_to_external?
|
78
60
|
|
79
61
|
scope :language_roots, where(:language_root => true)
|
80
62
|
scope :layoutpages, where(:layoutpage => true)
|
@@ -101,6 +83,11 @@ module Alchemy
|
|
101
83
|
# TODO: add this as default_scope
|
102
84
|
#default_scope { from_current_site }
|
103
85
|
|
86
|
+
# Concerns
|
87
|
+
include Naming
|
88
|
+
include Cells
|
89
|
+
include Elements
|
90
|
+
|
104
91
|
# Class methods
|
105
92
|
#
|
106
93
|
class << self
|
@@ -142,44 +129,6 @@ module Alchemy
|
|
142
129
|
end
|
143
130
|
end
|
144
131
|
|
145
|
-
# Copy page cells
|
146
|
-
#
|
147
|
-
# @param source [Alchemy::Page]
|
148
|
-
# @param target [Alchemy::Page]
|
149
|
-
# @return [Array]
|
150
|
-
#
|
151
|
-
def copy_cells(source, target)
|
152
|
-
new_cells = []
|
153
|
-
source.cells.each do |cell|
|
154
|
-
new_cells << Cell.create(:name => cell.name, :page_id => target.id)
|
155
|
-
end
|
156
|
-
new_cells
|
157
|
-
end
|
158
|
-
|
159
|
-
# Copy page elements
|
160
|
-
#
|
161
|
-
# @param source [Alchemy::Page]
|
162
|
-
# @param target [Alchemy::Page]
|
163
|
-
# @return [Array]
|
164
|
-
#
|
165
|
-
def copy_elements(source, target)
|
166
|
-
new_elements = []
|
167
|
-
source.elements.not_trashed.each do |element|
|
168
|
-
# detect cell for element
|
169
|
-
if element.cell
|
170
|
-
cell = target.cells.detect { |c| c.name == element.cell.name }
|
171
|
-
else
|
172
|
-
cell = nil
|
173
|
-
end
|
174
|
-
# if cell is nil also pass nil to element.cell_id
|
175
|
-
new_element = Element.copy(element, :page_id => target.id, :cell_id => (cell.blank? ? nil : cell.id))
|
176
|
-
# move element to bottom of the list
|
177
|
-
new_element.move_to_bottom
|
178
|
-
new_elements << new_element
|
179
|
-
end
|
180
|
-
new_elements
|
181
|
-
end
|
182
|
-
|
183
132
|
def layout_root_for(language_id)
|
184
133
|
where({:parent_id => Page.root.id, :layoutpage => true, :language_id => language_id}).limit(1).first
|
185
134
|
end
|
@@ -216,12 +165,10 @@ module Alchemy
|
|
216
165
|
end
|
217
166
|
|
218
167
|
def link_target_options
|
219
|
-
options = [
|
220
|
-
[I18n.t('default', :scope => :link_target_options), '']
|
221
|
-
]
|
168
|
+
options = [[I18n.t(:default, scope: 'link_target_options'), '']]
|
222
169
|
link_target_options = Config.get(:link_target_options)
|
223
170
|
link_target_options.each do |option|
|
224
|
-
options << [I18n.t(option, :
|
171
|
+
options << [I18n.t(option, scope: 'link_target_options', default: option.to_s.humanize), option]
|
225
172
|
end
|
226
173
|
options
|
227
174
|
end
|
@@ -231,79 +178,6 @@ module Alchemy
|
|
231
178
|
# Instance methods
|
232
179
|
#
|
233
180
|
|
234
|
-
# Finds selected elements from page.
|
235
|
-
#
|
236
|
-
# Returns only public elements by default.
|
237
|
-
# Pass true as second argument to get all elements.
|
238
|
-
#
|
239
|
-
# === Options are:
|
240
|
-
#
|
241
|
-
# :only => Array of element names # Returns only elements with given names
|
242
|
-
# :except => Array of element names # Returns all elements except the ones with given names
|
243
|
-
# :count => Integer # Limit the count of returned elements
|
244
|
-
# :offset => Integer # Starts with an offset while returning elements
|
245
|
-
# :random => Boolean # Return elements randomly shuffled
|
246
|
-
# :from_cell => Cell or String # Return elements from given cell
|
247
|
-
#
|
248
|
-
def find_selected_elements(options = {}, show_non_public = false)
|
249
|
-
if options[:from_cell].class.name == 'Alchemy::Cell'
|
250
|
-
elements = options[:from_cell].elements
|
251
|
-
elsif !options[:from_cell].blank? && options[:from_cell].class.name == 'String'
|
252
|
-
cell = cells.find_by_name(options[:from_cell])
|
253
|
-
if cell
|
254
|
-
elements = cell.elements
|
255
|
-
else
|
256
|
-
warn("Cell with name `#{options[:from_cell]}` could not be found!")
|
257
|
-
# Returns an empty relation. Can be removed with the release of Rails 4
|
258
|
-
elements = self.elements.where('1 = 0')
|
259
|
-
end
|
260
|
-
else
|
261
|
-
elements = self.elements.not_in_cell
|
262
|
-
end
|
263
|
-
if !options[:only].blank?
|
264
|
-
elements = elements.named(options[:only])
|
265
|
-
elsif !options[:except].blank?
|
266
|
-
elements = elements.excluded(options[:except])
|
267
|
-
end
|
268
|
-
elements = elements.reverse_order if options[:reverse_sort] || options[:reverse]
|
269
|
-
elements = elements.offset(options[:offset]).limit(options[:count])
|
270
|
-
elements = elements.order("RAND()") if options[:random]
|
271
|
-
show_non_public ? elements : elements.published
|
272
|
-
end
|
273
|
-
|
274
|
-
# What is this? A Kind of proxy method? Why not rendering the elements directly if you already have them????
|
275
|
-
def find_elements(options = {}, show_non_public = false)
|
276
|
-
if !options[:collection].blank? && options[:collection].is_a?(Array)
|
277
|
-
return options[:collection]
|
278
|
-
else
|
279
|
-
find_selected_elements(options, show_non_public)
|
280
|
-
end
|
281
|
-
end
|
282
|
-
|
283
|
-
# Returns all elements that should be feeded via rss.
|
284
|
-
#
|
285
|
-
# Define feedable elements in your +page_layouts.yml+:
|
286
|
-
#
|
287
|
-
# - name: news
|
288
|
-
# feed: true
|
289
|
-
# feed_elements: [element_name, element_2_name]
|
290
|
-
#
|
291
|
-
def feed_elements
|
292
|
-
elements.find_all_by_name(definition['feed_elements'])
|
293
|
-
end
|
294
|
-
|
295
|
-
def elements_grouped_by_cells
|
296
|
-
elements.not_trashed.in_cell.group_by(&:cell)
|
297
|
-
end
|
298
|
-
|
299
|
-
def element_names_from_cells
|
300
|
-
cell_definitions.collect { |c| c['elements'] }.flatten.uniq
|
301
|
-
end
|
302
|
-
|
303
|
-
def element_names_not_in_cell
|
304
|
-
layout_description['elements'].uniq - element_names_from_cells
|
305
|
-
end
|
306
|
-
|
307
181
|
# Finds the previous page on the same structure level. Otherwise it returns nil.
|
308
182
|
# Options:
|
309
183
|
# => :restricted => boolean (standard: nil) - next restricted page (true), skip restricted pages (false), ignore restriction (nil)
|
@@ -328,29 +202,6 @@ module Alchemy
|
|
328
202
|
end
|
329
203
|
alias_method :next_page, :next
|
330
204
|
|
331
|
-
def name_entered?
|
332
|
-
!self.name.blank?
|
333
|
-
end
|
334
|
-
|
335
|
-
def urlname_entered?
|
336
|
-
!self.urlname.blank?
|
337
|
-
end
|
338
|
-
|
339
|
-
def set_url_name
|
340
|
-
self.urlname = convert_url_name((self.urlname.blank? ? self.name : self.urlname))
|
341
|
-
end
|
342
|
-
|
343
|
-
def set_title
|
344
|
-
self.title = self.name
|
345
|
-
end
|
346
|
-
|
347
|
-
def show_in_navigation?
|
348
|
-
if visible?
|
349
|
-
return true
|
350
|
-
end
|
351
|
-
return false
|
352
|
-
end
|
353
|
-
|
354
205
|
def lock(user)
|
355
206
|
self.locked = true
|
356
207
|
self.locked_by = user.id
|
@@ -364,10 +215,6 @@ module Alchemy
|
|
364
215
|
self.save
|
365
216
|
end
|
366
217
|
|
367
|
-
def public_elements
|
368
|
-
self.elements.select { |m| m.public? }
|
369
|
-
end
|
370
|
-
|
371
218
|
# Returns the name of the creator of this page.
|
372
219
|
def creator
|
373
220
|
@page_creator ||= User.find_by_id(creator_id)
|
@@ -405,10 +252,6 @@ module Alchemy
|
|
405
252
|
folded_page.folded
|
406
253
|
end
|
407
254
|
|
408
|
-
def elements_by_type type
|
409
|
-
elements.select { |m| type.include? m.name }
|
410
|
-
end
|
411
|
-
|
412
255
|
# Returns a Hash of attributes describing the status of the Page.
|
413
256
|
#
|
414
257
|
def status
|
@@ -451,12 +294,6 @@ module Alchemy
|
|
451
294
|
end
|
452
295
|
alias_method :definition, :layout_description
|
453
296
|
|
454
|
-
def cell_definitions
|
455
|
-
cell_names = self.layout_description['cells']
|
456
|
-
return [] if cell_names.blank?
|
457
|
-
Cell.all_definitions_for(cell_names)
|
458
|
-
end
|
459
|
-
|
460
297
|
# Returns translated name of the pages page_layout value.
|
461
298
|
# Page layout names are defined inside the config/alchemy/page_layouts.yml file.
|
462
299
|
# Translate the name in your config/locales language yml file.
|
@@ -464,10 +301,6 @@ module Alchemy
|
|
464
301
|
I18n.t(self.page_layout, :scope => :page_layout_names)
|
465
302
|
end
|
466
303
|
|
467
|
-
def renamed?
|
468
|
-
self.name_was != self.name || self.urlname_was != self.urlname
|
469
|
-
end
|
470
|
-
|
471
304
|
def changed_publicity?
|
472
305
|
self.public_was != self.public
|
473
306
|
end
|
@@ -491,19 +324,14 @@ module Alchemy
|
|
491
324
|
definition["redirects_to_external"]
|
492
325
|
end
|
493
326
|
|
327
|
+
# Returns the first published child
|
494
328
|
def first_public_child
|
495
|
-
|
329
|
+
children.published.first
|
496
330
|
end
|
497
331
|
|
498
332
|
# Gets the language_root page for page
|
499
333
|
def get_language_root
|
500
|
-
|
501
|
-
page = self
|
502
|
-
while page.parent do
|
503
|
-
page = page.parent
|
504
|
-
break if page.language_root?
|
505
|
-
end
|
506
|
-
return page
|
334
|
+
self_and_ancestors.where(:language_root => true).first
|
507
335
|
end
|
508
336
|
|
509
337
|
def copy_children_to(new_parent)
|
@@ -518,15 +346,6 @@ module Alchemy
|
|
518
346
|
end
|
519
347
|
end
|
520
348
|
|
521
|
-
# Returns true or false if the page has a page_layout that has cells.
|
522
|
-
def can_have_cells?
|
523
|
-
!definition['cells'].blank?
|
524
|
-
end
|
525
|
-
|
526
|
-
def has_cells?
|
527
|
-
cells.any?
|
528
|
-
end
|
529
|
-
|
530
349
|
def locker_name
|
531
350
|
return I18n.t('unknown') if self.locker.nil?
|
532
351
|
self.locker.name
|
@@ -541,7 +360,7 @@ module Alchemy
|
|
541
360
|
rootpage? || (self.parent_id == Page.root.id && !self.language_root?)
|
542
361
|
end
|
543
362
|
|
544
|
-
# Overwrites the cache_key method
|
363
|
+
# Overwrites the cache_key method.
|
545
364
|
def cache_key(request = nil)
|
546
365
|
"alchemy/pages/#{id}"
|
547
366
|
end
|
@@ -578,66 +397,14 @@ module Alchemy
|
|
578
397
|
pages.order(order_direction).limit(1).first
|
579
398
|
end
|
580
399
|
|
581
|
-
# Converts the given nbame into an url friendly string
|
582
|
-
# Names shorter than 3 will be filled with dashes, so it does not collidate with the language code.
|
583
|
-
def convert_url_name(name)
|
584
|
-
url_name = name.gsub(/[äÄ]/, 'ae').gsub(/[üÜ]/, 'ue').gsub(/[öÖ]/, 'oe').parameterize
|
585
|
-
url_name = ('-' * (3 - url_name.length)) + url_name if url_name.length < 3
|
586
|
-
return url_name
|
587
|
-
end
|
588
|
-
|
589
|
-
# Looks in the page_layout descripion, if there are elements to autogenerate.
|
590
|
-
#
|
591
|
-
# And if so, it generates them.
|
592
|
-
#
|
593
|
-
# If the page has cells, it looks if there are elements to generate.
|
594
|
-
#
|
595
|
-
def autogenerate_elements
|
596
|
-
elements_already_on_page = self.elements.available.collect(&:name)
|
597
|
-
elements = self.layout_description["autogenerate"]
|
598
|
-
if elements.present?
|
599
|
-
elements.each do |element|
|
600
|
-
next if elements_already_on_page.include?(element)
|
601
|
-
Element.create_from_scratch(attributes_for_element_name(element))
|
602
|
-
end
|
603
|
-
end
|
604
|
-
end
|
605
|
-
|
606
|
-
# Returns a hash of attributes for given element name
|
607
|
-
def attributes_for_element_name(element)
|
608
|
-
if self.has_cells? && (cell_definition = cell_definitions.detect { |c| c['elements'].include?(element) })
|
609
|
-
cell = self.cells.find_by_name(cell_definition['name'])
|
610
|
-
if cell
|
611
|
-
return {:page_id => self.id, :cell_id => cell.id, :name => element}
|
612
|
-
else
|
613
|
-
raise "Cell not found for page #{self.inspect}"
|
614
|
-
end
|
615
|
-
else
|
616
|
-
return {:page_id => self.id, :name => element}
|
617
|
-
end
|
618
|
-
end
|
619
|
-
|
620
400
|
def set_language_code
|
621
401
|
return false if self.language.blank?
|
622
402
|
self.language_code = self.language.code
|
623
403
|
end
|
624
404
|
|
625
|
-
def create_cells
|
626
|
-
return false if !can_have_cells?
|
627
|
-
definition['cells'].each do |cellname|
|
628
|
-
cells.create({:name => cellname})
|
629
|
-
end
|
630
|
-
end
|
631
|
-
|
632
|
-
# Trashes all elements that are not allowed for this page_layout.
|
633
|
-
def trash_not_allowed_elements
|
634
|
-
elements.select { |e| !definition['elements'].include?(e.name) }.map(&:trash)
|
635
|
-
end
|
636
|
-
|
637
405
|
# Stores the old urlname in a LegacyPageUrl
|
638
406
|
def create_legacy_url
|
639
|
-
|
640
|
-
legacy_url.save!
|
407
|
+
legacy_urls.find_or_create_by_urlname(:urlname => urlname_was)
|
641
408
|
end
|
642
409
|
|
643
410
|
end
|