Module: Maglev
- Defined in:
- lib/maglev/i18n.rb,
lib/maglev.rb,
lib/maglev/config.rb,
lib/maglev/engine.rb,
lib/maglev/errors.rb,
lib/maglev/version.rb,
lib/maglev/migration.rb,
app/models/maglev/page.rb,
app/models/maglev/site.rb,
app/models/maglev/asset.rb,
app/models/maglev/theme.rb,
app/models/maglev/section.rb,
lib/maglev/active_storage.rb,
lib/maglev/reserved_paths.rb,
app/models/maglev/page_path.rb,
app/models/maglev/static_page.rb,
app/types/maglev/locales_type.rb,
lib/maglev/preview_constraint.rb,
app/services/maglev/clone_page.rb,
app/services/maglev/fetch_page.rb,
app/services/maglev/fetch_site.rb,
app/components/maglev/inspector.rb,
app/jobs/maglev/application_job.rb,
app/services/maglev/fetch_style.rb,
app/services/maglev/fetch_theme.rb,
app/services/maglev/setup_pages.rb,
app/components/maglev/tag_helper.rb,
app/lib/maglev/form/form_builder.rb,
app/services/maglev/get_base_url.rb,
app/services/maglev/search_pages.rb,
app/helpers/maglev/sitemap_helper.rb,
app/lib/maglev/form/inputs/select.rb,
app/services/maglev/app_container.rb,
app/services/maglev/generate_site.rb,
app/components/maglev/content/base.rb,
app/components/maglev/content/icon.rb,
app/components/maglev/content/link.rb,
app/components/maglev/content/text.rb,
app/components/maglev/content/void.rb,
app/services/maglev/extract_locale.rb,
lib/maglev/theme_filesystem_loader.rb,
app/components/maglev/content/color.rb,
app/components/maglev/content/image.rb,
app/lib/maglev/form/inputs/combobox.rb,
app/lib/maglev/form/inputs/richtext.rb,
app/lib/maglev/form/inputs/textarea.rb,
app/services/maglev/add_site_locale.rb,
app/services/maglev/publish_service.rb,
app/components/maglev/base_component.rb,
app/components/maglev/content/select.rb,
app/components/maglev/page_component.rb,
app/lib/maglev/form/inputs/check_box.rb,
app/models/maglev/application_record.rb,
app/components/maglev/block_component.rb,
app/components/maglev/content/builder.rb,
app/helpers/maglev/application_helper.rb,
app/lib/maglev/form/inputs/text_field.rb,
app/mailers/maglev/application_mailer.rb,
app/models/maglev/content/editor_link.rb,
app/services/maglev/get_page_fullpath.rb,
app/services/maglev/get_page_sections.rb,
lib/generators/maglev/theme_generator.rb,
app/components/maglev/content/checkbox.rb,
app/controllers/maglev/site_controller.rb,
app/helpers/maglev/admin/themes_helper.rb,
app/helpers/maglev/editor/pages_helper.rb,
app/helpers/maglev/page_preview_helper.rb,
app/lib/maglev/form/inputs/image_field.rb,
app/services/maglev/fetch_static_pages.rb,
app/services/maglev/fetch_theme_layout.rb,
lib/maglev/active_storage/serving_blob.rb,
app/components/maglev/section_component.rb,
app/models/concerns/maglev/translatable.rb,
app/models/maglev/content/block_content.rb,
app/services/maglev/change_site_locales.rb,
app/services/maglev/create_page_service.rb,
app/services/maglev/fetch_sections_path.rb,
app/services/maglev/remove_section_type.rb,
app/services/maglev/rename_section_type.rb,
lib/commands/maglev/create_site_command.rb,
lib/generators/maglev/install_generator.rb,
lib/generators/maglev/section_generator.rb,
app/lib/maglev/turbo/streams/tag_builder.rb,
app/models/maglev/sections_content_store.rb,
app/validators/maglev/presence_validator.rb,
lib/commands/maglev/publish_site_command.rb,
app/controllers/maglev/sitemap_controller.rb,
app/helpers/maglev/editor/settings_helper.rb,
app/models/maglev/content/section_content.rb,
app/models/maglev/content/setting_content.rb,
app/services/maglev/persist_style_service.rb,
app/services/maglev/reset_section_content.rb,
app/components/maglev/uikit/base_component.rb,
app/components/maglev/uikit/icon_component.rb,
app/components/maglev/uikit/tabs_component.rb,
app/services/maglev/fetch_collection_items.rb,
app/services/maglev/get_page_section_names.rb,
app/validators/maglev/collection_validator.rb,
lib/commands/maglev/sections/reset_command.rb,
app/components/maglev/uikit/badge_component.rb,
app/components/maglev/uikit/modal_component.rb,
app/services/maglev/has_unpublished_changes.rb,
lib/commands/maglev/sections/remove_command.rb,
lib/commands/maglev/sections/rename_command.rb,
app/controllers/concerns/maglev/json_concern.rb,
app/components/maglev/content/collection_item.rb,
app/components/maglev/editor/setting_registry.rb,
app/controllers/maglev/application_controller.rb,
app/controllers/maglev/editor/base_controller.rb,
app/controllers/maglev/editor/home_controller.rb,
app/components/maglev/uikit/dropdown_component.rb,
app/controllers/concerns/maglev/errors_concern.rb,
app/controllers/maglev/assets/proxy_controller.rb,
app/controllers/maglev/editor/icons_controller.rb,
app/controllers/maglev/editor/links_controller.rb,
app/controllers/maglev/editor/pages_controller.rb,
app/controllers/maglev/editor/style_controller.rb,
app/controllers/maglev/page_preview_controller.rb,
app/services/maglev/discard_page_draft_service.rb,
app/services/maglev/persist_section_screenshot.rb,
app/components/maglev/uikit/form/link_component.rb,
app/components/maglev/uikit/list/list_component.rb,
app/controllers/maglev/editor/assets_controller.rb,
app/helpers/maglev/editor/section_blocks_helper.rb,
app/services/maglev/content/add_section_service.rb,
lib/commands/maglev/change_site_locales_command.rb,
app/components/maglev/uikit/pagination_component.rb,
app/controllers/concerns/maglev/fetchers_concern.rb,
app/controllers/concerns/maglev/services_concern.rb,
app/services/maglev/fetch_section_screenshot_url.rb,
app/components/maglev/uikit/form/select_component.rb,
app/components/maglev/uikit/icon_button_component.rb,
app/components/maglev/uikit/page_layout_component.rb,
app/controllers/concerns/maglev/rendering_concern.rb,
app/controllers/maglev/editor/sections_controller.rb,
app/helpers/maglev/admin/sections/previews_helper.rb,
app/services/maglev/fetch_section_screenshot_path.rb,
app/components/maglev/uikit/button_group_component.rb,
app/controllers/concerns/maglev/flash_i18n_concern.rb,
app/services/maglev/content/delete_section_service.rb,
app/services/maglev/content/update_section_service.rb,
app/components/maglev/uikit/form/checkbox_component.rb,
app/components/maglev/uikit/form/combobox_component.rb,
app/components/maglev/uikit/form/richtext_component.rb,
app/components/maglev/uikit/form/textarea_component.rb,
app/components/maglev/uikit/menu_dropdown_component.rb,
app/controllers/concerns/maglev/back_action_concern.rb,
app/controllers/concerns/maglev/resource_id_concern.rb,
app/components/maglev/editor/settings/base_component.rb,
app/components/maglev/uikit/device_toggler_component.rb,
app/components/maglev/uikit/form/link/base_component.rb,
app/components/maglev/uikit/list/list_item_component.rb,
app/controllers/concerns/maglev/editor/turbo_concern.rb,
app/controllers/maglev/editor/pages/clone_controller.rb,
app/controllers/maglev/editor/publication_controller.rb,
app/services/concerns/maglev/content/helpers_concern.rb,
app/components/maglev/editor/settings_group_component.rb,
app/components/maglev/uikit/form/icon_field_component.rb,
app/components/maglev/uikit/form/text_field_component.rb,
app/components/maglev/uikit/locale_switcher_component.rb,
app/controllers/concerns/maglev/editor/errors_concern.rb,
app/services/maglev/content/add_section_block_service.rb,
app/components/maglev/uikit/breadcrumbs/link_component.rb,
app/components/maglev/uikit/collapsible/item_component.rb,
app/components/maglev/uikit/form/color_field_component.rb,
app/components/maglev/uikit/form/image_field_component.rb,
app/components/maglev/uikit/form/search_form_component.rb,
app/components/maglev/uikit/well/simple_well_component.rb,
app/controllers/concerns/maglev/authentication_concern.rb,
app/controllers/concerns/maglev/content_locale_concern.rb,
app/components/maglev/uikit/app_layout/layout_component.rb,
app/components/maglev/uikit/app_layout/topbar_component.rb,
app/controllers/maglev/editor/combobox/pages_controller.rb,
app/controllers/maglev/editor/section_blocks_controller.rb,
app/services/maglev/content/sort_section_blocks_service.rb,
app/services/maglev/get_published_page_sections_service.rb,
app/components/maglev/uikit/app_layout/sidebar_component.rb,
app/components/maglev/uikit/form/combobox/list_component.rb,
app/components/maglev/uikit/form/link/url_link_component.rb,
app/components/maglev/uikit/image_library/card_component.rb,
app/components/maglev/uikit/image_library/list_component.rb,
app/components/maglev/uikit/list/insert_button_component.rb,
app/controllers/maglev/published_page_preview_controller.rb,
app/services/maglev/content/delete_section_block_service.rb,
app/services/maglev/content/update_section_block_service.rb,
app/components/maglev/editor/settings/hint/hint_component.rb,
app/components/maglev/editor/settings/icon/icon_component.rb,
app/components/maglev/editor/settings/link/link_component.rb,
app/components/maglev/editor/settings/text/text_component.rb,
app/components/maglev/uikit/form/link/page_link_component.rb,
app/models/concerns/maglev/content/enhanced_value_concern.rb,
app/components/maglev/uikit/form/combobox/option_component.rb,
app/components/maglev/uikit/form/link/email_link_component.rb,
app/components/maglev/uikit/form/richtext/button_component.rb,
app/components/maglev/editor/settings/color/color_component.rb,
app/components/maglev/editor/settings/image/image_component.rb,
app/components/maglev/uikit/form/richtext/toolbar_component.rb,
app/components/maglev/uikit/page_actions_dropdown_component.rb,
app/controllers/concerns/maglev/editor/preview_urls_concern.rb,
app/controllers/concerns/maglev/standalone_sections_concern.rb,
app/components/maglev/uikit/app_layout/topbar/logo_component.rb,
app/components/maglev/uikit/image_library/uploader_component.rb,
app/components/maglev/uikit/section_toolbar/bottom_component.rb,
app/controllers/maglev/editor/pages/discard_draft_controller.rb,
app/components/maglev/editor/settings/select/select_component.rb,
app/components/maglev/editor/settings/text/richtext_component.rb,
app/components/maglev/editor/settings/text/textarea_component.rb,
app/components/maglev/uikit/app_layout/sidebar/link_component.rb,
app/components/maglev/uikit/breadcrumbs/breadcrumbs_component.rb,
app/components/maglev/uikit/collapsible/collapsible_component.rb,
app/controllers/concerns/maglev/user_interface_locale_concern.rb,
app/controllers/maglev/assets/active_storage_proxy_controller.rb,
app/components/maglev/editor/settings/divider/divider_component.rb,
app/components/maglev/uikit/form/link/static_page_link_component.rb,
app/components/maglev/uikit/form/richtext/block_button_component.rb,
app/components/maglev/uikit/form/richtext/button_group_component.rb,
app/components/maglev/editor/settings/checkbox/checkbox_component.rb,
app/components/maglev/uikit/app_layout/topbar/page_info_component.rb,
app/controllers/maglev/editor/combobox/collection_items_controller.rb,
app/components/maglev/uikit/section_toolbar/section_toolbar_component.rb,
app/components/maglev/uikit/section_toolbar/top_left_corner_component.rb,
app/components/maglev/uikit/section_toolbar/top_right_corner_component.rb,
app/components/maglev/editor/settings/collection_item/collection_item_component.rb
Overview
rubocop:disable Metrics/ModuleLength
Defined Under Namespace
Modules: ActiveStorage, Admin, ApplicationHelper, Assets, AuthenticationConcern, BackActionConcern, Content, ContentLocaleConcern, Editor, Errors, ErrorsConcern, FetchersConcern, FlashI18nConcern, Form, I18n, Inspector, JsonConcern, Migration, PagePreviewHelper, RenderingConcern, ResourceIdConcern, Sections, SectionsConcern, ServicesConcern, SitemapHelper, StandaloneSectionsConcern, TagHelper, Translatable, Turbo, Uikit, UserInterfaceLocaleConcern Classes: AddSiteLocale, AppContainer, ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, Asset, BaseComponent, BlockComponent, ChangeSiteLocales, ChangeSiteLocalesCommand, ClonePage, CollectionValidator, Config, CreatePageService, CreateSiteCommand, DiscardPageDraftService, Engine, ExtractLocale, FetchCollectionItems, FetchPage, FetchSectionScreenshotPath, FetchSectionScreenshotUrl, FetchSectionsPath, FetchSite, FetchStaticPages, FetchStyle, FetchTheme, FetchThemeLayout, GenerateSite, GetBaseUrl, GetPageFullpath, GetPageSectionNames, GetPageSections, GetPublishedPageSectionsService, HasUnpublishedChanges, InstallGenerator, LocalesType, Page, PageComponent, PagePath, PagePreviewController, PersistSectionScreenshot, PersistStyleService, PresenceValidator, PreviewConstraint, PublishService, PublishSiteCommand, PublishedPagePreviewController, RemoveSectionType, RenameSectionType, ReservedPaths, ResetSectionContent, SearchPages, Section, SectionComponent, SectionGenerator, SectionsContentStore, ServiceContext, SetupPages, Site, SiteController, SitemapController, StaticPage, Theme, ThemeFilesystemLoader, ThemeGenerator
Constant Summary collapse
- ROOT_PATH =
Pathname.new(File.join(__dir__, '..'))
- DEFAULT_PAGINATION =
{ pages: -1, assets: 16 }.freeze
- VERSION =
'3.0.0'
Class Attribute Summary collapse
-
.local_themes ⇒ Object
Returns the value of attribute local_themes.
-
.theme_reloader_disabled ⇒ Object
Returns the value of attribute theme_reloader_disabled.
Class Method Summary collapse
-
.config ⇒ Object
rubocop:disable Metrics/MethodLength, Metrics/AbcSize.
- .config_klass ⇒ Object
-
.configure ⇒ Object
rubocop:enable Metrics/MethodLength, Metrics/AbcSize.
-
.disable_theme_reloader ⇒ Object
disable the theme reloader which is required by the Maglev SaaS plugin.
- .parent_controller_class ⇒ Object
- .services(overrides = {}) ⇒ Object
- .theme_reloader_enabled? ⇒ Boolean
- .uploader ⇒ Object
- .uploader_proxy_controller_name ⇒ Object
- .uuid_as_primary_key? ⇒ Boolean
Class Attribute Details
.local_themes ⇒ Object
Returns the value of attribute local_themes.
21 22 23 |
# File 'lib/maglev.rb', line 21 def local_themes @local_themes end |
.theme_reloader_disabled ⇒ Object
Returns the value of attribute theme_reloader_disabled.
21 22 23 |
# File 'lib/maglev.rb', line 21 def theme_reloader_disabled @theme_reloader_disabled end |
Class Method Details
.config ⇒ Object
rubocop:disable Metrics/MethodLength, Metrics/AbcSize
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/maglev.rb', line 24 def config @config ||= config_klass.new.tap do |c| c.title = 'Maglev - EDITOR' c.favicon = nil c.logo = nil c.primary_color = '#040712' c.uploader = :active_storage c.site_publishable = false c.preview_host = nil c.asset_host = Rails.application.config.asset_host c.ui_locale = nil c.back_action = nil c.services = {} c.default_site_locales = [{ label: 'English', prefix: 'en' }] c.is_authenticated = ->(_site) { !Rails.env.production? } c.admin_username = nil # legacy config c.admin_password = nil # legacy config c.static_pages = [] c.reserved_paths = [] c.parent_controller = 'ApplicationController' c.tailwindcss_folders = [] c.pagination = ::Maglev::DEFAULT_PAGINATION.dup end end |
.config_klass ⇒ Object
96 97 98 |
# File 'lib/maglev.rb', line 96 def config_klass ::Maglev::Config end |
.configure ⇒ Object
rubocop:enable Metrics/MethodLength, Metrics/AbcSize
50 51 52 53 54 55 56 |
# File 'lib/maglev.rb', line 50 def configure config.tap do yield(config) config.reserved_paths = Maglev::ReservedPaths.new(config.reserved_paths) require_relative 'maglev/active_storage' if config.uploader == :active_storage end end |
.disable_theme_reloader ⇒ Object
disable the theme reloader which is required by the Maglev SaaS plugin
88 89 90 |
# File 'lib/maglev.rb', line 88 def disable_theme_reloader @theme_reloader_disabled = true end |
.parent_controller_class ⇒ Object
58 59 60 |
# File 'lib/maglev.rb', line 58 def parent_controller_class (config.parent_controller.presence || 'ApplicationController').constantize end |
.services(overrides = {}) ⇒ Object
76 77 78 |
# File 'lib/maglev.rb', line 76 def services(overrides = {}) ::Maglev::AppContainer.new(config.services.merge(overrides)).call end |
.theme_reloader_enabled? ⇒ Boolean
92 93 94 |
# File 'lib/maglev.rb', line 92 def theme_reloader_enabled? !@theme_reloader_disabled end |
.uploader ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/maglev.rb', line 62 def uploader case config.uploader when Symbol then const_get("::Maglev::#{config.uploader.to_s.classify}") when String then const_get(config.uploader) when Class then config.uploader else raise "Invalid or not set uploader: #{config.uploader}" end end |
.uploader_proxy_controller_name ⇒ Object
72 73 74 |
# File 'lib/maglev.rb', line 72 def uploader_proxy_controller_name config.uploader == :active_storage ? 'assets/active_storage_proxy' : 'assets/proxy' end |
.uuid_as_primary_key? ⇒ Boolean
80 81 82 83 84 85 |
# File 'lib/maglev.rb', line 80 def uuid_as_primary_key? return @uuid_as_primary_key unless @uuid_as_primary_key.nil? config = Rails.configuration.generators @uuid_as_primary_key = config.[config.orm][:primary_key_type] == :uuid end |