alchemy_cms 4.6.6 → 5.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +33 -1
- data/.github/workflows/stale.yml +1 -1
- data/.gitignore +20 -2
- data/.hound.yml +2 -1
- data/.prettierrc +6 -0
- data/.rubocop.yml +31 -10
- data/CHANGELOG.md +89 -27
- data/Gemfile +24 -22
- data/README.md +31 -19
- data/Rakefile +10 -8
- data/alchemy_cms.gemspec +6 -5
- data/app/assets/javascripts/alchemy/admin.js +1 -5
- data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +2 -1
- data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +0 -2
- data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +17 -17
- data/app/assets/javascripts/alchemy/node_select.js +39 -0
- data/app/assets/javascripts/alchemy/templates/index.js +1 -0
- data/app/assets/javascripts/alchemy/templates/node.hbs +16 -0
- data/app/assets/stylesheets/alchemy/admin.scss +3 -2
- data/app/assets/stylesheets/alchemy/base.scss +0 -1
- data/app/assets/stylesheets/alchemy/elements.scss +1 -1
- data/app/assets/stylesheets/alchemy/forms.scss +5 -0
- data/app/assets/stylesheets/alchemy/node-select.scss +43 -0
- data/app/assets/stylesheets/alchemy/nodes.scss +1 -1
- data/app/assets/stylesheets/alchemy/sitemap.scss +5 -1
- data/app/assets/stylesheets/alchemy/tables.scss +1 -24
- data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +3 -3
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +7 -7
- data/app/controllers/alchemy/admin/attachments_controller.rb +8 -7
- data/app/controllers/alchemy/admin/base_controller.rb +13 -33
- data/app/controllers/alchemy/admin/clipboard_controller.rb +5 -4
- data/app/controllers/alchemy/admin/contents_controller.rb +1 -2
- data/app/controllers/alchemy/admin/dashboard_controller.rb +10 -9
- data/app/controllers/alchemy/admin/elements_controller.rb +20 -20
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +12 -14
- data/app/controllers/alchemy/admin/languages_controller.rb +35 -2
- data/app/controllers/alchemy/admin/layoutpages_controller.rb +5 -2
- data/app/controllers/alchemy/admin/nodes_controller.rb +5 -4
- data/app/controllers/alchemy/admin/pages_controller.rb +50 -62
- data/app/controllers/alchemy/admin/pictures_controller.rb +16 -16
- data/app/controllers/alchemy/admin/resources_controller.rb +21 -13
- data/app/controllers/alchemy/admin/sites_controller.rb +18 -0
- data/app/controllers/alchemy/admin/styleguide_controller.rb +1 -0
- data/app/controllers/alchemy/admin/tags_controller.rb +5 -3
- data/app/controllers/alchemy/admin/trash_controller.rb +6 -6
- data/app/controllers/alchemy/api/base_controller.rb +2 -2
- data/app/controllers/alchemy/api/contents_controller.rb +4 -4
- data/app/controllers/alchemy/api/elements_controller.rb +8 -8
- data/app/controllers/alchemy/api/nodes_controller.rb +37 -1
- data/app/controllers/alchemy/api/pages_controller.rb +14 -23
- data/app/controllers/alchemy/attachments_controller.rb +5 -5
- data/app/controllers/alchemy/base_controller.rb +10 -9
- data/app/controllers/alchemy/messages_controller.rb +16 -23
- data/app/controllers/alchemy/pages_controller.rb +13 -11
- data/app/controllers/concerns/alchemy/admin/archive_overlay.rb +3 -2
- data/app/controllers/concerns/alchemy/admin/current_language.rb +23 -0
- data/app/controllers/concerns/alchemy/admin/uploader_responses.rb +5 -5
- data/app/controllers/concerns/alchemy/legacy_page_redirects.rb +4 -4
- data/app/controllers/concerns/alchemy/page_redirects.rb +2 -9
- data/app/controllers/concerns/alchemy/site_redirects.rb +2 -2
- data/app/decorators/alchemy/element_editor.rb +39 -0
- data/app/helpers/alchemy/admin/attachments_helper.rb +6 -6
- data/app/helpers/alchemy/admin/base_helper.rb +36 -35
- data/app/helpers/alchemy/admin/contents_helper.rb +3 -3
- data/app/helpers/alchemy/admin/elements_helper.rb +3 -88
- data/app/helpers/alchemy/admin/essences_helper.rb +8 -117
- data/app/helpers/alchemy/admin/form_helper.rb +1 -1
- data/app/helpers/alchemy/admin/navigation_helper.rb +24 -23
- data/app/helpers/alchemy/admin/pages_helper.rb +4 -4
- data/app/helpers/alchemy/admin/pictures_helper.rb +3 -3
- data/app/helpers/alchemy/admin/tags_helper.rb +8 -7
- data/app/helpers/alchemy/base_helper.rb +13 -8
- data/app/helpers/alchemy/elements_block_helper.rb +2 -31
- data/app/helpers/alchemy/elements_helper.rb +12 -58
- data/app/helpers/alchemy/pages_helper.rb +24 -174
- data/app/helpers/alchemy/url_helper.rb +2 -1
- data/app/mailers/alchemy/base_mailer.rb +1 -1
- data/app/mailers/alchemy/messages_mailer.rb +1 -1
- data/app/models/alchemy/attachment.rb +21 -19
- data/app/models/alchemy/base_record.rb +2 -5
- data/app/models/alchemy/content/factory.rb +24 -31
- data/app/models/alchemy/content.rb +33 -38
- data/app/models/alchemy/element/definitions.rb +4 -4
- data/app/models/alchemy/element/element_contents.rb +9 -6
- data/app/models/alchemy/element/element_essences.rb +4 -3
- data/app/models/alchemy/element/presenters.rb +3 -2
- data/app/models/alchemy/element.rb +46 -54
- data/app/models/alchemy/element_to_page.rb +1 -1
- data/app/models/alchemy/essence_boolean.rb +1 -3
- data/app/models/alchemy/essence_date.rb +2 -3
- data/app/models/alchemy/essence_file.rb +4 -4
- data/app/models/alchemy/essence_html.rb +1 -3
- data/app/models/alchemy/essence_link.rb +1 -3
- data/app/models/alchemy/essence_node.rb +18 -0
- data/app/models/alchemy/essence_page.rb +3 -16
- data/app/models/alchemy/essence_picture.rb +17 -16
- data/app/models/alchemy/essence_picture_view.rb +7 -6
- data/app/models/alchemy/essence_richtext.rb +1 -3
- data/app/models/alchemy/essence_select.rb +1 -3
- data/app/models/alchemy/essence_text.rb +0 -2
- data/app/models/alchemy/folded_page.rb +1 -0
- data/app/models/alchemy/language/code.rb +4 -4
- data/app/models/alchemy/language.rb +21 -35
- data/app/models/alchemy/legacy_page_url.rb +1 -1
- data/app/models/alchemy/message.rb +3 -3
- data/app/models/alchemy/node.rb +28 -5
- data/app/models/alchemy/page/fixed_attributes.rb +3 -2
- data/app/models/alchemy/page/page_elements.rb +35 -44
- data/app/models/alchemy/page/page_naming.rb +20 -70
- data/app/models/alchemy/page/page_natures.rb +7 -34
- data/app/models/alchemy/page/page_scopes.rb +23 -29
- data/app/models/alchemy/page/url_path.rb +0 -2
- data/app/models/alchemy/page.rb +47 -128
- data/app/models/alchemy/picture/transformations.rb +9 -7
- data/app/models/alchemy/picture/url.rb +5 -5
- data/app/models/alchemy/picture.rb +19 -28
- data/app/models/alchemy/site/layout.rb +2 -2
- data/app/models/alchemy/site.rb +6 -36
- data/app/models/concerns/alchemy/touch_elements.rb +24 -0
- data/app/serializers/alchemy/content_serializer.rb +0 -3
- data/app/serializers/alchemy/essence_boolean_serializer.rb +3 -3
- data/app/serializers/alchemy/essence_date_serializer.rb +3 -3
- data/app/serializers/alchemy/essence_file_serializer.rb +4 -2
- data/app/serializers/alchemy/essence_html_serializer.rb +3 -3
- data/app/serializers/alchemy/essence_link_serializer.rb +3 -3
- data/app/serializers/alchemy/essence_picture_serializer.rb +5 -4
- data/app/serializers/alchemy/essence_richtext_serializer.rb +3 -3
- data/app/serializers/alchemy/essence_select_serializer.rb +3 -3
- data/app/serializers/alchemy/essence_text_serializer.rb +5 -4
- data/app/serializers/alchemy/node_serializer.rb +2 -0
- data/app/serializers/alchemy/page_tree_serializer.rb +9 -13
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +1 -2
- data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +1 -2
- data/app/views/alchemy/admin/attachments/_files_list.html.erb +4 -4
- data/app/views/alchemy/admin/contents/create.js.erb +1 -3
- data/app/views/alchemy/admin/elements/_element.html.erb +9 -18
- data/app/views/alchemy/admin/elements/create.js.erb +1 -1
- data/app/views/alchemy/admin/elements/fold.js.erb +1 -1
- data/app/views/alchemy/admin/elements/index.html.erb +3 -3
- data/app/views/alchemy/admin/essence_files/assign.js.erb +1 -6
- data/app/views/alchemy/admin/essence_files/edit.html.erb +1 -1
- data/app/views/alchemy/admin/essence_pictures/assign.js.erb +1 -7
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +1 -1
- data/app/views/alchemy/admin/essence_pictures/edit.html.erb +7 -7
- data/app/views/alchemy/admin/essence_pictures/update.js.erb +1 -1
- data/app/views/alchemy/admin/languages/_form.html.erb +5 -5
- data/app/views/alchemy/admin/languages/_table.html.erb +3 -3
- data/app/views/alchemy/admin/languages/edit.html.erb +1 -0
- data/app/views/alchemy/admin/languages/index.html.erb +23 -4
- data/app/views/alchemy/admin/languages/new.html.erb +1 -0
- data/app/views/alchemy/admin/layoutpages/index.html.erb +3 -3
- data/app/views/alchemy/admin/nodes/_form.html.erb +18 -15
- data/app/views/alchemy/admin/nodes/_node.html.erb +1 -5
- data/app/views/alchemy/admin/nodes/index.html.erb +3 -4
- data/app/views/alchemy/admin/pages/_create_language_form.html.erb +0 -8
- data/app/views/alchemy/admin/pages/_form.html.erb +0 -1
- data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -0
- data/app/views/alchemy/admin/pages/_page.html.erb +11 -19
- data/app/views/alchemy/admin/pages/_page_infos.html.erb +0 -4
- data/app/views/alchemy/admin/pages/edit.html.erb +1 -1
- data/app/views/alchemy/admin/pages/info.html.erb +0 -9
- data/app/views/alchemy/admin/pages/unlock.js.erb +13 -6
- data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +0 -2
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +1 -5
- data/app/views/alchemy/admin/pictures/_overlay_picture_list.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -2
- data/app/views/alchemy/admin/resources/_resource.html.erb +1 -1
- data/app/views/alchemy/admin/resources/_table.html.erb +2 -2
- data/app/views/alchemy/admin/sites/_form.html.erb +8 -0
- data/app/views/alchemy/admin/sites/edit.html.erb +1 -0
- data/app/views/alchemy/admin/sites/index.html.erb +21 -9
- data/app/views/alchemy/admin/sites/new.html.erb +1 -0
- data/app/views/alchemy/admin/tags/index.html.erb +2 -2
- data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +10 -12
- data/app/views/alchemy/essences/_essence_date_editor.html.erb +11 -8
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +16 -17
- data/app/views/alchemy/essences/_essence_html_editor.html.erb +8 -5
- data/app/views/alchemy/essences/_essence_link_editor.html.erb +18 -15
- data/app/views/alchemy/essences/_essence_node_editor.html.erb +27 -0
- data/app/views/alchemy/essences/_essence_node_view.html.erb +1 -0
- data/app/views/alchemy/essences/_essence_page_editor.html.erb +14 -11
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +22 -20
- data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +10 -7
- data/app/views/alchemy/essences/_essence_select_editor.html.erb +12 -16
- data/app/views/alchemy/essences/_essence_text_editor.html.erb +18 -17
- data/app/views/alchemy/essences/shared/_essence_picture_tools.html.erb +6 -11
- data/app/views/alchemy/pages/show.rss.builder +3 -2
- data/app/views/layouts/alchemy/admin.html.erb +1 -0
- data/babel.config.js +12 -0
- data/bin/rails +5 -4
- data/config/alchemy/config.yml +15 -18
- data/config/brakeman.ignore +1 -1
- data/config/initializers/assets.rb +2 -1
- data/config/initializers/dragonfly.rb +2 -1
- data/config/initializers/mime_types.rb +1 -0
- data/config/initializers/mini_profiler.rb +3 -2
- data/config/initializers/simple_form.rb +6 -6
- data/config/locales/alchemy.en.yml +23 -8
- data/config/routes.rb +25 -24
- data/config/spring.rb +3 -2
- data/db/migrate/20200226213334_alchemy_four_point_four.rb +313 -0
- data/db/migrate/20200423073425_create_alchemy_essence_nodes.rb +11 -0
- data/db/migrate/20200504210159_remove_site_id_from_nodes.rb +28 -0
- data/db/migrate/20200505215518_add_language_id_foreign_key_to_alchemy_pages.rb +8 -0
- data/db/migrate/20200511113603_add_menu_type_to_alchemy_nodes.rb +27 -0
- data/db/migrate/20200514091507_make_page_layoutpage_null_false.rb +6 -0
- data/db/migrate/20200519073500_remove_visible_from_alchemy_pages.rb +24 -0
- data/lib/alchemy/admin/locale.rb +3 -1
- data/lib/alchemy/admin/preview_url.rb +64 -0
- data/lib/alchemy/auth_accessors.rb +8 -7
- data/lib/alchemy/cache_digests/template_tracker.rb +5 -4
- data/lib/alchemy/config.rb +1 -5
- data/lib/alchemy/configuration_methods.rb +3 -1
- data/lib/alchemy/controller_actions.rb +6 -5
- data/lib/alchemy/deprecation.rb +2 -1
- data/lib/alchemy/elements_finder.rb +5 -5
- data/lib/alchemy/engine.rb +23 -8
- data/lib/alchemy/errors.rb +0 -7
- data/lib/alchemy/essence.rb +17 -16
- data/lib/alchemy/filetypes.rb +5 -5
- data/lib/alchemy/forms/builder.rb +4 -4
- data/lib/alchemy/hints.rb +1 -1
- data/lib/alchemy/i18n.rb +2 -1
- data/lib/alchemy/modules.rb +12 -12
- data/lib/alchemy/name_conversions.rb +5 -5
- data/lib/alchemy/on_page_layout/callbacks_runner.rb +1 -0
- data/lib/alchemy/page_layout.rb +15 -12
- data/lib/alchemy/paths.rb +1 -1
- data/lib/alchemy/permissions.rb +7 -6
- data/lib/alchemy/resource.rb +25 -17
- data/lib/alchemy/resources_helper.rb +12 -18
- data/lib/alchemy/routing_constraints.rb +1 -1
- data/lib/alchemy/seeder.rb +42 -14
- data/lib/alchemy/shell.rb +13 -10
- data/lib/alchemy/taggable.rb +1 -0
- data/lib/alchemy/tasks/tidy.rb +4 -3
- data/lib/alchemy/test_support/config_stubbing.rb +1 -0
- data/lib/alchemy/test_support/essence_shared_examples.rb +72 -72
- data/lib/alchemy/test_support/factories/attachment_factory.rb +5 -5
- data/lib/alchemy/test_support/factories/content_factory.rb +6 -6
- data/lib/alchemy/test_support/factories/dummy_user_factory.rb +7 -7
- data/lib/alchemy/test_support/factories/element_factory.rb +9 -9
- data/lib/alchemy/test_support/factories/essence_file_factory.rb +3 -3
- data/lib/alchemy/test_support/factories/essence_page_factory.rb +3 -3
- data/lib/alchemy/test_support/factories/essence_picture_factory.rb +4 -4
- data/lib/alchemy/test_support/factories/essence_text_factory.rb +3 -3
- data/lib/alchemy/test_support/factories/language_factory.rb +16 -14
- data/lib/alchemy/test_support/factories/node_factory.rb +8 -8
- data/lib/alchemy/test_support/factories/page_factory.rb +15 -27
- data/lib/alchemy/test_support/factories/picture_factory.rb +5 -5
- data/lib/alchemy/test_support/factories/site_factory.rb +7 -6
- data/lib/alchemy/test_support/factories.rb +1 -1
- data/lib/alchemy/test_support/integration_helpers.rb +1 -0
- data/lib/alchemy/test_support/shared_contexts.rb +5 -4
- data/lib/alchemy/test_support/shared_uploader_examples.rb +4 -3
- data/lib/alchemy/tinymce.rb +15 -13
- data/lib/alchemy/upgrader/five_point_zero.rb +41 -0
- data/lib/alchemy/upgrader/tasks/element_views_updater.rb +4 -4
- data/lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb +29 -0
- data/lib/alchemy/upgrader.rb +8 -7
- data/lib/alchemy/userstamp.rb +1 -1
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +52 -50
- data/lib/{rails/generators → generators}/alchemy/base.rb +5 -4
- data/lib/{rails/generators → generators}/alchemy/elements/elements_generator.rb +13 -9
- data/lib/{rails/generators → generators}/alchemy/elements/templates/view.html.erb +0 -0
- data/lib/{rails/generators → generators}/alchemy/elements/templates/view.html.haml +0 -0
- data/lib/{rails/generators → generators}/alchemy/elements/templates/view.html.slim +0 -0
- data/lib/{rails/generators → generators}/alchemy/essence/essence_generator.rb +15 -13
- data/lib/generators/alchemy/essence/templates/editor.html.erb +17 -0
- data/lib/{rails/generators → generators}/alchemy/essence/templates/view.html.erb +0 -0
- data/lib/{rails/generators → generators}/alchemy/install/files/_article.html.erb +0 -0
- data/lib/{rails/generators → generators}/alchemy/install/files/_standard.html.erb +0 -0
- data/lib/{rails/generators → generators}/alchemy/install/files/alchemy.en.yml +0 -0
- data/lib/generators/alchemy/install/files/alchemy_admin.js +1 -0
- data/lib/{rails/generators → generators}/alchemy/install/files/all.css +0 -0
- data/lib/{rails/generators → generators}/alchemy/install/files/all.js +0 -0
- data/lib/{rails/generators → generators}/alchemy/install/files/application.html.erb +0 -0
- data/lib/{rails/generators → generators}/alchemy/install/files/article.scss +0 -0
- data/lib/generators/alchemy/install/install_generator.rb +110 -0
- data/lib/{rails/generators → generators}/alchemy/install/templates/dragonfly.rb.tt +0 -0
- data/lib/{rails/generators → generators}/alchemy/install/templates/elements.yml.tt +0 -0
- data/lib/{rails/generators → generators}/alchemy/install/templates/menus.yml.tt +0 -0
- data/lib/{rails/generators → generators}/alchemy/install/templates/page_layouts.yml.tt +0 -0
- data/lib/{rails/generators → generators}/alchemy/menus/menus_generator.rb +2 -2
- data/lib/{rails/generators → generators}/alchemy/menus/templates/node.html.erb +1 -4
- data/lib/{rails/generators → generators}/alchemy/menus/templates/node.html.haml +1 -4
- data/lib/{rails/generators → generators}/alchemy/menus/templates/node.html.slim +1 -4
- data/lib/{rails/generators → generators}/alchemy/menus/templates/wrapper.html.erb +1 -1
- data/lib/{rails/generators → generators}/alchemy/menus/templates/wrapper.html.haml +1 -1
- data/lib/{rails/generators → generators}/alchemy/menus/templates/wrapper.html.slim +1 -1
- data/lib/{rails/generators → generators}/alchemy/module/module_generator.rb +3 -2
- data/lib/{rails/generators → generators}/alchemy/module/templates/ability.rb.tt +0 -0
- data/lib/{rails/generators → generators}/alchemy/module/templates/controller.rb.tt +0 -0
- data/lib/{rails/generators → generators}/alchemy/module/templates/module_config.rb.tt +0 -0
- data/lib/{rails/generators → generators}/alchemy/page_layouts/page_layouts_generator.rb +5 -4
- data/lib/{rails/generators → generators}/alchemy/page_layouts/templates/layout.html.erb +0 -0
- data/lib/{rails/generators → generators}/alchemy/page_layouts/templates/layout.html.haml +0 -0
- data/lib/{rails/generators → generators}/alchemy/page_layouts/templates/layout.html.slim +0 -0
- data/lib/{rails/generators → generators}/alchemy/site_layouts/site_layouts_generator.rb +4 -2
- data/lib/{rails/generators → generators}/alchemy/site_layouts/templates/layout.html.erb +0 -0
- data/lib/{rails/generators → generators}/alchemy/site_layouts/templates/layout.html.haml +0 -0
- data/lib/{rails/generators → generators}/alchemy/site_layouts/templates/layout.html.slim +0 -0
- data/lib/{rails/generators → generators}/alchemy/views/views_generator.rb +7 -6
- data/lib/kaminari/scoped_pagination_url_helper.rb +1 -0
- data/lib/tasks/alchemy/db.rake +3 -19
- data/lib/tasks/alchemy/install.rake +3 -2
- data/lib/tasks/alchemy/tidy.rake +9 -8
- data/lib/tasks/alchemy/upgrade.rake +18 -120
- data/package/admin.js +14 -0
- data/package/src/__tests__/i18n.spec.js +70 -0
- data/package/src/i18n.js +48 -0
- data/package/src/node_tree.js +72 -0
- data/package/src/translations.js +32 -0
- data/package/src/utils/__tests__/ajax.spec.js +124 -0
- data/package/src/utils/__tests__/events.spec.js +38 -0
- data/package/src/utils/ajax.js +48 -0
- data/package/src/utils/events.js +16 -0
- data/package.json +45 -0
- data/vendor/assets/fonts/fa-regular-400.eot +0 -0
- data/vendor/assets/fonts/fa-regular-400.svg +798 -358
- data/vendor/assets/fonts/fa-regular-400.ttf +0 -0
- data/vendor/assets/fonts/fa-regular-400.woff +0 -0
- data/vendor/assets/fonts/fa-regular-400.woff2 +0 -0
- data/vendor/assets/fonts/fa-solid-900.eot +0 -0
- data/vendor/assets/fonts/fa-solid-900.svg +4933 -1408
- data/vendor/assets/fonts/fa-solid-900.ttf +0 -0
- data/vendor/assets/fonts/fa-solid-900.woff +0 -0
- data/vendor/assets/fonts/fa-solid-900.woff2 +0 -0
- data/vendor/assets/javascripts/jquery_plugins/jquery.ui.nestedSortable.js +1 -2
- data/vendor/assets/stylesheets/fontawesome/_core.scss +5 -0
- data/vendor/assets/stylesheets/fontawesome/_fixed-width.scss +1 -1
- data/vendor/assets/stylesheets/fontawesome/_icons.scss +651 -2
- data/vendor/assets/stylesheets/fontawesome/_mixins.scss +0 -1
- data/vendor/assets/stylesheets/fontawesome/_rotated-flipped.scss +3 -2
- data/vendor/assets/stylesheets/fontawesome/_stacked.scss +1 -1
- data/vendor/assets/stylesheets/fontawesome/_variables.scss +662 -9
- data/vendor/assets/stylesheets/fontawesome/fontawesome.scss +2 -2
- data/vendor/assets/stylesheets/fontawesome/regular.scss +23 -0
- data/vendor/assets/stylesheets/fontawesome/solid.scss +24 -0
- metadata +117 -96
- data/app/assets/javascripts/alchemy/alchemy.i18n.js.coffee +0 -32
- data/app/assets/javascripts/alchemy/alchemy.node_tree.js +0 -66
- data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +0 -29
- data/app/assets/javascripts/alchemy/alchemy.utils.js +0 -45
- data/app/helpers/alchemy/essences_helper.rb +0 -119
- data/app/models/concerns/alchemy/content_touching.rb +0 -23
- data/app/serializers/alchemy/legacy_element_serializer.rb +0 -15
- data/app/views/alchemy/admin/contents/_missing.html.erb +0 -17
- data/app/views/alchemy/admin/pages/_menu_fields.html.erb +0 -37
- data/app/views/alchemy/admin/pages/configure_external.html.erb +0 -32
- data/app/views/alchemy/elements/_editor_not_found.html.erb +0 -4
- data/app/views/alchemy/navigation/_image_link.html.erb +0 -14
- data/app/views/alchemy/navigation/_link.html.erb +0 -19
- data/app/views/alchemy/navigation/_renderer.html.erb +0 -29
- data/db/migrate/20180226123013_alchemy_four_point_zero.rb +0 -363
- data/db/migrate/20180227224537_migrate_tags_to_gutentag.rb +0 -41
- data/db/migrate/20180519204655_add_fixed_to_alchemy_elements.rb +0 -6
- data/db/migrate/20191016073858_create_alchemy_essence_pages.rb +0 -8
- data/db/migrate/20191029212236_create_alchemy_nodes.rb +0 -24
- data/db/migrate/20200226081535_add_site_id_to_alchemy_nodes.rb +0 -15
- data/lib/alchemy/ssl_protection.rb +0 -34
- data/lib/alchemy/tasks/helpers.rb +0 -81
- data/lib/alchemy/test_support/controller_requests.rb +0 -93
- data/lib/alchemy/upgrader/four_point_four.rb +0 -52
- data/lib/alchemy/upgrader/four_point_one.rb +0 -42
- data/lib/alchemy/upgrader/four_point_six.rb +0 -50
- data/lib/alchemy/upgrader/four_point_two.rb +0 -86
- data/lib/alchemy/upgrader/tasks/cells_migration.rb +0 -44
- data/lib/alchemy/upgrader/tasks/cells_upgrader.rb +0 -166
- data/lib/alchemy/upgrader/tasks/element_partial_name_variable_updater.rb +0 -32
- data/lib/alchemy/upgrader/tasks/fixed_element_name_finder.rb +0 -31
- data/lib/alchemy/upgrader/tasks/harden_acts_as_taggable_on_migrations.rb +0 -27
- data/lib/alchemy/upgrader/tasks/picture_gallery_migration.rb +0 -65
- data/lib/alchemy/upgrader/tasks/picture_gallery_upgrader.rb +0 -210
- data/lib/rails/generators/alchemy/essence/templates/editor.html.erb +0 -15
- data/lib/rails/generators/alchemy/install/install_generator.rb +0 -60
- data/lib/tasks/alchemy/convert.rake +0 -98
- data/vendor/assets/javascripts/sortable/Sortable.min.js +0 -2
- data/vendor/assets/stylesheets/fontawesome/fa-regular.scss +0 -22
- data/vendor/assets/stylesheets/fontawesome/fa-solid.scss +0 -23
data/config/routes.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "alchemy/routing_constraints"
|
2
3
|
|
3
4
|
Alchemy::Engine.routes.draw do
|
4
|
-
root to:
|
5
|
+
root to: "pages#index"
|
5
6
|
|
6
|
-
get
|
7
|
+
get "/sitemap.xml" => "pages#sitemap", format: "xml"
|
7
8
|
|
8
9
|
scope Alchemy.admin_path, {constraints: Alchemy.admin_constraints} do
|
9
|
-
get
|
10
|
-
get
|
11
|
-
get
|
12
|
-
get
|
13
|
-
get
|
14
|
-
get
|
10
|
+
get "/" => redirect("#{Alchemy.admin_path}/dashboard"), as: :admin
|
11
|
+
get "/dashboard" => "admin/dashboard#index", as: :admin_dashboard
|
12
|
+
get "/dashboard/info" => "admin/dashboard#info", as: :dashboard_info
|
13
|
+
get "/help" => "admin/dashboard#help", as: :help
|
14
|
+
get "/dashboard/update_check" => "admin/dashboard#update_check", as: :update_check
|
15
|
+
get "/leave" => "admin/base#leave", as: :leave_admin
|
15
16
|
end
|
16
17
|
|
17
18
|
namespace :admin, {path: Alchemy.admin_path, constraints: Alchemy.admin_constraints} do
|
@@ -94,7 +95,7 @@ Alchemy::Engine.routes.draw do
|
|
94
95
|
end
|
95
96
|
end
|
96
97
|
|
97
|
-
resource :clipboard, only: :index, controller:
|
98
|
+
resource :clipboard, only: :index, controller: "clipboard" do
|
98
99
|
collection do
|
99
100
|
get :index
|
100
101
|
delete :clear
|
@@ -103,7 +104,7 @@ Alchemy::Engine.routes.draw do
|
|
103
104
|
end
|
104
105
|
end
|
105
106
|
|
106
|
-
resource :trash, only: :index, controller:
|
107
|
+
resource :trash, only: :index, controller: "trash" do
|
107
108
|
collection do
|
108
109
|
get :index
|
109
110
|
delete :clear
|
@@ -118,38 +119,38 @@ Alchemy::Engine.routes.draw do
|
|
118
119
|
|
119
120
|
resources :sites
|
120
121
|
|
121
|
-
get
|
122
|
+
get "/styleguide" => "styleguide#index"
|
122
123
|
end
|
123
124
|
|
124
|
-
get
|
125
|
+
get "/attachment/:id/download(/:name)" => "attachments#download",
|
125
126
|
as: :download_attachment
|
126
|
-
get
|
127
|
+
get "/attachment/:id/show" => "attachments#show",
|
127
128
|
as: :show_attachment
|
128
129
|
|
129
130
|
resources :messages, only: [:index, :new, :create]
|
130
131
|
resources :elements, only: :show
|
131
132
|
resources :contents, only: :show
|
132
133
|
|
133
|
-
namespace :api, defaults: {format:
|
134
|
+
namespace :api, defaults: {format: "json"} do
|
134
135
|
resources :contents, only: [:index, :show]
|
135
136
|
|
136
137
|
resources :elements, only: [:index, :show] do
|
137
|
-
get
|
138
|
-
get
|
138
|
+
get "/contents" => "contents#index", as: "contents"
|
139
|
+
get "/contents/:name" => "contents#show", as: "content"
|
139
140
|
end
|
140
141
|
|
141
142
|
resources :pages, only: [:index] do
|
142
|
-
get
|
143
|
-
get
|
143
|
+
get "elements" => "elements#index", as: "elements"
|
144
|
+
get "elements/:named" => "elements#index", as: "named_elements"
|
144
145
|
collection do
|
145
146
|
get :nested
|
146
147
|
end
|
147
148
|
end
|
148
149
|
|
149
|
-
get
|
150
|
-
get
|
150
|
+
get "/pages/*urlname(.:format)" => "pages#show", as: "page"
|
151
|
+
get "/admin/pages/:id(.:format)" => "pages#show", as: "preview_page"
|
151
152
|
|
152
|
-
resources :nodes, only: [] do
|
153
|
+
resources :nodes, only: [:index] do
|
153
154
|
member do
|
154
155
|
patch :move
|
155
156
|
patch :toggle_folded
|
@@ -157,13 +158,13 @@ Alchemy::Engine.routes.draw do
|
|
157
158
|
end
|
158
159
|
end
|
159
160
|
|
160
|
-
get
|
161
|
+
get "/:locale" => "pages#index",
|
161
162
|
constraints: {locale: Alchemy::RoutingConstraints::LOCALE_REGEXP},
|
162
163
|
as: :show_language_root
|
163
164
|
|
164
165
|
# The page show action has to be last route
|
165
166
|
constraints(locale: Alchemy::RoutingConstraints::LOCALE_REGEXP) do
|
166
|
-
get
|
167
|
+
get "(/:locale)/*urlname(.:format)" => "pages#show",
|
167
168
|
constraints: Alchemy::RoutingConstraints.new,
|
168
169
|
as: :show_page
|
169
170
|
end
|
data/config/spring.rb
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
Spring.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
Spring.application_root = "./spec/dummy"
|
3
|
+
Spring.watch "lib/**/*"
|
@@ -0,0 +1,313 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AlchemyFourPointFour < ActiveRecord::Migration[5.2]
|
4
|
+
def up
|
5
|
+
unless table_exists?("alchemy_attachments")
|
6
|
+
create_table "alchemy_attachments", force: :cascade do |t|
|
7
|
+
t.string "name"
|
8
|
+
t.string "file_name"
|
9
|
+
t.string "file_mime_type"
|
10
|
+
t.integer "file_size"
|
11
|
+
t.references "creator"
|
12
|
+
t.references "updater"
|
13
|
+
t.timestamps null: false
|
14
|
+
t.string "file_uid"
|
15
|
+
t.index ["file_uid"], name: "index_alchemy_attachments_on_file_uid"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
unless table_exists?("alchemy_contents")
|
20
|
+
create_table "alchemy_contents", force: :cascade do |t|
|
21
|
+
t.string "name"
|
22
|
+
t.references "essence", null: false, polymorphic: true, index: { unique: true }
|
23
|
+
t.references "element", null: false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
unless table_exists?("alchemy_elements")
|
28
|
+
create_table "alchemy_elements", force: :cascade do |t|
|
29
|
+
t.string "name"
|
30
|
+
t.integer "position"
|
31
|
+
t.references "page", null: false, index: false
|
32
|
+
t.boolean "public", default: true
|
33
|
+
t.boolean "folded", default: false
|
34
|
+
t.boolean "unique", default: false
|
35
|
+
t.timestamps null: false
|
36
|
+
t.references "creator"
|
37
|
+
t.references "updater"
|
38
|
+
t.references "parent_element", index: false
|
39
|
+
t.boolean "fixed", default: false, null: false
|
40
|
+
t.index ["fixed"], name: "index_alchemy_elements_on_fixed"
|
41
|
+
t.index ["page_id", "parent_element_id"], name: "index_alchemy_elements_on_page_id_and_parent_element_id"
|
42
|
+
t.index ["page_id", "position"], name: "index_elements_on_page_id_and_position"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
unless table_exists?("alchemy_elements_alchemy_pages")
|
47
|
+
create_table "alchemy_elements_alchemy_pages", id: false, force: :cascade do |t|
|
48
|
+
t.references "element"
|
49
|
+
t.references "page"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
unless table_exists?("alchemy_essence_booleans")
|
54
|
+
create_table "alchemy_essence_booleans", force: :cascade do |t|
|
55
|
+
t.boolean "value"
|
56
|
+
t.index ["value"], name: "index_alchemy_essence_booleans_on_value"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
unless table_exists?("alchemy_essence_dates")
|
61
|
+
create_table "alchemy_essence_dates", force: :cascade do |t|
|
62
|
+
t.datetime "date"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
unless table_exists?("alchemy_essence_files")
|
67
|
+
create_table "alchemy_essence_files", force: :cascade do |t|
|
68
|
+
t.references "attachment"
|
69
|
+
t.string "title"
|
70
|
+
t.string "css_class"
|
71
|
+
t.string "link_text"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
unless table_exists?("alchemy_essence_htmls")
|
76
|
+
create_table "alchemy_essence_htmls", force: :cascade do |t|
|
77
|
+
t.text "source"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
unless table_exists?("alchemy_essence_links")
|
82
|
+
create_table "alchemy_essence_links", force: :cascade do |t|
|
83
|
+
t.string "link"
|
84
|
+
t.string "link_title"
|
85
|
+
t.string "link_target"
|
86
|
+
t.string "link_class_name"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
unless table_exists?("alchemy_essence_pages")
|
91
|
+
create_table "alchemy_essence_pages", force: :cascade do |t|
|
92
|
+
t.references "page"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
unless table_exists?("alchemy_essence_pictures")
|
97
|
+
create_table "alchemy_essence_pictures", force: :cascade do |t|
|
98
|
+
t.references "picture"
|
99
|
+
t.string "caption"
|
100
|
+
t.string "title"
|
101
|
+
t.string "alt_tag"
|
102
|
+
t.string "link"
|
103
|
+
t.string "link_class_name"
|
104
|
+
t.string "link_title"
|
105
|
+
t.string "css_class"
|
106
|
+
t.string "link_target"
|
107
|
+
t.string "crop_from"
|
108
|
+
t.string "crop_size"
|
109
|
+
t.string "render_size"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
unless table_exists?("alchemy_essence_richtexts")
|
114
|
+
create_table "alchemy_essence_richtexts", force: :cascade do |t|
|
115
|
+
t.text "body"
|
116
|
+
t.text "stripped_body"
|
117
|
+
t.boolean "public"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
unless table_exists?("alchemy_essence_selects")
|
122
|
+
create_table "alchemy_essence_selects", force: :cascade do |t|
|
123
|
+
t.string "value"
|
124
|
+
t.index ["value"], name: "index_alchemy_essence_selects_on_value"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
unless table_exists?("alchemy_essence_texts")
|
129
|
+
create_table "alchemy_essence_texts", force: :cascade do |t|
|
130
|
+
t.text "body"
|
131
|
+
t.string "link"
|
132
|
+
t.string "link_title"
|
133
|
+
t.string "link_class_name"
|
134
|
+
t.boolean "public", default: false
|
135
|
+
t.string "link_target"
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
unless table_exists?("alchemy_folded_pages")
|
140
|
+
create_table "alchemy_folded_pages", force: :cascade do |t|
|
141
|
+
t.references "page", null: false, index: false
|
142
|
+
t.references "user", null: false, index: false
|
143
|
+
t.boolean "folded", default: false
|
144
|
+
t.index ["page_id", "user_id"], name: "index_alchemy_folded_pages_on_page_id_and_user_id", unique: true
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
unless table_exists?("alchemy_languages")
|
149
|
+
create_table "alchemy_languages", force: :cascade do |t|
|
150
|
+
t.string "name"
|
151
|
+
t.string "language_code"
|
152
|
+
t.string "frontpage_name"
|
153
|
+
t.string "page_layout", default: "intro"
|
154
|
+
t.boolean "public", default: false
|
155
|
+
t.timestamps null: false
|
156
|
+
t.references "creator"
|
157
|
+
t.references "updater"
|
158
|
+
t.boolean "default", default: false
|
159
|
+
t.string "country_code", default: "", null: false
|
160
|
+
t.references "site", null: false
|
161
|
+
t.string "locale"
|
162
|
+
t.index ["language_code", "country_code"], name: "index_alchemy_languages_on_language_code_and_country_code"
|
163
|
+
t.index ["language_code"], name: "index_alchemy_languages_on_language_code"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
unless table_exists?("alchemy_legacy_page_urls")
|
168
|
+
create_table "alchemy_legacy_page_urls", force: :cascade do |t|
|
169
|
+
t.string "urlname", null: false
|
170
|
+
t.references "page", null: false
|
171
|
+
t.timestamps null: false
|
172
|
+
t.index ["urlname"], name: "index_alchemy_legacy_page_urls_on_urlname"
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
unless table_exists?("alchemy_nodes")
|
177
|
+
create_table "alchemy_nodes", force: :cascade do |t|
|
178
|
+
t.string "name"
|
179
|
+
t.string "title"
|
180
|
+
t.string "url"
|
181
|
+
t.boolean "nofollow", default: false, null: false
|
182
|
+
t.boolean "external", default: false, null: false
|
183
|
+
t.boolean "folded", default: false, null: false
|
184
|
+
t.references "parent"
|
185
|
+
t.integer "lft", null: false
|
186
|
+
t.integer "rgt", null: false
|
187
|
+
t.integer "depth", default: 0, null: false
|
188
|
+
t.references "page"
|
189
|
+
t.references "language", null: false
|
190
|
+
t.references "creator"
|
191
|
+
t.references "updater"
|
192
|
+
t.timestamps null: false
|
193
|
+
t.references "site", null: false
|
194
|
+
t.index ["lft"], name: "index_alchemy_nodes_on_lft"
|
195
|
+
t.index ["rgt"], name: "index_alchemy_nodes_on_rgt"
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
unless table_exists?("alchemy_pages")
|
200
|
+
create_table "alchemy_pages", force: :cascade do |t|
|
201
|
+
t.string "name"
|
202
|
+
t.string "urlname"
|
203
|
+
t.string "title"
|
204
|
+
t.string "language_code"
|
205
|
+
t.boolean "language_root"
|
206
|
+
t.string "page_layout"
|
207
|
+
t.text "meta_keywords"
|
208
|
+
t.text "meta_description"
|
209
|
+
t.integer "lft"
|
210
|
+
t.integer "rgt"
|
211
|
+
t.references "parent", index: false
|
212
|
+
t.integer "depth"
|
213
|
+
t.boolean "visible", default: false
|
214
|
+
t.integer "locked_by"
|
215
|
+
t.boolean "restricted", default: false
|
216
|
+
t.boolean "robot_index", default: true
|
217
|
+
t.boolean "robot_follow", default: true
|
218
|
+
t.boolean "sitemap", default: true
|
219
|
+
t.boolean "layoutpage", default: false
|
220
|
+
t.timestamps null: false
|
221
|
+
t.references "creator"
|
222
|
+
t.references "updater"
|
223
|
+
t.references "language"
|
224
|
+
t.datetime "published_at"
|
225
|
+
t.datetime "public_on"
|
226
|
+
t.datetime "public_until"
|
227
|
+
t.datetime "locked_at"
|
228
|
+
t.index ["locked_at", "locked_by"], name: "index_alchemy_pages_on_locked_at_and_locked_by"
|
229
|
+
t.index ["parent_id", "lft"], name: "index_pages_on_parent_id_and_lft"
|
230
|
+
t.index ["public_on", "public_until"], name: "index_alchemy_pages_on_public_on_and_public_until"
|
231
|
+
t.index ["rgt"], name: "index_alchemy_pages_on_rgt"
|
232
|
+
t.index ["urlname"], name: "index_pages_on_urlname"
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
unless table_exists?("alchemy_pictures")
|
237
|
+
create_table "alchemy_pictures", force: :cascade do |t|
|
238
|
+
t.string "name"
|
239
|
+
t.string "image_file_name"
|
240
|
+
t.integer "image_file_width"
|
241
|
+
t.integer "image_file_height"
|
242
|
+
t.timestamps null: false
|
243
|
+
t.references "creator"
|
244
|
+
t.references "updater"
|
245
|
+
t.string "upload_hash"
|
246
|
+
t.string "image_file_uid"
|
247
|
+
t.integer "image_file_size"
|
248
|
+
t.string "image_file_format"
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
unless table_exists?("alchemy_sites")
|
253
|
+
create_table "alchemy_sites", force: :cascade do |t|
|
254
|
+
t.string "host"
|
255
|
+
t.string "name"
|
256
|
+
t.timestamps null: false
|
257
|
+
t.boolean "public", default: false
|
258
|
+
t.text "aliases"
|
259
|
+
t.boolean "redirect_to_primary_host"
|
260
|
+
t.index ["host", "public"], name: "alchemy_sites_public_hosts_idx"
|
261
|
+
t.index ["host"], name: "index_alchemy_sites_on_host"
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
unless foreign_key_exists?("alchemy_contents", column: "element_id")
|
266
|
+
add_foreign_key "alchemy_contents", "alchemy_elements", column: "element_id", on_update: :cascade, on_delete: :cascade
|
267
|
+
end
|
268
|
+
|
269
|
+
unless foreign_key_exists?("alchemy_elements", column: "page_id")
|
270
|
+
add_foreign_key "alchemy_elements", "alchemy_pages", column: "page_id", on_update: :cascade, on_delete: :cascade
|
271
|
+
end
|
272
|
+
|
273
|
+
unless foreign_key_exists?("alchemy_essence_pages", column: "page_id")
|
274
|
+
add_foreign_key "alchemy_essence_pages", "alchemy_pages", column: "page_id"
|
275
|
+
end
|
276
|
+
|
277
|
+
unless foreign_key_exists?("alchemy_nodes", column: "language_id")
|
278
|
+
add_foreign_key "alchemy_nodes", "alchemy_languages", column: "language_id"
|
279
|
+
end
|
280
|
+
|
281
|
+
unless foreign_key_exists?("alchemy_nodes", column: "page_id")
|
282
|
+
add_foreign_key "alchemy_nodes", "alchemy_pages", column: "page_id", on_delete: :cascade
|
283
|
+
end
|
284
|
+
|
285
|
+
unless foreign_key_exists?("alchemy_nodes", column: "site_id")
|
286
|
+
add_foreign_key "alchemy_nodes", "alchemy_sites", column: "site_id", on_delete: :cascade
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
def down
|
291
|
+
drop_table "alchemy_attachments" if table_exists?("alchemy_attachments")
|
292
|
+
drop_table "alchemy_contents" if table_exists?("alchemy_contents")
|
293
|
+
drop_table "alchemy_elements" if table_exists?("alchemy_elements")
|
294
|
+
drop_table "alchemy_elements_alchemy_pages" if table_exists?("alchemy_elements_alchemy_pages")
|
295
|
+
drop_table "alchemy_essence_booleans" if table_exists?("alchemy_essence_booleans")
|
296
|
+
drop_table "alchemy_essence_dates" if table_exists?("alchemy_essence_dates")
|
297
|
+
drop_table "alchemy_essence_files" if table_exists?("alchemy_essence_files")
|
298
|
+
drop_table "alchemy_essence_htmls" if table_exists?("alchemy_essence_htmls")
|
299
|
+
drop_table "alchemy_essence_links" if table_exists?("alchemy_essence_links")
|
300
|
+
drop_table "alchemy_essence_pages" if table_exists?("alchemy_essence_pages")
|
301
|
+
drop_table "alchemy_essence_pictures" if table_exists?("alchemy_essence_pictures")
|
302
|
+
drop_table "alchemy_essence_richtexts" if table_exists?("alchemy_essence_richtexts")
|
303
|
+
drop_table "alchemy_essence_selects" if table_exists?("alchemy_essence_selects")
|
304
|
+
drop_table "alchemy_essence_texts" if table_exists?("alchemy_essence_texts")
|
305
|
+
drop_table "alchemy_folded_pages" if table_exists?("alchemy_folded_pages")
|
306
|
+
drop_table "alchemy_languages" if table_exists?("alchemy_languages")
|
307
|
+
drop_table "alchemy_legacy_page_urls" if table_exists?("alchemy_legacy_page_urls")
|
308
|
+
drop_table "alchemy_nodes" if table_exists?("alchemy_nodes")
|
309
|
+
drop_table "alchemy_pages" if table_exists?("alchemy_pages")
|
310
|
+
drop_table "alchemy_pictures" if table_exists?("alchemy_pictures")
|
311
|
+
drop_table "alchemy_sites" if table_exists?("alchemy_sites")
|
312
|
+
end
|
313
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateAlchemyEssenceNodes < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :alchemy_essence_nodes do |t|
|
6
|
+
t.references "node"
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_foreign_key "alchemy_essence_nodes", "alchemy_nodes", column: "node_id"
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
class RemoveSiteIdFromNodes < ActiveRecord::Migration[5.2]
|
3
|
+
def up
|
4
|
+
remove_foreign_key :alchemy_nodes, :alchemy_sites
|
5
|
+
remove_index :alchemy_nodes, :site_id
|
6
|
+
remove_column :alchemy_nodes, :site_id, :integer, null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
add_column :alchemy_nodes, :site_id, :integer, null: true
|
11
|
+
sql = <<~SQL
|
12
|
+
UPDATE alchemy_nodes
|
13
|
+
SET site_id = (
|
14
|
+
SELECT alchemy_languages.site_id FROM alchemy_languages WHERE alchemy_nodes.language_id = alchemy_languages.id
|
15
|
+
) WHERE
|
16
|
+
EXISTS (
|
17
|
+
SELECT *
|
18
|
+
FROM alchemy_languages
|
19
|
+
WHERE alchemy_languages.id = alchemy_nodes.language_id
|
20
|
+
);
|
21
|
+
SQL
|
22
|
+
|
23
|
+
connection.execute(sql)
|
24
|
+
change_column :alchemy_nodes, :site_id, :integer, null: false
|
25
|
+
add_index :alchemy_nodes, :site_id
|
26
|
+
add_foreign_key :alchemy_nodes, :alchemy_sites, column: :site_id
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddLanguageIdForeignKeyToAlchemyPages < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
add_foreign_key :alchemy_pages, :alchemy_languages, column: :language_id
|
6
|
+
change_column_null :alchemy_pages, :language_id, false, Alchemy::Language.default&.id
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
class AddMenuTypeToAlchemyNodes < ActiveRecord::Migration[5.2]
|
3
|
+
class LocalNode < ActiveRecord::Base
|
4
|
+
self.table_name = :alchemy_nodes
|
5
|
+
acts_as_nested_set scope: :language_id
|
6
|
+
|
7
|
+
def self.root_for(node)
|
8
|
+
return node if node.parent_id.nil?
|
9
|
+
|
10
|
+
root_for(node.parent)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def up
|
15
|
+
add_column :alchemy_nodes, :menu_type, :string
|
16
|
+
LocalNode.all.each do |node|
|
17
|
+
root = LocalNode.root_for(node)
|
18
|
+
menu_type = root.name.parameterize.underscore
|
19
|
+
node.update(menu_type: menu_type)
|
20
|
+
end
|
21
|
+
change_column_null :alchemy_nodes, :menu_type, false
|
22
|
+
end
|
23
|
+
|
24
|
+
def down
|
25
|
+
remove_column :alchemy_nodes, :menu_type
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
class RemoveVisibleFromAlchemyPages < ActiveRecord::Migration[5.2]
|
3
|
+
class LocalPage < ActiveRecord::Base
|
4
|
+
self.table_name = "alchemy_pages"
|
5
|
+
|
6
|
+
scope :invisible, -> { where(visible: [false, nil]) }
|
7
|
+
scope :contentpages, -> { where(layoutpage: [false, nil]) }
|
8
|
+
end
|
9
|
+
|
10
|
+
def up
|
11
|
+
if LocalPage.invisible.contentpages.where.not(parent_id: nil).any?
|
12
|
+
abort "You have invisible pages in your database! " \
|
13
|
+
"Please re-structure your page tree before running this migration. " \
|
14
|
+
"You might also downgrade to Alchemy 4.6 and " \
|
15
|
+
"run the `alchemy:upgrade:4.6:restructure_page_tree` rake task."
|
16
|
+
end
|
17
|
+
|
18
|
+
remove_column :alchemy_pages, :visible
|
19
|
+
end
|
20
|
+
|
21
|
+
def down
|
22
|
+
add_column :alchemy_pages, :visible, :boolean, default: false
|
23
|
+
end
|
24
|
+
end
|
data/lib/alchemy/admin/locale.rb
CHANGED
@@ -47,6 +47,7 @@ module Alchemy
|
|
47
47
|
# Try to get the locale from user settings.
|
48
48
|
def locale_from_user
|
49
49
|
return if !current_alchemy_user
|
50
|
+
|
50
51
|
if user_has_preferred_language?
|
51
52
|
current_alchemy_user.language
|
52
53
|
end
|
@@ -55,6 +56,7 @@ module Alchemy
|
|
55
56
|
# Checks if the +current_alchemy_user+ has a preferred language set or not.
|
56
57
|
def user_has_preferred_language?
|
57
58
|
return if !current_alchemy_user
|
59
|
+
|
58
60
|
current_alchemy_user.respond_to?(:language) &&
|
59
61
|
current_alchemy_user.language.present? &&
|
60
62
|
current_alchemy_user.language.respond_to?(:to_sym)
|
@@ -62,7 +64,7 @@ module Alchemy
|
|
62
64
|
|
63
65
|
# Try to get the locale from browser headers.
|
64
66
|
def locale_from_browser
|
65
|
-
request.env[
|
67
|
+
request.env["HTTP_ACCEPT_LANGUAGE"].try(:scan, /\A[a-z]{2}/).try(:first)
|
66
68
|
end
|
67
69
|
end
|
68
70
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "uri"
|
4
|
+
|
5
|
+
module Alchemy
|
6
|
+
module Admin
|
7
|
+
# = Preview window URL configuration
|
8
|
+
#
|
9
|
+
# By default Alchemy uses its internal page preview renderer,
|
10
|
+
# but you can configure it to be any URL instead.
|
11
|
+
#
|
12
|
+
# Basic Auth is supported.
|
13
|
+
#
|
14
|
+
# == Example config/alchemy/config.yml
|
15
|
+
#
|
16
|
+
# preview:
|
17
|
+
# host: https://www.my-static-site.com
|
18
|
+
# auth:
|
19
|
+
# username: <%= ENV["BASIC_AUTH_USERNAME"] %>
|
20
|
+
# password: <%= ENV["BASIC_AUTH_PASSWORD"] %>
|
21
|
+
#
|
22
|
+
class PreviewUrl
|
23
|
+
class MissingProtocolError < StandardError; end
|
24
|
+
|
25
|
+
def initialize(routes:)
|
26
|
+
@routes = routes.url_helpers
|
27
|
+
@preview_config = Alchemy::Config.get(:preview)
|
28
|
+
end
|
29
|
+
|
30
|
+
def url_for(page)
|
31
|
+
if preview_config
|
32
|
+
uri_class.build(
|
33
|
+
host: uri.host,
|
34
|
+
path: "/#{page.urlname}",
|
35
|
+
userinfo: userinfo,
|
36
|
+
).to_s
|
37
|
+
else
|
38
|
+
routes.admin_page_path(page)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
attr_reader :preview_config, :routes
|
45
|
+
|
46
|
+
def uri
|
47
|
+
URI(preview_config["host"])
|
48
|
+
end
|
49
|
+
|
50
|
+
def uri_class
|
51
|
+
if uri.class == URI::Generic
|
52
|
+
raise MissingProtocolError, "Please provide the protocol with preview['host']"
|
53
|
+
else
|
54
|
+
uri.class
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def userinfo
|
59
|
+
auth = preview_config["auth"]
|
60
|
+
auth ? "#{auth["username"]}:#{auth["password"]}" : nil
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -53,13 +53,13 @@ module Alchemy
|
|
53
53
|
|
54
54
|
# Defaults
|
55
55
|
#
|
56
|
-
@@user_class_name =
|
56
|
+
@@user_class_name = "User"
|
57
57
|
@@user_class_primary_key = :id
|
58
|
-
@@current_user_method =
|
59
|
-
@@signup_path =
|
60
|
-
@@login_path =
|
61
|
-
@@logout_path =
|
62
|
-
@@logout_method =
|
58
|
+
@@current_user_method = "current_user"
|
59
|
+
@@signup_path = "/signup"
|
60
|
+
@@login_path = "/login"
|
61
|
+
@@logout_path = "/logout"
|
62
|
+
@@logout_method = "delete"
|
63
63
|
|
64
64
|
# Returns the user class
|
65
65
|
#
|
@@ -76,8 +76,9 @@ module Alchemy
|
|
76
76
|
# Prefix with :: when getting to avoid constant name conflicts
|
77
77
|
def self.user_class_name
|
78
78
|
if !@@user_class_name.is_a?(String)
|
79
|
-
raise TypeError,
|
79
|
+
raise TypeError, "Alchemy.user_class_name must be a String, not a Class."
|
80
80
|
end
|
81
|
+
|
81
82
|
"::#{@@user_class_name}"
|
82
83
|
end
|
83
84
|
|