maglevcms 2.0.0 → 3.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +53 -13
- data/Rakefile +0 -4
- data/app/assets/builds/maglev/tailwind.css +14393 -0
- data/app/assets/config/maglev_manifest.js +7 -0
- data/app/assets/javascripts/maglev/client/dom-operations.js +282 -0
- data/app/{frontend/live-preview-client → assets/javascripts/maglev/client}/iframe-decorator.js +81 -15
- data/app/{frontend/live-preview-client/message.js → assets/javascripts/maglev/client/incoming-messages.js} +14 -12
- data/app/assets/javascripts/maglev/client/index.js +26 -0
- data/app/{frontend/live-preview-client → assets/javascripts/maglev/client}/utils.js +4 -0
- data/app/assets/javascripts/maglev/editor/controllers/app/forms/section_form_controller.js +46 -0
- data/app/assets/javascripts/maglev/editor/controllers/app/forms/style_form_controller.js +19 -0
- data/app/assets/javascripts/maglev/editor/controllers/app/index.js +15 -0
- data/app/assets/javascripts/maglev/editor/controllers/app/page_preview_controller.js +163 -0
- data/app/assets/javascripts/maglev/editor/controllers/app/preview_notification_center_controller.js +151 -0
- data/app/assets/javascripts/maglev/editor/controllers/app/setting_controller.js +42 -0
- data/app/assets/javascripts/maglev/editor/controllers/application.js +9 -0
- data/app/assets/javascripts/maglev/editor/controllers/index.js +3 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/auto_save_controller.js +16 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/broken_image_controller.js +16 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/copy_to_clipboard_controller.js +36 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/disappearance_controller.js +21 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/dispatcher_controller.js +12 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/form_refresh_controller.js +15 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/index.js +27 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/max_length_controller.js +30 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/prevent_same_path.js +20 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/reload_page_controller.js +7 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/sortable_controller.js +64 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/submit_button_controller.js +45 -0
- data/app/assets/javascripts/maglev/editor/controllers/shared/transition_controller.js +14 -0
- data/app/assets/javascripts/maglev/editor/controllers/uikit.js +39 -0
- data/app/assets/javascripts/maglev/editor/controllers/utils.js +10 -0
- data/app/assets/javascripts/maglev/editor/index.js +66 -0
- data/app/assets/stylesheets/maglev/application.css +88 -0
- data/app/{frontend/editor/design/components/rich-text-editor.scss → assets/stylesheets/maglev/tailwind.css.erb} +30 -15
- data/app/components/maglev/editor/setting_registry.rb +59 -0
- data/app/components/maglev/editor/settings/base_component.rb +55 -0
- data/app/components/maglev/editor/settings/checkbox/checkbox_component.html.erb +16 -0
- data/app/components/maglev/editor/settings/checkbox/checkbox_component.rb +12 -0
- data/app/components/maglev/editor/settings/collection_item/collection_item_component.html.erb +25 -0
- data/app/components/maglev/editor/settings/collection_item/collection_item_component.rb +19 -0
- data/app/components/maglev/editor/settings/color/color_component.html.erb +17 -0
- data/app/components/maglev/editor/settings/color/color_component.rb +12 -0
- data/app/components/maglev/editor/settings/divider/divider_component.html.erb +12 -0
- data/app/components/maglev/editor/settings/divider/divider_component.rb +15 -0
- data/app/components/maglev/editor/settings/hint/hint_component.html.erb +3 -0
- data/app/components/maglev/editor/settings/hint/hint_component.rb +12 -0
- data/app/components/maglev/editor/settings/icon/icon_component.html.erb +21 -0
- data/app/components/maglev/editor/settings/icon/icon_component.rb +15 -0
- data/app/components/maglev/editor/settings/image/image_component.html.erb +26 -0
- data/app/components/maglev/editor/settings/image/image_component.rb +23 -0
- data/app/components/maglev/editor/settings/link/link_component.html.erb +22 -0
- data/app/components/maglev/editor/settings/link/link_component.rb +19 -0
- data/app/components/maglev/editor/settings/select/select_component.html.erb +20 -0
- data/app/components/maglev/editor/settings/select/select_component.rb +27 -0
- data/app/components/maglev/editor/settings/text/richtext_component.html.erb +22 -0
- data/app/components/maglev/editor/settings/text/richtext_component.rb +12 -0
- data/app/components/maglev/editor/settings/text/text_component.html.erb +18 -0
- data/app/components/maglev/editor/settings/text/text_component.rb +12 -0
- data/app/components/maglev/editor/settings/text/textarea_component.html.erb +21 -0
- data/app/components/maglev/editor/settings/text/textarea_component.rb +12 -0
- data/app/components/maglev/editor/settings_group_component.html.erb +5 -0
- data/app/components/maglev/editor/settings_group_component.rb +30 -0
- data/app/components/maglev/section_component.rb +10 -7
- data/app/components/maglev/uikit/app_layout/layout_component.html.erb +15 -0
- data/app/components/maglev/uikit/app_layout/layout_component.rb +19 -0
- data/app/components/maglev/uikit/app_layout/sidebar/link_component.html.erb +5 -0
- data/app/components/maglev/uikit/app_layout/sidebar/link_component.rb +40 -0
- data/app/components/maglev/uikit/app_layout/sidebar_component.html.erb +19 -0
- data/app/components/maglev/uikit/app_layout/sidebar_component.rb +11 -0
- data/app/components/maglev/uikit/app_layout/topbar/logo_component.html.erb +3 -0
- data/app/components/maglev/uikit/app_layout/topbar/logo_component.rb +18 -0
- data/app/components/maglev/uikit/app_layout/topbar/page_info_component.html.erb +26 -0
- data/app/components/maglev/uikit/app_layout/topbar/page_info_component.rb +28 -0
- data/app/components/maglev/uikit/app_layout/topbar_component.html.erb +15 -0
- data/app/components/maglev/uikit/app_layout/topbar_component.rb +21 -0
- data/app/components/maglev/uikit/badge_component.rb +40 -0
- data/app/components/maglev/uikit/base_component.rb +15 -0
- data/app/components/maglev/uikit/breadcrumbs/breadcrumbs_component.html.erb +10 -0
- data/app/components/maglev/uikit/breadcrumbs/breadcrumbs_component.rb +11 -0
- data/app/components/maglev/uikit/breadcrumbs/link_component.html.erb +12 -0
- data/app/components/maglev/uikit/breadcrumbs/link_component.rb +25 -0
- data/app/components/maglev/uikit/collapsible/collapsible_component.html.erb +5 -0
- data/app/components/maglev/uikit/collapsible/collapsible_component.rb +11 -0
- data/app/components/maglev/uikit/collapsible/collapsible_controller.js +9 -0
- data/app/components/maglev/uikit/collapsible/item_component.html.erb +17 -0
- data/app/components/maglev/uikit/collapsible/item_component.rb +11 -0
- data/app/components/maglev/uikit/device_toggler_component/device_toggler_component.html.erb +16 -0
- data/app/components/maglev/uikit/device_toggler_component/device_toggler_controller.js +25 -0
- data/app/components/maglev/uikit/device_toggler_component.rb +28 -0
- data/app/components/maglev/uikit/dropdown_component/dropdown_component.html.erb +18 -0
- data/app/components/maglev/uikit/dropdown_component/dropdown_controller.js +69 -0
- data/app/components/maglev/uikit/dropdown_component.rb +15 -0
- data/app/components/maglev/uikit/form/checkbox_component.html.erb +17 -0
- data/app/components/maglev/uikit/form/checkbox_component.rb +26 -0
- data/app/components/maglev/uikit/form/checkbox_controller.js +7 -0
- data/app/components/maglev/uikit/form/color_field_component.html.erb +76 -0
- data/app/components/maglev/uikit/form/color_field_component.rb +57 -0
- data/app/components/maglev/uikit/form/color_field_controller.js +25 -0
- data/app/components/maglev/uikit/form/combobox/list_component.html.erb +14 -0
- data/app/components/maglev/uikit/form/combobox/list_component.rb +13 -0
- data/app/components/maglev/uikit/form/combobox/option_component.html.erb +16 -0
- data/app/components/maglev/uikit/form/combobox/option_component.rb +22 -0
- data/app/components/maglev/uikit/form/combobox_component.html.erb +75 -0
- data/app/components/maglev/uikit/form/combobox_component.rb +64 -0
- data/app/components/maglev/uikit/form/combobox_controller.js +385 -0
- data/app/components/maglev/uikit/form/icon_field_component.html.erb +76 -0
- data/app/components/maglev/uikit/form/icon_field_component.rb +35 -0
- data/app/components/maglev/uikit/form/icon_field_controller.js +38 -0
- data/app/components/maglev/uikit/form/image_field_component.html.erb +101 -0
- data/app/components/maglev/uikit/form/image_field_component.rb +52 -0
- data/app/components/maglev/uikit/form/image_field_controller.js +74 -0
- data/app/components/maglev/uikit/form/link/base_component.rb +19 -0
- data/app/components/maglev/uikit/form/link/email_link_component.html.erb +16 -0
- data/app/components/maglev/uikit/form/link/email_link_component.rb +12 -0
- data/app/components/maglev/uikit/form/link/page_link_component.html.erb +17 -0
- data/app/components/maglev/uikit/form/link/page_link_component.rb +12 -0
- data/app/components/maglev/uikit/form/link/static_page_link_component.html.erb +16 -0
- data/app/components/maglev/uikit/form/link/static_page_link_component.rb +12 -0
- data/app/components/maglev/uikit/form/link/url_link_component.html.erb +16 -0
- data/app/components/maglev/uikit/form/link/url_link_component.rb +19 -0
- data/app/components/maglev/uikit/form/link_component.html.erb +55 -0
- data/app/components/maglev/uikit/form/link_component.rb +80 -0
- data/app/components/maglev/uikit/form/link_controller.js +36 -0
- data/app/components/maglev/uikit/form/richtext/block_button_component.html.erb +38 -0
- data/app/components/maglev/uikit/form/richtext/block_button_component.rb +22 -0
- data/app/components/maglev/uikit/form/richtext/button_component.html.erb +16 -0
- data/app/components/maglev/uikit/form/richtext/button_component.rb +19 -0
- data/app/components/maglev/uikit/form/richtext/button_group_component.html.erb +7 -0
- data/app/components/maglev/uikit/form/richtext/button_group_component.rb +13 -0
- data/app/components/maglev/uikit/form/richtext/toolbar_component.html.erb +23 -0
- data/app/components/maglev/uikit/form/richtext/toolbar_component.rb +19 -0
- data/app/components/maglev/uikit/form/richtext_component.html.erb +28 -0
- data/app/components/maglev/uikit/form/richtext_component.rb +54 -0
- data/app/components/maglev/uikit/form/richtext_controller.js +248 -0
- data/app/components/maglev/uikit/form/search_form_component.html.erb +24 -0
- data/app/components/maglev/uikit/form/search_form_component.rb +42 -0
- data/app/components/maglev/uikit/form/search_form_controller.js +31 -0
- data/app/components/maglev/uikit/form/select_component.html.erb +19 -0
- data/app/components/maglev/uikit/form/select_component.rb +52 -0
- data/app/components/maglev/uikit/form/select_controller.js +7 -0
- data/app/components/maglev/uikit/form/text_field_component.html.erb +26 -0
- data/app/components/maglev/uikit/form/text_field_component.rb +42 -0
- data/app/components/maglev/uikit/form/text_field_controller.js +18 -0
- data/app/components/maglev/uikit/form/textarea_component.html.erb +43 -0
- data/app/components/maglev/uikit/form/textarea_component.rb +53 -0
- data/app/components/maglev/uikit/icon_button_component/icon_button_component.html.erb +3 -0
- data/app/components/maglev/uikit/icon_button_component.rb +18 -0
- data/app/components/maglev/uikit/icon_component.rb +140 -0
- data/app/components/maglev/uikit/image_library/card_component.html.erb +41 -0
- data/app/components/maglev/uikit/image_library/card_component.rb +52 -0
- data/app/components/maglev/uikit/image_library/list_component.html.erb +7 -0
- data/app/components/maglev/uikit/image_library/list_component.rb +11 -0
- data/app/components/maglev/uikit/image_library/uploader_component.html.erb +30 -0
- data/app/components/maglev/uikit/image_library/uploader_component.rb +29 -0
- data/app/components/maglev/uikit/image_library/uploader_controller.js +74 -0
- data/app/components/maglev/uikit/list/insert_button_component.html.erb +7 -0
- data/app/components/maglev/uikit/list/insert_button_component.rb +40 -0
- data/app/components/maglev/uikit/list/list_component.html.erb +17 -0
- data/app/components/maglev/uikit/list/list_component.rb +34 -0
- data/app/components/maglev/uikit/list/list_item_component.html.erb +47 -0
- data/app/components/maglev/uikit/list/list_item_component.rb +85 -0
- data/app/components/maglev/uikit/locale_switcher_component/locale_switcher_component.html.erb +22 -0
- data/app/components/maglev/uikit/locale_switcher_component.rb +18 -0
- data/app/components/maglev/uikit/menu_dropdown_component/menu_dropdown_component.html.erb +15 -0
- data/app/components/maglev/uikit/menu_dropdown_component.rb +32 -0
- data/app/components/maglev/uikit/modal_component/modal_component.html.erb +63 -0
- data/app/components/maglev/uikit/modal_component/modal_controller.js +47 -0
- data/app/components/maglev/uikit/modal_component.rb +33 -0
- data/app/components/maglev/uikit/page_actions_dropdown_component/page_actions_dropdown_component.html.erb +56 -0
- data/app/components/maglev/uikit/page_actions_dropdown_component.rb +24 -0
- data/app/components/maglev/uikit/page_layout_component/back_link_component.html.erb +4 -0
- data/app/components/maglev/uikit/page_layout_component/page_layout_component.html.erb +58 -0
- data/app/components/maglev/uikit/page_layout_component/page_layout_controller.js +34 -0
- data/app/components/maglev/uikit/page_layout_component.rb +42 -0
- data/app/components/maglev/uikit/pagination_component/pagination_component.html.erb +70 -0
- data/app/components/maglev/uikit/pagination_component.rb +25 -0
- data/app/components/maglev/uikit/section_toolbar/bottom_component.html.erb +13 -0
- data/app/components/maglev/uikit/section_toolbar/bottom_component.rb +27 -0
- data/app/components/maglev/uikit/section_toolbar/section_toolbar_component.html.erb +17 -0
- data/app/components/maglev/uikit/section_toolbar/section_toolbar_component.rb +18 -0
- data/app/components/maglev/uikit/section_toolbar/section_toolbar_controller.js +90 -0
- data/app/components/maglev/uikit/section_toolbar/top_left_corner_component.html.erb +16 -0
- data/app/components/maglev/uikit/section_toolbar/top_left_corner_component.rb +15 -0
- data/app/components/maglev/uikit/section_toolbar/top_right_corner_component.html.erb +28 -0
- data/app/components/maglev/uikit/section_toolbar/top_right_corner_component.rb +28 -0
- data/app/components/maglev/uikit/tabs_component/tabs_component.html.erb +35 -0
- data/app/components/maglev/uikit/tabs_component/tabs_controller.js +57 -0
- data/app/components/maglev/uikit/tabs_component.rb +71 -0
- data/app/controllers/concerns/maglev/content_locale_concern.rb +5 -1
- data/app/controllers/concerns/maglev/editor/errors_concern.rb +45 -0
- data/app/controllers/concerns/maglev/fetchers_concern.rb +3 -6
- data/app/controllers/concerns/maglev/flash_i18n_concern.rb +11 -0
- data/app/controllers/maglev/application_controller.rb +1 -7
- data/app/controllers/maglev/editor/assets_controller.rb +59 -0
- data/app/controllers/maglev/editor/base_controller.rb +111 -0
- data/app/controllers/maglev/editor/combobox/collection_items_controller.rb +17 -0
- data/app/controllers/maglev/editor/combobox/pages_controller.rb +20 -0
- data/app/controllers/maglev/editor/home_controller.rb +25 -0
- data/app/controllers/maglev/editor/icons_controller.rb +24 -0
- data/app/controllers/maglev/editor/links_controller.rb +52 -0
- data/app/controllers/maglev/editor/page_clone_controller.rb +20 -0
- data/app/controllers/maglev/editor/pages_controller.rb +77 -0
- data/app/controllers/maglev/editor/publication_controller.rb +14 -0
- data/app/controllers/maglev/editor/section_blocks_controller.rb +101 -0
- data/app/controllers/maglev/editor/sections_controller.rb +96 -0
- data/app/controllers/maglev/editor/style_controller.rb +31 -0
- data/app/controllers/maglev/page_preview_controller.rb +1 -5
- data/app/controllers/maglev/published_page_preview_controller.rb +50 -0
- data/app/controllers/maglev/sitemap_controller.rb +1 -1
- data/app/helpers/maglev/application_helper.rb +148 -18
- data/app/helpers/maglev/editor/pages_helper.rb +23 -0
- data/app/helpers/maglev/editor/section_blocks_helper.rb +124 -0
- data/app/helpers/maglev/editor/settings_helper.rb +52 -0
- data/app/helpers/maglev/page_preview_helper.rb +1 -1
- data/app/lib/maglev/form/form_builder.rb +38 -0
- data/app/lib/maglev/form/inputs/check_box.rb +20 -0
- data/app/lib/maglev/form/inputs/combobox.rb +33 -0
- data/app/lib/maglev/form/inputs/image_field.rb +39 -0
- data/app/lib/maglev/form/inputs/richtext.rb +34 -0
- data/app/lib/maglev/form/inputs/select.rb +34 -0
- data/app/lib/maglev/form/inputs/text_field.rb +32 -0
- data/app/lib/maglev/form/inputs/textarea.rb +30 -0
- data/app/lib/maglev/turbo/streams/tag_builder.rb +17 -0
- data/app/models/concerns/maglev/content/enhanced_value_concern.rb +40 -0
- data/app/models/concerns/maglev/sections_concern.rb +30 -1
- data/app/models/concerns/maglev/translatable.rb +23 -4
- data/app/models/maglev/application_record.rb +10 -0
- data/app/models/maglev/asset.rb +1 -3
- data/app/models/maglev/content/block_content.rb +96 -0
- data/app/models/maglev/content/editor_link.rb +49 -0
- data/app/models/maglev/content/section_content.rb +85 -0
- data/app/models/maglev/content/setting_content.rb +33 -0
- data/app/models/maglev/page/path_concern.rb +7 -0
- data/app/models/maglev/page/search_concern.rb +24 -7
- data/app/models/maglev/page.rb +3 -0
- data/app/models/maglev/section/block.rb +43 -6
- data/app/models/maglev/section/content_concern.rb +15 -1
- data/app/models/maglev/section/setting.rb +12 -0
- data/app/models/maglev/section.rb +52 -4
- data/app/models/maglev/sections_content_store.rb +36 -0
- data/app/models/maglev/setting_types/base.rb +8 -0
- data/app/models/maglev/setting_types/collection_item.rb +5 -1
- data/app/models/maglev/setting_types/image.rb +4 -0
- data/app/models/maglev/setting_types/link.rb +4 -0
- data/app/models/maglev/setting_types/text.rb +5 -0
- data/app/models/maglev/site/locales_concern.rb +4 -14
- data/app/models/maglev/site/style_value.rb +19 -13
- data/app/models/maglev/site.rb +8 -0
- data/app/models/maglev/theme/section_category.rb +6 -1
- data/app/models/maglev/theme/style_setting.rb +1 -1
- data/app/models/maglev/theme.rb +13 -0
- data/app/services/concerns/maglev/content/helpers_concern.rb +100 -0
- data/app/services/concerns/maglev/get_page_sections/transform_section_concern.rb +97 -0
- data/app/services/maglev/app_container.rb +27 -2
- data/app/services/maglev/content/add_section_block_service.rb +53 -0
- data/app/services/maglev/content/add_section_service.rb +99 -0
- data/app/services/maglev/content/delete_section_block_service.rb +45 -0
- data/app/services/maglev/content/delete_section_service.rb +34 -0
- data/app/services/maglev/content/sort_section_blocks_service.rb +47 -0
- data/app/services/maglev/content/update_section_block_service.rb +52 -0
- data/app/services/maglev/content/update_section_service.rb +50 -0
- data/app/services/maglev/create_page_service.rb +39 -0
- data/app/services/maglev/fetch_section_screenshot_url.rb +12 -1
- data/app/services/maglev/fetch_style.rb +22 -12
- data/app/services/maglev/get_base_url.rb +3 -1
- data/app/services/maglev/get_page_section_names.rb +1 -1
- data/app/services/maglev/get_page_sections.rb +11 -82
- data/app/services/maglev/get_published_page_sections_service.rb +48 -0
- data/app/services/maglev/persist_section_screenshot.rb +1 -1
- data/app/services/maglev/persist_style_service.rb +36 -0
- data/app/services/maglev/publish_service.rb +30 -0
- data/app/services/maglev/reset_section_content.rb +64 -0
- data/app/services/maglev/search_pages.rb +6 -2
- data/app/services/maglev/setup_pages.rb +44 -33
- data/app/types/maglev/locales_type.rb +9 -0
- data/app/views/layouts/maglev/editor/_head.html.erb +0 -0
- data/app/views/layouts/maglev/editor/_sidebar.html.erb +39 -0
- data/app/views/layouts/maglev/editor/_topbar.html.erb +45 -0
- data/app/views/layouts/maglev/editor/application.html.erb +67 -0
- data/app/views/maglev/editor/assets/_list.html.erb +33 -0
- data/app/views/maglev/editor/assets/index.html.erb +29 -0
- data/app/views/maglev/editor/combobox/collection_items/index.turbo_stream.erb +18 -0
- data/app/views/maglev/editor/combobox/pages/index.turbo_stream.erb +7 -0
- data/app/views/maglev/editor/home/index.html.erb +1 -0
- data/app/views/maglev/editor/icons/_list.html.erb +27 -0
- data/app/views/maglev/editor/icons/index.html.erb +23 -0
- data/app/views/maglev/editor/links/edit/_email.html.erb +5 -0
- data/app/views/maglev/editor/links/edit/_page.html.erb +29 -0
- data/app/views/maglev/editor/links/edit/_tabs.html.erb +11 -0
- data/app/views/maglev/editor/links/edit/_url.html.erb +7 -0
- data/app/views/maglev/editor/links/edit.html.erb +31 -0
- data/app/views/maglev/editor/links/update.turbo_stream.erb +9 -0
- data/app/views/maglev/editor/pages/_list.html.erb +28 -0
- data/app/views/maglev/editor/pages/_preview.html.erb +35 -0
- data/app/views/maglev/editor/pages/_preview_empty_message.html.erb +14 -0
- data/app/views/maglev/editor/pages/edit.html.erb +32 -0
- data/app/views/maglev/editor/pages/form/_main.html.erb +7 -0
- data/app/views/maglev/editor/pages/form/_seo.html.erb +11 -0
- data/app/views/maglev/editor/pages/form/_tabs.html.erb +8 -0
- data/app/views/maglev/editor/pages/index.html.erb +23 -0
- data/app/views/maglev/editor/pages/new.html.erb +28 -0
- data/app/views/maglev/editor/publication/create.turbo_stream.erb +1 -0
- data/app/views/maglev/editor/section_blocks/_form.html.erb +15 -0
- data/app/views/maglev/editor/section_blocks/_new.html.erb +21 -0
- data/app/views/maglev/editor/section_blocks/edit.html.erb +28 -0
- data/app/views/maglev/editor/section_blocks/index/_list.html.erb +41 -0
- data/app/views/maglev/editor/section_blocks/index/_tree.html.erb +56 -0
- data/app/views/maglev/editor/section_blocks/index.html.erb +20 -0
- data/app/views/maglev/editor/section_blocks/update.turbo_stream.erb +5 -0
- data/app/views/maglev/editor/sections/_form.html.erb +21 -0
- data/app/views/maglev/editor/sections/_list.html.erb +50 -0
- data/app/views/maglev/editor/sections/_theme_list.html.erb +32 -0
- data/app/views/maglev/editor/sections/_toolbar_list.html.erb +17 -0
- data/app/views/maglev/editor/sections/edit.html.erb +24 -0
- data/app/views/maglev/editor/sections/index.html.erb +11 -0
- data/app/views/maglev/editor/sections/new.html.erb +20 -0
- data/app/views/maglev/editor/sections/update.turbo_stream.erb +5 -0
- data/app/views/maglev/editor/shared/_button_label.html.erb +18 -0
- data/app/views/maglev/editor/shared/errors/not_authorized_error.turbo_stream.erb +17 -0
- data/app/views/maglev/editor/shared/errors/stale_object_error.turbo_stream.erb +21 -0
- data/app/views/maglev/editor/shared/errors/standard_error.turbo_stream.erb +17 -0
- data/app/views/maglev/editor/style/edit.html.erb +24 -0
- data/app/views/maglev/sitemap/index.xml.builder +1 -1
- data/config/client_importmap.rb +4 -0
- data/config/editor_importmap.rb +26 -0
- data/config/initializers/active_record_types.rb +5 -0
- data/config/initializers/migration_patches.rb +9 -0
- data/config/initializers/pagy.rb +3 -0
- data/config/locales/activerecord.ar.yml +20 -2
- data/config/locales/activerecord.en.yml +20 -2
- data/config/locales/activerecord.es.yml +15 -14
- data/config/locales/activerecord.fr.yml +15 -14
- data/config/locales/activerecord.pt-BR.yml +22 -4
- data/config/locales/editor.ar.yml +268 -0
- data/config/locales/editor.en.yml +268 -0
- data/config/locales/editor.es.yml +268 -0
- data/config/locales/editor.fr.yml +268 -0
- data/config/locales/editor.pt-BR.yml +268 -0
- data/config/locales/uikit.ar.yml +14 -0
- data/config/locales/uikit.en.yml +14 -0
- data/config/locales/uikit.es.yml +14 -0
- data/config/locales/uikit.fr.yml +14 -0
- data/config/locales/uikit.pt-BR.yml +14 -0
- data/config/routes.rb +34 -35
- data/db/migrate/20200831101942_create_maglev_section_content.rb +4 -0
- data/db/migrate/20210819092740_switch_to_localized_page_fields.rb +8 -2
- data/db/migrate/20211008064437_add_locales_to_sites.rb +2 -0
- data/db/migrate/20211013210954_translate_section_content.rb +6 -2
- data/db/migrate/20211203224112_add_open_graph_tags_to_pages.rb +4 -0
- data/db/migrate/20220612092235_add_style_to_sites.rb +2 -0
- data/db/migrate/20250929203214_create_maglev_sections_content_stores.rb +21 -0
- data/exe/tailwind-cli +29 -0
- data/lib/commands/maglev/change_site_locales_command.rb +1 -1
- data/lib/commands/maglev/create_site_command.rb +1 -1
- data/lib/commands/maglev/publish_site_command.rb +46 -0
- data/lib/commands/maglev/sections/remove_command.rb +1 -1
- data/lib/commands/maglev/sections/rename_command.rb +6 -2
- data/lib/commands/maglev/sections/reset_command.rb +56 -0
- data/lib/generators/maglev/install_generator.rb +1 -6
- data/lib/generators/maglev/templates/install/config/initializers/maglev.rb +6 -2
- data/lib/generators/maglev/templates/theme/app/views/theme/layout.html.erb.tt +2 -2
- data/lib/maglev/config.rb +2 -1
- data/lib/maglev/engine.rb +34 -42
- data/lib/maglev/errors.rb +3 -0
- data/lib/maglev/version.rb +1 -1
- data/lib/maglev.rb +4 -2
- data/lib/tasks/maglev/tailwindcss.rake +38 -0
- data/lib/tasks/maglev_tasks.rake +4 -34
- metadata +355 -342
- data/.babelrc +0 -9
- data/.yarn/install-state.gz +0 -0
- data/.yarn/releases/yarn-4.4.0.cjs +0 -925
- data/.yarnrc.yml +0 -3
- data/app/controllers/maglev/admin/base_controller.rb +0 -20
- data/app/controllers/maglev/admin/dashboard_controller.rb +0 -11
- data/app/controllers/maglev/admin/sections/previews_controller.rb +0 -52
- data/app/controllers/maglev/admin/sections/screenshots_controller.rb +0 -17
- data/app/controllers/maglev/admin/themes_controller.rb +0 -19
- data/app/controllers/maglev/api/assets_controller.rb +0 -44
- data/app/controllers/maglev/api/collection_items_controller.rb +0 -21
- data/app/controllers/maglev/api/page_clones_controller.rb +0 -21
- data/app/controllers/maglev/api/pages_controller.rb +0 -65
- data/app/controllers/maglev/api/publications_controller.rb +0 -15
- data/app/controllers/maglev/api/sites_controller.rb +0 -21
- data/app/controllers/maglev/api_controller.rb +0 -61
- data/app/controllers/maglev/editor_controller.rb +0 -59
- data/app/frontend/admin/controllers/dropdown_controller.js +0 -9
- data/app/frontend/admin/controllers/iframe_controller.js +0 -16
- data/app/frontend/admin/controllers/screenshot_controller.js +0 -69
- data/app/frontend/admin/index.js +0 -10
- data/app/frontend/admin/utils/axios.js +0 -16
- data/app/frontend/editor/App.vue +0 -43
- data/app/frontend/editor/assets/remixicons/add-box-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/arrow-down-s-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/arrow-drop-left.svg +0 -1
- data/app/frontend/editor/assets/remixicons/arrow-drop-right.svg +0 -1
- data/app/frontend/editor/assets/remixicons/arrow-up-s-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/camera-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/clipboard-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/close-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/computer-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/delete-bin-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/file-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-blockquote.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-bold.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-code.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-heading-2.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-heading-3.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-heading-4.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-italic.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-link-unlink.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-link.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-list-ordered.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-list-unordered.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-paragraph.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-strikethrough.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-superscript.svg +0 -1
- data/app/frontend/editor/assets/remixicons/format-underline.svg +0 -1
- data/app/frontend/editor/assets/remixicons/home-4-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/image-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/logout-box-r-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-add-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-alert-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-book-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-bug-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-check-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-close-circle-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-close-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-delete-column.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-delete-row.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-draggable.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-drop-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-external-link-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-eye-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-eye-off-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-file-copy-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-file-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-folders-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-global-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-insert-column-left.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-insert-column-right.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-insert-row-bottom.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-insert-row-top.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-loader-4-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-mail-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-more-2-fill.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-more-fill.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-palette-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-pencil-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-play-list-add-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-settings-5-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-shadow-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-stack-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-table-2.svg +0 -1
- data/app/frontend/editor/assets/remixicons/ri-table-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/search-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/settings-4-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/smartphone-line.svg +0 -1
- data/app/frontend/editor/assets/remixicons/tablet-line.svg +0 -1
- data/app/frontend/editor/components/dynamic-form/dynamic-input.vue +0 -141
- data/app/frontend/editor/components/dynamic-form/index.vue +0 -36
- data/app/frontend/editor/components/errors/forbidden.vue +0 -24
- data/app/frontend/editor/components/errors/stale-record.vue +0 -24
- data/app/frontend/editor/components/header-nav/device-toggler.vue +0 -40
- data/app/frontend/editor/components/header-nav/index.vue +0 -77
- data/app/frontend/editor/components/header-nav/locale-toggler/index.vue +0 -51
- data/app/frontend/editor/components/header-nav/locale-toggler/locale-link.vue +0 -32
- data/app/frontend/editor/components/header-nav/page-info.vue +0 -41
- data/app/frontend/editor/components/header-nav/preview-button.vue +0 -20
- data/app/frontend/editor/components/header-nav/preview-toggler.vue +0 -40
- data/app/frontend/editor/components/header-nav/publish-button.vue +0 -77
- data/app/frontend/editor/components/header-nav/save-button.vue +0 -33
- data/app/frontend/editor/components/header-nav/separator.vue +0 -11
- data/app/frontend/editor/components/icon-library/index.vue +0 -39
- data/app/frontend/editor/components/image-library/index.vue +0 -107
- data/app/frontend/editor/components/image-library/list-item.vue +0 -93
- data/app/frontend/editor/components/image-library/list.vue +0 -26
- data/app/frontend/editor/components/image-library/uploader.vue +0 -76
- data/app/frontend/editor/components/kit/accordion.vue +0 -68
- data/app/frontend/editor/components/kit/checkbox-input.vue +0 -59
- data/app/frontend/editor/components/kit/collection-item-input.vue +0 -79
- data/app/frontend/editor/components/kit/color-input/core-input.vue +0 -92
- data/app/frontend/editor/components/kit/color-input/preset-button.vue +0 -61
- data/app/frontend/editor/components/kit/color-input/preset-dropdown.vue +0 -47
- data/app/frontend/editor/components/kit/color-input.vue +0 -41
- data/app/frontend/editor/components/kit/confirmation-button.vue +0 -65
- data/app/frontend/editor/components/kit/copy-paste-button.vue +0 -26
- data/app/frontend/editor/components/kit/divider.vue +0 -22
- data/app/frontend/editor/components/kit/dropdown.vue +0 -66
- data/app/frontend/editor/components/kit/hint.vue +0 -12
- data/app/frontend/editor/components/kit/icon-button.vue +0 -24
- data/app/frontend/editor/components/kit/icon-input.vue +0 -96
- data/app/frontend/editor/components/kit/icon.vue +0 -36
- data/app/frontend/editor/components/kit/image-input.vue +0 -124
- data/app/frontend/editor/components/kit/index.js +0 -56
- data/app/frontend/editor/components/kit/link-input.vue +0 -121
- data/app/frontend/editor/components/kit/modal-root.vue +0 -85
- data/app/frontend/editor/components/kit/modal.vue +0 -39
- data/app/frontend/editor/components/kit/page-icon.vue +0 -21
- data/app/frontend/editor/components/kit/pagination/button.vue +0 -35
- data/app/frontend/editor/components/kit/pagination/index.vue +0 -116
- data/app/frontend/editor/components/kit/rich-text-input/block-button.vue +0 -75
- data/app/frontend/editor/components/kit/rich-text-input/extensions/Doc.js +0 -12
- data/app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js +0 -38
- data/app/frontend/editor/components/kit/rich-text-input/extensions/marks/Link.js +0 -57
- data/app/frontend/editor/components/kit/rich-text-input/extensions/marks/Superscript.js +0 -43
- data/app/frontend/editor/components/kit/rich-text-input/format-buttons.vue +0 -47
- data/app/frontend/editor/components/kit/rich-text-input/link-buttons.vue +0 -91
- data/app/frontend/editor/components/kit/rich-text-input/list-buttons.vue +0 -29
- data/app/frontend/editor/components/kit/rich-text-input/menu-button.vue +0 -22
- data/app/frontend/editor/components/kit/rich-text-input/table-button.vue +0 -112
- data/app/frontend/editor/components/kit/rich-text-input.vue +0 -187
- data/app/frontend/editor/components/kit/search-input.vue +0 -54
- data/app/frontend/editor/components/kit/select-input.vue +0 -200
- data/app/frontend/editor/components/kit/simple-select.vue +0 -56
- data/app/frontend/editor/components/kit/submit-button.vue +0 -117
- data/app/frontend/editor/components/kit/tabs.vue +0 -99
- data/app/frontend/editor/components/kit/text-input.vue +0 -63
- data/app/frontend/editor/components/kit/textarea-input.vue +0 -61
- data/app/frontend/editor/components/link-picker/actions.vue +0 -32
- data/app/frontend/editor/components/link-picker/email.vue +0 -32
- data/app/frontend/editor/components/link-picker/index.vue +0 -97
- data/app/frontend/editor/components/link-picker/page.vue +0 -126
- data/app/frontend/editor/components/link-picker/url.vue +0 -43
- data/app/frontend/editor/components/page/edit.vue +0 -99
- data/app/frontend/editor/components/page/form/main.vue +0 -64
- data/app/frontend/editor/components/page/form/seo.vue +0 -94
- data/app/frontend/editor/components/page/list/actions-button.vue +0 -159
- data/app/frontend/editor/components/page/list/index.vue +0 -58
- data/app/frontend/editor/components/page/list/list-item.vue +0 -96
- data/app/frontend/editor/components/page/new.vue +0 -79
- data/app/frontend/editor/components/section-block-pane/index.vue +0 -69
- data/app/frontend/editor/components/section-block-pane/setting-list.vue +0 -53
- data/app/frontend/editor/components/section-highlighter/bottom-actions.vue +0 -60
- data/app/frontend/editor/components/section-highlighter/index.vue +0 -125
- data/app/frontend/editor/components/section-highlighter/top-left-actions.vue +0 -78
- data/app/frontend/editor/components/section-highlighter/top-right-actions.vue +0 -130
- data/app/frontend/editor/components/section-list/add-button.vue +0 -39
- data/app/frontend/editor/components/section-list/index.vue +0 -79
- data/app/frontend/editor/components/section-list/list-item.vue +0 -60
- data/app/frontend/editor/components/section-pane/block-list/index.vue +0 -68
- data/app/frontend/editor/components/section-pane/block-list/list-item.vue +0 -74
- data/app/frontend/editor/components/section-pane/block-list/new-block-button.vue +0 -74
- data/app/frontend/editor/components/section-pane/block-tree/index.vue +0 -63
- data/app/frontend/editor/components/section-pane/block-tree/new-nested-block-button.vue +0 -67
- data/app/frontend/editor/components/section-pane/block-tree/tree-node.vue +0 -109
- data/app/frontend/editor/components/section-pane/index.vue +0 -94
- data/app/frontend/editor/components/section-pane/setting-list.vue +0 -50
- data/app/frontend/editor/components/sidebar-nav/index.vue +0 -102
- data/app/frontend/editor/components/sidebar-nav/link.vue +0 -60
- data/app/frontend/editor/components/style-pane/index.vue +0 -48
- data/app/frontend/editor/components/theme-section-list/category.vue +0 -47
- data/app/frontend/editor/components/theme-section-list/index.vue +0 -27
- data/app/frontend/editor/components/theme-section-list/list-item.vue +0 -95
- data/app/frontend/editor/design/application.scss +0 -17
- data/app/frontend/editor/design/components/buttons.scss +0 -25
- data/app/frontend/editor/design/components/modal.scss +0 -49
- data/app/frontend/editor/design/components/tooltip.scss +0 -123
- data/app/frontend/editor/design/components/tree.scss +0 -6
- data/app/frontend/editor/design/helpers.scss +0 -9
- data/app/frontend/editor/design/transitions.scss +0 -121
- data/app/frontend/editor/layouts/app.vue +0 -42
- data/app/frontend/editor/layouts/default.vue +0 -57
- data/app/frontend/editor/layouts/slide-pane.vue +0 -87
- data/app/frontend/editor/locales/editor.ar.json +0 -265
- data/app/frontend/editor/locales/editor.en.json +0 -265
- data/app/frontend/editor/locales/editor.es.json +0 -265
- data/app/frontend/editor/locales/editor.fr.json +0 -265
- data/app/frontend/editor/locales/editor.pt-BR.json +0 -265
- data/app/frontend/editor/locales/index.js +0 -23
- data/app/frontend/editor/main.js +0 -21
- data/app/frontend/editor/misc/__tests__/utils.spec.js +0 -43
- data/app/frontend/editor/misc/utils.js +0 -177
- data/app/frontend/editor/mixins/error-modal.js +0 -28
- data/app/frontend/editor/mixins/focused-input.js +0 -20
- data/app/frontend/editor/mixins/global.js +0 -140
- data/app/frontend/editor/mixins/grouped-dropdowns.js +0 -17
- data/app/frontend/editor/mixins/index.js +0 -1
- data/app/frontend/editor/mixins/preview-transformation.js +0 -59
- data/app/frontend/editor/plugins/event-bus.js +0 -3
- data/app/frontend/editor/plugins/filters.js +0 -7
- data/app/frontend/editor/plugins/i18n.js +0 -13
- data/app/frontend/editor/plugins/index.js +0 -3
- data/app/frontend/editor/plugins/tooltip.js +0 -4
- data/app/frontend/editor/router/index.js +0 -41
- data/app/frontend/editor/router/routes/base.js +0 -59
- data/app/frontend/editor/router/routes/index.js +0 -3
- data/app/frontend/editor/router/routes/page.js +0 -30
- data/app/frontend/editor/router/routes/section-block.js +0 -29
- data/app/frontend/editor/router/routes/section.js +0 -67
- data/app/frontend/editor/router/routes/style.js +0 -17
- data/app/frontend/editor/services/__tests__/page.spec.js +0 -38
- data/app/frontend/editor/services/__tests__/section.spec.js +0 -39
- data/app/frontend/editor/services/api.js +0 -40
- data/app/frontend/editor/services/block.js +0 -26
- data/app/frontend/editor/services/collection-item.js +0 -20
- data/app/frontend/editor/services/image.js +0 -26
- data/app/frontend/editor/services/index.js +0 -21
- data/app/frontend/editor/services/live-preview.js +0 -131
- data/app/frontend/editor/services/page.js +0 -107
- data/app/frontend/editor/services/section.js +0 -214
- data/app/frontend/editor/services/site.js +0 -21
- data/app/frontend/editor/services/theme.js +0 -9
- data/app/frontend/editor/spec/__mocks__/page.js +0 -434
- data/app/frontend/editor/spec/__mocks__/section.js +0 -232
- data/app/frontend/editor/spec/__mocks__/services.js +0 -84
- data/app/frontend/editor/spec/__mocks__/site.js +0 -95
- data/app/frontend/editor/spec/__mocks__/theme.js +0 -518
- data/app/frontend/editor/store/__tests__/getters.spec.js +0 -158
- data/app/frontend/editor/store/actions/__tests__/page.spec.js +0 -97
- data/app/frontend/editor/store/actions/__tests__/section-block.spec.js +0 -105
- data/app/frontend/editor/store/actions/__tests__/section.spec.js +0 -62
- data/app/frontend/editor/store/actions/index.js +0 -35
- data/app/frontend/editor/store/actions/page.js +0 -66
- data/app/frontend/editor/store/actions/section-block.js +0 -57
- data/app/frontend/editor/store/actions/section.js +0 -75
- data/app/frontend/editor/store/actions/site.js +0 -32
- data/app/frontend/editor/store/default-state.js +0 -27
- data/app/frontend/editor/store/getters.js +0 -113
- data/app/frontend/editor/store/index.js +0 -29
- data/app/frontend/editor/store/mutations.js +0 -187
- data/app/frontend/editor/views/content-pane.vue +0 -109
- data/app/frontend/editor/views/page-preview.vue +0 -160
- data/app/frontend/editor/views/pages/edit.vue +0 -26
- data/app/frontend/editor/views/pages/index.vue +0 -65
- data/app/frontend/editor/views/sections/add-pane.vue +0 -23
- data/app/frontend/editor/views/sections/list-pane.vue +0 -20
- data/app/frontend/editor/views/slide-pane.vue +0 -14
- data/app/frontend/editor/views/slide-pane2.vue +0 -14
- data/app/frontend/editor/views/style/edit-pane.vue +0 -22
- data/app/frontend/entrypoints/admin.js +0 -3
- data/app/frontend/entrypoints/admin.scss +0 -5
- data/app/frontend/entrypoints/editor.js +0 -8
- data/app/frontend/entrypoints/live-preview-client.js +0 -6
- data/app/frontend/entrypoints/live-preview-rails-client.js +0 -9
- data/app/frontend/live-preview-client/index.js +0 -11
- data/app/frontend/live-preview-client/rails.js +0 -217
- data/app/helpers/maglev/editor_helper.rb +0 -95
- data/app/services/maglev/persist_page.rb +0 -97
- data/app/views/layouts/maglev/admin/_header_actions.html.erb +0 -5
- data/app/views/layouts/maglev/admin/application.html.erb +0 -26
- data/app/views/maglev/admin/sections/previews/show.html.erb +0 -47
- data/app/views/maglev/admin/themes/_empty.html.erb +0 -20
- data/app/views/maglev/admin/themes/_section_categories.html.erb +0 -9
- data/app/views/maglev/admin/themes/_sections.html.erb +0 -54
- data/app/views/maglev/admin/themes/show.html.erb +0 -21
- data/app/views/maglev/api/_pagination.json.jbuilder +0 -6
- data/app/views/maglev/api/assets/_show.json.jbuilder +0 -8
- data/app/views/maglev/api/assets/index.json.jbuilder +0 -9
- data/app/views/maglev/api/assets/show.json.jbuilder +0 -3
- data/app/views/maglev/api/collection_items/_show.json.jbuilder +0 -5
- data/app/views/maglev/api/collection_items/index.json.jbuilder +0 -5
- data/app/views/maglev/api/collection_items/show.json.jbuilder +0 -7
- data/app/views/maglev/api/page_clones/create.json.jbuilder +0 -3
- data/app/views/maglev/api/pages/_show.json.jbuilder +0 -23
- data/app/views/maglev/api/pages/index.json.jbuilder +0 -18
- data/app/views/maglev/api/pages/show.json.jbuilder +0 -3
- data/app/views/maglev/api/sites/_show.json.jbuilder +0 -15
- data/app/views/maglev/api/sites/show.json.jbuilder +0 -3
- data/app/views/maglev/api/themes/_show.json.jbuilder +0 -17
- data/app/views/maglev/editor/_header.html.erb +0 -1
- data/app/views/maglev/editor/show.html.erb +0 -41
- data/app/views/maglev/settings/index.html.erb +0 -11
- data/bin/vite +0 -29
- data/config/initializers/kaminari.rb +0 -16
- data/config/vite.json +0 -17
- data/lib/tasks/maglev/vite.rake +0 -62
- data/package.json +0 -58
- data/postcss.config.cjs +0 -6
- data/tailwind.config.js +0 -68
- data/vite.config.ts +0 -18
- data/yarn.lock +0 -4749
- /data/app/{frontend/images → assets/images/maglev}/favicon.svg +0 -0
- /data/app/{frontend/images → assets/images/maglev}/logo.svg +0 -0
- /data/app/{frontend/live-preview-client → assets/javascripts/maglev/client}/run-scripts.js +0 -0
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
import { mapState, mapActions } from 'vuex'
|
|
3
|
-
import { ModalBus } from '@/plugins/event-bus'
|
|
4
|
-
import services from '@/services'
|
|
5
|
-
import { isBlank } from '@/misc/utils'
|
|
6
|
-
|
|
7
|
-
Vue.mixin({
|
|
8
|
-
computed: {
|
|
9
|
-
...mapState(['device', 'previewReady']),
|
|
10
|
-
services() {
|
|
11
|
-
return services
|
|
12
|
-
},
|
|
13
|
-
isSitePublishable() {
|
|
14
|
-
return this.$store.state.editorSettings.sitePublishable
|
|
15
|
-
},
|
|
16
|
-
currentSite() {
|
|
17
|
-
return this.$store.state.site
|
|
18
|
-
},
|
|
19
|
-
currentI18nScope() {
|
|
20
|
-
return `themes.${this.currentTheme.id}`
|
|
21
|
-
},
|
|
22
|
-
currentStyle() {
|
|
23
|
-
return this.$store.state.style
|
|
24
|
-
},
|
|
25
|
-
currentStyleI18nScope() {
|
|
26
|
-
return `${this.currentI18nScope}.style`
|
|
27
|
-
},
|
|
28
|
-
currentLocale() {
|
|
29
|
-
return this.$store.state.locale
|
|
30
|
-
},
|
|
31
|
-
currentPage() {
|
|
32
|
-
return this.$store.state.page
|
|
33
|
-
},
|
|
34
|
-
isCurrentPageIndex() {
|
|
35
|
-
return this.services.page.isIndex(this.currentPage)
|
|
36
|
-
},
|
|
37
|
-
currentTheme() {
|
|
38
|
-
return this.$store.state.theme
|
|
39
|
-
},
|
|
40
|
-
currentSection() {
|
|
41
|
-
return this.$store.state.section
|
|
42
|
-
},
|
|
43
|
-
currentSectionI18nScope() {
|
|
44
|
-
return `${this.currentI18nScope}.sections.${this.currentSection.type}`
|
|
45
|
-
},
|
|
46
|
-
currentSectionList() {
|
|
47
|
-
return this.$store.getters.sectionList
|
|
48
|
-
},
|
|
49
|
-
currentSectionContent() {
|
|
50
|
-
return this.$store.getters.sectionContent
|
|
51
|
-
},
|
|
52
|
-
currentSectionDefinition() {
|
|
53
|
-
return this.$store.state.sectionDefinition
|
|
54
|
-
},
|
|
55
|
-
currentSectionSettings() {
|
|
56
|
-
return this.$store.getters.sectionSettings(false)
|
|
57
|
-
},
|
|
58
|
-
currentSectionAdvancedSettings() {
|
|
59
|
-
return this.$store.getters.sectionSettings(true)
|
|
60
|
-
},
|
|
61
|
-
currentSectionBlocks() {
|
|
62
|
-
return this.$store.getters.sectionBlocks
|
|
63
|
-
},
|
|
64
|
-
currentSectionBlock() {
|
|
65
|
-
return this.$store.state.sectionBlock
|
|
66
|
-
},
|
|
67
|
-
currentSectionBlockI18nScope() {
|
|
68
|
-
return `${this.currentSectionI18nScope}.blocks.${this.currentSectionBlock.type}`
|
|
69
|
-
},
|
|
70
|
-
currentSectionBlockIndex() {
|
|
71
|
-
return this.$store.getters.sectionBlockIndex
|
|
72
|
-
},
|
|
73
|
-
currentSectionBlockContent() {
|
|
74
|
-
return this.$store.getters.sectionBlockContent
|
|
75
|
-
},
|
|
76
|
-
currentSectionBlockDefinition() {
|
|
77
|
-
return this.$store.state.sectionBlockDefinition
|
|
78
|
-
},
|
|
79
|
-
currentSectionBlockSettings() {
|
|
80
|
-
return this.$store.getters.sectionBlockSettings(false)
|
|
81
|
-
},
|
|
82
|
-
currentSectionBlockAdvancedSettings() {
|
|
83
|
-
return this.$store.getters.sectionBlockSettings(true)
|
|
84
|
-
},
|
|
85
|
-
currentPageDefaultAttributes() {
|
|
86
|
-
return this.$store.getters.defaultPageAttributes
|
|
87
|
-
},
|
|
88
|
-
hasMultipleLocales() {
|
|
89
|
-
return this.$store.state.site.locales.length > 1
|
|
90
|
-
},
|
|
91
|
-
currentContent() {
|
|
92
|
-
return this.$store.getters.content
|
|
93
|
-
},
|
|
94
|
-
isDesktopDevice() {
|
|
95
|
-
return this.device === 'desktop'
|
|
96
|
-
},
|
|
97
|
-
isMobileDevice() {
|
|
98
|
-
return this.device === 'mobile'
|
|
99
|
-
},
|
|
100
|
-
isTabletDevice() {
|
|
101
|
-
return this.device === 'tablet'
|
|
102
|
-
},
|
|
103
|
-
deviceWidthMap() {
|
|
104
|
-
return {
|
|
105
|
-
mobile: 375,
|
|
106
|
-
tablet: 1024,
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
methods: {
|
|
111
|
-
...mapActions([
|
|
112
|
-
'setDevice',
|
|
113
|
-
'setLocale',
|
|
114
|
-
'fetchSite',
|
|
115
|
-
'fetchPage',
|
|
116
|
-
'fetchSection',
|
|
117
|
-
'fetchSectionBlock',
|
|
118
|
-
'setCurrentPageSettings',
|
|
119
|
-
]),
|
|
120
|
-
isBlank(value) {
|
|
121
|
-
return isBlank(value)
|
|
122
|
-
},
|
|
123
|
-
openModal({ title, component, props, listeners, closeOnClick }) {
|
|
124
|
-
ModalBus.$emit('open', {
|
|
125
|
-
title,
|
|
126
|
-
component,
|
|
127
|
-
props,
|
|
128
|
-
listeners,
|
|
129
|
-
closeOnClick,
|
|
130
|
-
})
|
|
131
|
-
},
|
|
132
|
-
closeModal() {
|
|
133
|
-
ModalBus.$emit('close')
|
|
134
|
-
},
|
|
135
|
-
$st(key) {
|
|
136
|
-
// console.log('$st', key, this.$te(key) ? this.$t(key) : null)
|
|
137
|
-
return this.$te(key) ? this.$t(key) : null
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
})
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
data() {
|
|
3
|
-
return { currentDropdown: null }
|
|
4
|
-
},
|
|
5
|
-
methods: {
|
|
6
|
-
onDropdownToggle(dropdown) {
|
|
7
|
-
if (
|
|
8
|
-
dropdown.open &&
|
|
9
|
-
this.currentDropdown &&
|
|
10
|
-
dropdown !== this.currentDropdown
|
|
11
|
-
) {
|
|
12
|
-
this.currentDropdown.close()
|
|
13
|
-
}
|
|
14
|
-
this.currentDropdown = dropdown
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './global'
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { vueWindowSizeMixin } from 'vue-window-size'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
mixins: [vueWindowSizeMixin],
|
|
5
|
-
computed: {
|
|
6
|
-
previewLeftPadding() {
|
|
7
|
-
return this.currentSection ? this.calculatePreviewLeftPadding() : 0
|
|
8
|
-
},
|
|
9
|
-
previewPaneMaxWidth() {
|
|
10
|
-
const sectionPaneWidth =
|
|
11
|
-
document.querySelector('.slide-pane')?.offsetWidth || 0
|
|
12
|
-
return this.windowWidth - sectionPaneWidth
|
|
13
|
-
},
|
|
14
|
-
previewScaleRatio() {
|
|
15
|
-
if (!this.mustPreviewScale()) return 1
|
|
16
|
-
const sidebarWidth = document.querySelector(
|
|
17
|
-
'.content-area > aside',
|
|
18
|
-
).offsetWidth
|
|
19
|
-
const sectionPaneWidth = document.querySelector('.slide-pane').offsetWidth
|
|
20
|
-
return (
|
|
21
|
-
(this.windowWidth - sectionPaneWidth) /
|
|
22
|
-
(this.windowWidth - sidebarWidth)
|
|
23
|
-
)
|
|
24
|
-
},
|
|
25
|
-
hasEnoughWidthForTablet() {
|
|
26
|
-
return (
|
|
27
|
-
this.isTabletDevice &&
|
|
28
|
-
this.previewPaneMaxWidth > this.deviceWidthMap.tablet
|
|
29
|
-
)
|
|
30
|
-
},
|
|
31
|
-
hasEnoughWidthForMobile() {
|
|
32
|
-
return (
|
|
33
|
-
this.isMobileDevice &&
|
|
34
|
-
this.previewPaneMaxWidth > this.deviceWidthMap.mobile
|
|
35
|
-
)
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
methods: {
|
|
39
|
-
calculatePreviewLeftPadding() {
|
|
40
|
-
const sidebarWidth =
|
|
41
|
-
document.querySelector('.content-area > aside')?.offsetWidth || 0
|
|
42
|
-
const sectionPaneWidth =
|
|
43
|
-
document.querySelector('.slide-pane')?.offsetWidth || 0
|
|
44
|
-
return sectionPaneWidth - sidebarWidth
|
|
45
|
-
},
|
|
46
|
-
mustPreviewScale() {
|
|
47
|
-
// case: the section / block pane is not opened
|
|
48
|
-
if (!this.currentSection) return false
|
|
49
|
-
|
|
50
|
-
// case: there is enough width for the tablet viewport, no need to scale down
|
|
51
|
-
if (this.hasEnoughWidthForTablet) return false
|
|
52
|
-
|
|
53
|
-
// case: there is enough width for the mobile viewport, no need to scale down
|
|
54
|
-
if (this.hasEnoughWidthForMobile) return false
|
|
55
|
-
|
|
56
|
-
return true // desktop device
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
import i18n from '@/plugins/i18n.js'
|
|
3
|
-
import { numberToHumanSize, truncate, formatPath } from '@/misc/utils'
|
|
4
|
-
|
|
5
|
-
Vue.filter('numberToHumanSize', (size) => numberToHumanSize(size, i18n))
|
|
6
|
-
Vue.filter('truncate', truncate)
|
|
7
|
-
Vue.filter('formatPath', formatPath)
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
import VueRouter from 'vue-router'
|
|
3
|
-
import routes from './routes'
|
|
4
|
-
import store from '@/store'
|
|
5
|
-
import { hasAnyChanged } from '@/misc/utils'
|
|
6
|
-
|
|
7
|
-
Vue.use(VueRouter)
|
|
8
|
-
|
|
9
|
-
const router = new VueRouter({
|
|
10
|
-
mode: 'history',
|
|
11
|
-
base: window.baseUrl,
|
|
12
|
-
routes,
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
router.beforeEach((to, from, next) => {
|
|
16
|
-
// The router hasn't found a component to display so get back
|
|
17
|
-
// to the screen without any UI drawer opened.
|
|
18
|
-
if (to.matched.length === 0)
|
|
19
|
-
return next({
|
|
20
|
-
name: 'editPage',
|
|
21
|
-
params: {
|
|
22
|
-
pageId: store.state.page.pathHash[store.state.locale],
|
|
23
|
-
locale: store.state.locale,
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
// When an user wants to edit another page or to edit the current page
|
|
28
|
-
// in a different locale, the router detects it and dispatch the new
|
|
29
|
-
// page information to the Vuex store.
|
|
30
|
-
// Important: we don't do that at startup because we already have the current page
|
|
31
|
-
// and locale in the state.
|
|
32
|
-
if (hasAnyChanged(to.params, from.params, 'pageId', 'locale'))
|
|
33
|
-
store.dispatch('editPage', {
|
|
34
|
-
id: to.params.pageId,
|
|
35
|
-
locale: to.params.locale,
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
next()
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
export default router
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import AppLayout from '@/layouts/app.vue'
|
|
2
|
-
import PagePreview from '@/views/page-preview.vue'
|
|
3
|
-
import SlidePane from '@/views/slide-pane.vue'
|
|
4
|
-
import SlidePane2 from '@/views/slide-pane2.vue'
|
|
5
|
-
import pageRoutes from './page'
|
|
6
|
-
import sectionRoutes from './section'
|
|
7
|
-
import sectionBlockRoutes from './section-block'
|
|
8
|
-
import styleRoutes from './style'
|
|
9
|
-
|
|
10
|
-
export default [
|
|
11
|
-
{
|
|
12
|
-
path: '/',
|
|
13
|
-
name: 'home',
|
|
14
|
-
redirect: '/index',
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
path: '/:locale/:pageId',
|
|
18
|
-
component: AppLayout,
|
|
19
|
-
children: [
|
|
20
|
-
{
|
|
21
|
-
path: '',
|
|
22
|
-
name: 'editPage',
|
|
23
|
-
components: {
|
|
24
|
-
default: PagePreview,
|
|
25
|
-
},
|
|
26
|
-
props: { default: true },
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
path: '/:locale/:pageId/_',
|
|
32
|
-
component: AppLayout,
|
|
33
|
-
children: [
|
|
34
|
-
{
|
|
35
|
-
path: 'foo-test',
|
|
36
|
-
name: 'test',
|
|
37
|
-
components: {
|
|
38
|
-
default: PagePreview,
|
|
39
|
-
'slide-pane': SlidePane,
|
|
40
|
-
},
|
|
41
|
-
props: { default: true },
|
|
42
|
-
meta: { hidingSidebar: true },
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
path: 'foo-test2',
|
|
46
|
-
name: 'test2',
|
|
47
|
-
components: {
|
|
48
|
-
default: PagePreview,
|
|
49
|
-
'slide-pane': SlidePane2,
|
|
50
|
-
},
|
|
51
|
-
props: { default: true },
|
|
52
|
-
},
|
|
53
|
-
...pageRoutes,
|
|
54
|
-
...sectionRoutes,
|
|
55
|
-
...sectionBlockRoutes,
|
|
56
|
-
...styleRoutes,
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
]
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import PagePreview from '@/views/page-preview.vue'
|
|
2
|
-
import PageList from '@/views/pages/index.vue'
|
|
3
|
-
import EditPage from '@/views/pages/edit.vue'
|
|
4
|
-
|
|
5
|
-
export default [
|
|
6
|
-
{
|
|
7
|
-
path: 'pages',
|
|
8
|
-
name: 'listPages',
|
|
9
|
-
components: {
|
|
10
|
-
default: PagePreview,
|
|
11
|
-
'slide-pane': PageList,
|
|
12
|
-
},
|
|
13
|
-
props: {
|
|
14
|
-
'slide-pane': true,
|
|
15
|
-
default: true,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
path: 'editSettings',
|
|
20
|
-
name: 'editPageSettings',
|
|
21
|
-
components: {
|
|
22
|
-
default: PagePreview,
|
|
23
|
-
'slide-pane': EditPage,
|
|
24
|
-
},
|
|
25
|
-
props: {
|
|
26
|
-
'slide-pane': true,
|
|
27
|
-
default: true,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
]
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import PagePreview from '@/views/page-preview.vue'
|
|
2
|
-
import ContentPane from '@/views/content-pane.vue'
|
|
3
|
-
|
|
4
|
-
export default [
|
|
5
|
-
{
|
|
6
|
-
path: 'sectionBlock/:sectionBlockId',
|
|
7
|
-
name: 'editSectionBlock',
|
|
8
|
-
components: {
|
|
9
|
-
default: PagePreview,
|
|
10
|
-
'slide-pane': ContentPane,
|
|
11
|
-
},
|
|
12
|
-
props: {
|
|
13
|
-
'slide-pane': true,
|
|
14
|
-
default: true,
|
|
15
|
-
},
|
|
16
|
-
meta: { hidingSidebar: true },
|
|
17
|
-
children: [
|
|
18
|
-
{
|
|
19
|
-
path: 'setting/:settingId',
|
|
20
|
-
name: 'editSectionBlockSetting',
|
|
21
|
-
components: {
|
|
22
|
-
default: PagePreview,
|
|
23
|
-
'slide-pane': ContentPane,
|
|
24
|
-
},
|
|
25
|
-
meta: { hidingSidebar: true },
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
]
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import PagePreview from '@/views/page-preview.vue'
|
|
2
|
-
import ContentPane from '@/views/content-pane.vue'
|
|
3
|
-
import SectionAddPane from '@/views/sections/add-pane.vue'
|
|
4
|
-
import SectionListPane from '@/views/sections/list-pane.vue'
|
|
5
|
-
|
|
6
|
-
export default [
|
|
7
|
-
{
|
|
8
|
-
path: 'add-section',
|
|
9
|
-
name: 'addSection',
|
|
10
|
-
components: {
|
|
11
|
-
default: PagePreview,
|
|
12
|
-
'slide-pane': SectionAddPane,
|
|
13
|
-
},
|
|
14
|
-
props: {
|
|
15
|
-
'slide-pane': true,
|
|
16
|
-
default: true,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
path: 'add-section/:sectionId',
|
|
21
|
-
name: 'addSectionAfter',
|
|
22
|
-
components: {
|
|
23
|
-
default: PagePreview,
|
|
24
|
-
'slide-pane': SectionAddPane,
|
|
25
|
-
},
|
|
26
|
-
props: {
|
|
27
|
-
'slide-pane': true,
|
|
28
|
-
default: true,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
path: 'sections',
|
|
33
|
-
name: 'listSections',
|
|
34
|
-
components: {
|
|
35
|
-
default: PagePreview,
|
|
36
|
-
'slide-pane': SectionListPane,
|
|
37
|
-
},
|
|
38
|
-
props: {
|
|
39
|
-
'slide-pane': true,
|
|
40
|
-
default: true,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
path: 'section/:sectionId',
|
|
45
|
-
name: 'editSection',
|
|
46
|
-
components: {
|
|
47
|
-
default: PagePreview,
|
|
48
|
-
'slide-pane': ContentPane,
|
|
49
|
-
},
|
|
50
|
-
props: {
|
|
51
|
-
'slide-pane': true,
|
|
52
|
-
default: true,
|
|
53
|
-
},
|
|
54
|
-
meta: { hidingSidebar: true },
|
|
55
|
-
children: [
|
|
56
|
-
{
|
|
57
|
-
path: 'setting/:settingId',
|
|
58
|
-
name: 'editSectionSetting',
|
|
59
|
-
components: {
|
|
60
|
-
default: PagePreview,
|
|
61
|
-
'slide-pane': ContentPane,
|
|
62
|
-
},
|
|
63
|
-
meta: { hidingSidebar: true },
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
},
|
|
67
|
-
]
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import PagePreview from '@/views/page-preview.vue'
|
|
2
|
-
import EditStylePane from '@/views/style/edit-pane.vue'
|
|
3
|
-
|
|
4
|
-
export default [
|
|
5
|
-
{
|
|
6
|
-
path: 'style',
|
|
7
|
-
name: 'editStyle',
|
|
8
|
-
components: {
|
|
9
|
-
default: PagePreview,
|
|
10
|
-
'slide-pane': EditStylePane,
|
|
11
|
-
},
|
|
12
|
-
props: {
|
|
13
|
-
'slide-pane': true,
|
|
14
|
-
default: true,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
]
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import buildService from '../page'
|
|
2
|
-
import MockedServices from '@/spec/__mocks__/services'
|
|
3
|
-
import { page } from '@/spec/__mocks__/page'
|
|
4
|
-
|
|
5
|
-
describe('PageService', () => {
|
|
6
|
-
let service = null
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
service = buildService(MockedServices.api)
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
describe('#normalize', () => {
|
|
13
|
-
it('takes a Page object and normalize it into entities', () => {
|
|
14
|
-
const output = service.normalize(page)
|
|
15
|
-
expect(output.result).toEqual(1)
|
|
16
|
-
expect(Object.keys(output.entities.sections)).toStrictEqual([
|
|
17
|
-
'GrYZW-VP',
|
|
18
|
-
'8hKSujtd',
|
|
19
|
-
'xM6f-kyh',
|
|
20
|
-
])
|
|
21
|
-
expect(Object.keys(output.entities.blocks)).toStrictEqual([
|
|
22
|
-
'RiEo8C3f',
|
|
23
|
-
'P1fGieWs',
|
|
24
|
-
'sDo-Dg85',
|
|
25
|
-
'K-C_zRcH',
|
|
26
|
-
'fNIEuzF0',
|
|
27
|
-
'UVGOFAI5',
|
|
28
|
-
'K3Xotn7f',
|
|
29
|
-
'Pst6WyU0',
|
|
30
|
-
])
|
|
31
|
-
expect(output.entities.page['1'].sections).toStrictEqual([
|
|
32
|
-
'GrYZW-VP',
|
|
33
|
-
'8hKSujtd',
|
|
34
|
-
'xM6f-kyh',
|
|
35
|
-
])
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
})
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import * as service from '../section'
|
|
2
|
-
import {
|
|
3
|
-
simpleContentSection,
|
|
4
|
-
navContentSection,
|
|
5
|
-
} from '@/spec/__mocks__/section'
|
|
6
|
-
import { theme } from '@/spec/__mocks__/theme'
|
|
7
|
-
|
|
8
|
-
describe('SectionService', () => {
|
|
9
|
-
describe('#normalize', () => {
|
|
10
|
-
it('takes a Section object and normalize it into entities', () => {
|
|
11
|
-
const output = service.normalize(simpleContentSection)
|
|
12
|
-
// console.log(JSON.stringify(output))
|
|
13
|
-
expect(output.result).toEqual('NEW-CONTENT-1')
|
|
14
|
-
expect(Object.keys(output.entities.sections)).toStrictEqual([
|
|
15
|
-
'NEW-CONTENT-1',
|
|
16
|
-
])
|
|
17
|
-
})
|
|
18
|
-
it('takes a Section object with blocks and normalize it into entities', () => {
|
|
19
|
-
const output = service.normalize(navContentSection)
|
|
20
|
-
// console.log(JSON.stringify(output))
|
|
21
|
-
expect(output.result).toEqual('NEW-NAV-CONTENT-1')
|
|
22
|
-
expect(Object.keys(output.entities.sections)).toStrictEqual([
|
|
23
|
-
'NEW-NAV-CONTENT-1',
|
|
24
|
-
])
|
|
25
|
-
expect(Object.keys(output.entities.blocks)).toStrictEqual([
|
|
26
|
-
'RiEo8C3f',
|
|
27
|
-
'P1fGieWs',
|
|
28
|
-
'sDo-Dg85',
|
|
29
|
-
'K-C_zRcH',
|
|
30
|
-
])
|
|
31
|
-
})
|
|
32
|
-
})
|
|
33
|
-
describe('#getSectionLabel', () => {
|
|
34
|
-
it('returns the label of the section', () => {
|
|
35
|
-
const label = service.getSectionLabel(simpleContentSection, theme.sections[0])
|
|
36
|
-
expect(label).toEqual('preTitle')
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
})
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import axios from 'axios'
|
|
2
|
-
import { camelizeKeys } from '@/misc/utils'
|
|
3
|
-
|
|
4
|
-
let siteHandle = null
|
|
5
|
-
let locale = null
|
|
6
|
-
|
|
7
|
-
export const setSiteHandle = (handle) => (siteHandle = handle)
|
|
8
|
-
export const setLocale = (newLocale) => (locale = newLocale)
|
|
9
|
-
|
|
10
|
-
const token = document.querySelector('[name=csrf-token]').content
|
|
11
|
-
axios.defaults.headers.common['X-CSRF-TOKEN'] = token
|
|
12
|
-
|
|
13
|
-
const api = axios.create({
|
|
14
|
-
baseURL: window.apiBaseUrl,
|
|
15
|
-
timeout: 50000,
|
|
16
|
-
headers: {
|
|
17
|
-
'Content-Type': 'application/json',
|
|
18
|
-
Accept: 'application/json',
|
|
19
|
-
},
|
|
20
|
-
transformResponse(data) {
|
|
21
|
-
// for "security" (even if the Rails API already camelcases the JSON),
|
|
22
|
-
// we also camelcase the response in the Editor.
|
|
23
|
-
// console.log('[DEBUG] API response', data)
|
|
24
|
-
return data ? camelizeKeys(JSON.parse(data)) : {}
|
|
25
|
-
},
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
api.interceptors.request.use(
|
|
29
|
-
(config) => {
|
|
30
|
-
config.headers['X-MAGLEV-SITE-HANDLE'] = siteHandle
|
|
31
|
-
config.headers['X-MAGLEV-LOCALE'] = locale
|
|
32
|
-
return config
|
|
33
|
-
},
|
|
34
|
-
(error) => Promise.reject(error),
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
export const get = api.get
|
|
38
|
-
export const post = api.post
|
|
39
|
-
export const put = api.put
|
|
40
|
-
export const destroy = api.delete
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const encodeToTree = (blocks, parentId) => {
|
|
2
|
-
return blocks
|
|
3
|
-
.filter((block) => block.parentId === parentId)
|
|
4
|
-
.map((block) => ({
|
|
5
|
-
sectionBlock: { ...block },
|
|
6
|
-
children: encodeToTree(blocks, block.id),
|
|
7
|
-
}))
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const decodeTree = (tree, parentId) => {
|
|
11
|
-
return tree
|
|
12
|
-
.map((treeNode) => {
|
|
13
|
-
return [].concat(
|
|
14
|
-
{ ...treeNode.sectionBlock, parentId },
|
|
15
|
-
decodeTree(treeNode.children, treeNode.sectionBlock.id),
|
|
16
|
-
)
|
|
17
|
-
})
|
|
18
|
-
.flat()
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const filterRoot = (blockDefinitions, content) => {
|
|
22
|
-
return blockDefinitions.filter((block) => {
|
|
23
|
-
const count = content.filter(({ type }) => block.type === type).length
|
|
24
|
-
return block.root && (block.limit === -1 || block.limit > count)
|
|
25
|
-
})
|
|
26
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export default (api) => ({
|
|
2
|
-
findAll: (collectionId, filters) => {
|
|
3
|
-
console.log(
|
|
4
|
-
`[CollectionItem] Fetching all the items of ${collectionId}`,
|
|
5
|
-
filters,
|
|
6
|
-
)
|
|
7
|
-
const options = { params: filters || {} }
|
|
8
|
-
return api
|
|
9
|
-
.get(`/collections/${collectionId}`, options)
|
|
10
|
-
.then(({ data }) => data)
|
|
11
|
-
},
|
|
12
|
-
findOne: (collectionId, id) => {
|
|
13
|
-
console.log(
|
|
14
|
-
`[CollectionItem] Fetching the item ${id} of ${collectionId}`,
|
|
15
|
-
)
|
|
16
|
-
return api
|
|
17
|
-
.get(`/collections/${collectionId}/${id}`)
|
|
18
|
-
.then(({ data }) => data)
|
|
19
|
-
},
|
|
20
|
-
})
|