maglevcms 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +27 -0
- data/Rakefile +34 -0
- data/app/assets/config/maglev_manifest.js +1 -0
- data/app/assets/images/maglev/favicon.png +0 -0
- data/app/assets/images/maglev/logo.png +0 -0
- data/app/assets/stylesheets/maglev/application.css +15 -0
- data/app/components/maglev/base_component.rb +54 -0
- data/app/components/maglev/block_component.rb +46 -0
- data/app/components/maglev/content/base.rb +52 -0
- data/app/components/maglev/content/builder.rb +28 -0
- data/app/components/maglev/content/checkbox.rb +19 -0
- data/app/components/maglev/content/collection_item.rb +29 -0
- data/app/components/maglev/content/color.rb +20 -0
- data/app/components/maglev/content/icon.rb +26 -0
- data/app/components/maglev/content/image.rb +55 -0
- data/app/components/maglev/content/link.rb +61 -0
- data/app/components/maglev/content/select.rb +8 -0
- data/app/components/maglev/content/text.rb +25 -0
- data/app/components/maglev/page_component.rb +44 -0
- data/app/components/maglev/section_component.rb +96 -0
- data/app/components/maglev/tag_helper.rb +43 -0
- data/app/controllers/concerns/maglev/authentication_concern.rb +31 -0
- data/app/controllers/concerns/maglev/back_action_concern.rb +30 -0
- data/app/controllers/concerns/maglev/content_locale_concern.rb +26 -0
- data/app/controllers/concerns/maglev/fetchers_concern.rb +108 -0
- data/app/controllers/concerns/maglev/json_concern.rb +21 -0
- data/app/controllers/concerns/maglev/rendering_concern.rb +40 -0
- data/app/controllers/concerns/maglev/services_concern.rb +39 -0
- data/app/controllers/concerns/maglev/standalone_sections_concern.rb +28 -0
- data/app/controllers/concerns/maglev/ui_locale_concern.rb +32 -0
- data/app/controllers/maglev/admin/base_controller.rb +21 -0
- data/app/controllers/maglev/admin/dashboard_controller.rb +11 -0
- data/app/controllers/maglev/admin/sections/previews_controller.rb +52 -0
- data/app/controllers/maglev/admin/sections/screenshots_controller.rb +17 -0
- data/app/controllers/maglev/admin/themes_controller.rb +19 -0
- data/app/controllers/maglev/api/assets_controller.rb +44 -0
- data/app/controllers/maglev/api/collection_items_controller.rb +14 -0
- data/app/controllers/maglev/api/page_clones_controller.rb +22 -0
- data/app/controllers/maglev/api/pages_controller.rb +65 -0
- data/app/controllers/maglev/api/publications_controller.rb +15 -0
- data/app/controllers/maglev/api/sites_controller.rb +21 -0
- data/app/controllers/maglev/api.rb +15 -0
- data/app/controllers/maglev/api_controller.rb +61 -0
- data/app/controllers/maglev/application_controller.rb +17 -0
- data/app/controllers/maglev/assets_controller.rb +10 -0
- data/app/controllers/maglev/editor_controller.rb +46 -0
- data/app/controllers/maglev/page_preview_controller.rb +53 -0
- data/app/helpers/maglev/admin/sections/previews_helper.rb +21 -0
- data/app/helpers/maglev/admin/themes_helper.rb +27 -0
- data/app/helpers/maglev/application_helper.rb +13 -0
- data/app/helpers/maglev/editor_helper.rb +78 -0
- data/app/helpers/maglev/page_preview_helper.rb +57 -0
- data/app/javascript/controllers/dropdown_controller.js +9 -0
- data/app/javascript/controllers/iframe_controller.js +14 -0
- data/app/javascript/controllers/index.js +11 -0
- data/app/javascript/controllers/screenshot_controller.js +37 -0
- data/app/javascript/editor/App.vue +43 -0
- data/app/javascript/editor/assets/remixicons/add-box-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/arrow-down-s-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/arrow-drop-left.svg +1 -0
- data/app/javascript/editor/assets/remixicons/arrow-drop-right.svg +1 -0
- data/app/javascript/editor/assets/remixicons/arrow-up-s-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/camera-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/check-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/close-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/computer-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/delete-bin-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/file-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-blockquote.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-bold.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-code.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-heading-2.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-heading-3.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-heading-4.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-italic.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-link-unlink.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-link.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-list-ordered.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-list-unordered.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-paragraph.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-strikethrough.svg +1 -0
- data/app/javascript/editor/assets/remixicons/format-underline.svg +1 -0
- data/app/javascript/editor/assets/remixicons/home-4-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/image-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/logout-box-r-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-add-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-alert-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-book-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-bug-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-close-circle-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-close-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-delete-column.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-delete-row.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-drop-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-external-link-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-eye-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-eye-off-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-file-copy-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-file-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-global-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-insert-column-left.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-insert-column-right.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-insert-row-bottom.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-insert-row-top.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-loader-4-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-mail-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-more-2-fill.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-pencil-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-play-list-add-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-settings-5-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-stack-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-table-2.svg +1 -0
- data/app/javascript/editor/assets/remixicons/ri-table-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/search-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/settings-4-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/smartphone-line.svg +1 -0
- data/app/javascript/editor/assets/remixicons/tablet-line.svg +1 -0
- data/app/javascript/editor/assets/zondicons/add-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/add-solid.svg +1 -0
- data/app/javascript/editor/assets/zondicons/adjust.svg +1 -0
- data/app/javascript/editor/assets/zondicons/airplane.svg +1 -0
- data/app/javascript/editor/assets/zondicons/album.svg +1 -0
- data/app/javascript/editor/assets/zondicons/align-center.svg +1 -0
- data/app/javascript/editor/assets/zondicons/align-justified.svg +1 -0
- data/app/javascript/editor/assets/zondicons/align-left.svg +1 -0
- data/app/javascript/editor/assets/zondicons/align-right.svg +1 -0
- data/app/javascript/editor/assets/zondicons/anchor.svg +1 -0
- data/app/javascript/editor/assets/zondicons/announcement.svg +1 -0
- data/app/javascript/editor/assets/zondicons/apparel.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-down.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-left.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-outline-down.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-outline-left.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-outline-right.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-outline-up.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-right.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-thick-down.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-thick-left.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-thick-right.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-thick-up.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-thin-down.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-thin-left.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-thin-right.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-thin-up.svg +1 -0
- data/app/javascript/editor/assets/zondicons/arrow-up.svg +1 -0
- data/app/javascript/editor/assets/zondicons/artist.svg +1 -0
- data/app/javascript/editor/assets/zondicons/at-symbol.svg +1 -0
- data/app/javascript/editor/assets/zondicons/attachment.svg +1 -0
- data/app/javascript/editor/assets/zondicons/backspace.svg +1 -0
- data/app/javascript/editor/assets/zondicons/backward-step.svg +1 -0
- data/app/javascript/editor/assets/zondicons/backward.svg +1 -0
- data/app/javascript/editor/assets/zondicons/badge.svg +1 -0
- data/app/javascript/editor/assets/zondicons/battery-full.svg +1 -0
- data/app/javascript/editor/assets/zondicons/battery-half.svg +1 -0
- data/app/javascript/editor/assets/zondicons/battery-low.svg +1 -0
- data/app/javascript/editor/assets/zondicons/beverage.svg +1 -0
- data/app/javascript/editor/assets/zondicons/block.svg +1 -0
- data/app/javascript/editor/assets/zondicons/bluetooth.svg +1 -0
- data/app/javascript/editor/assets/zondicons/bolt.svg +1 -0
- data/app/javascript/editor/assets/zondicons/book-reference.svg +1 -0
- data/app/javascript/editor/assets/zondicons/bookmark copy 2.svg +1 -0
- data/app/javascript/editor/assets/zondicons/bookmark copy 3.svg +1 -0
- data/app/javascript/editor/assets/zondicons/bookmark-outline-add.svg +1 -0
- data/app/javascript/editor/assets/zondicons/bookmark-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/bookmark.svg +1 -0
- data/app/javascript/editor/assets/zondicons/border-all.svg +1 -0
- data/app/javascript/editor/assets/zondicons/border-bottom.svg +1 -0
- data/app/javascript/editor/assets/zondicons/border-horizontal.svg +1 -0
- data/app/javascript/editor/assets/zondicons/border-inner.svg +1 -0
- data/app/javascript/editor/assets/zondicons/border-left.svg +1 -0
- data/app/javascript/editor/assets/zondicons/border-none.svg +1 -0
- data/app/javascript/editor/assets/zondicons/border-outer.svg +1 -0
- data/app/javascript/editor/assets/zondicons/border-right.svg +1 -0
- data/app/javascript/editor/assets/zondicons/border-top.svg +1 -0
- data/app/javascript/editor/assets/zondicons/border-vertical.svg +1 -0
- data/app/javascript/editor/assets/zondicons/box.svg +1 -0
- data/app/javascript/editor/assets/zondicons/brightness-down.svg +1 -0
- data/app/javascript/editor/assets/zondicons/brightness-up.svg +1 -0
- data/app/javascript/editor/assets/zondicons/browser-window-new.svg +1 -0
- data/app/javascript/editor/assets/zondicons/browser-window-open.svg +1 -0
- data/app/javascript/editor/assets/zondicons/browser-window.svg +1 -0
- data/app/javascript/editor/assets/zondicons/bug.svg +1 -0
- data/app/javascript/editor/assets/zondicons/buoy.svg +1 -0
- data/app/javascript/editor/assets/zondicons/calculator.svg +1 -0
- data/app/javascript/editor/assets/zondicons/calendar.svg +1 -0
- data/app/javascript/editor/assets/zondicons/camera.svg +1 -0
- data/app/javascript/editor/assets/zondicons/chart-bar.svg +1 -0
- data/app/javascript/editor/assets/zondicons/chart-pie.svg +1 -0
- data/app/javascript/editor/assets/zondicons/chart.svg +1 -0
- data/app/javascript/editor/assets/zondicons/chat-bubble-dots.svg +1 -0
- data/app/javascript/editor/assets/zondicons/checkmark-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/checkmark.svg +1 -0
- data/app/javascript/editor/assets/zondicons/cheveron-down.svg +1 -0
- data/app/javascript/editor/assets/zondicons/cheveron-left.svg +1 -0
- data/app/javascript/editor/assets/zondicons/cheveron-outline-down.svg +1 -0
- data/app/javascript/editor/assets/zondicons/cheveron-outline-left.svg +1 -0
- data/app/javascript/editor/assets/zondicons/cheveron-outline-right.svg +1 -0
- data/app/javascript/editor/assets/zondicons/cheveron-outline-up.svg +1 -0
- data/app/javascript/editor/assets/zondicons/cheveron-right.svg +1 -0
- data/app/javascript/editor/assets/zondicons/cheveron-up.svg +1 -0
- data/app/javascript/editor/assets/zondicons/clipboard.svg +1 -0
- data/app/javascript/editor/assets/zondicons/close-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/close-solid.svg +1 -0
- data/app/javascript/editor/assets/zondicons/close.svg +1 -0
- data/app/javascript/editor/assets/zondicons/cloud-upload.svg +1 -0
- data/app/javascript/editor/assets/zondicons/cloud.svg +1 -0
- data/app/javascript/editor/assets/zondicons/code.svg +1 -0
- data/app/javascript/editor/assets/zondicons/coffee.svg +1 -0
- data/app/javascript/editor/assets/zondicons/cog.svg +1 -0
- data/app/javascript/editor/assets/zondicons/color-palette.svg +1 -0
- data/app/javascript/editor/assets/zondicons/compose.svg +1 -0
- data/app/javascript/editor/assets/zondicons/computer-desktop.svg +1 -0
- data/app/javascript/editor/assets/zondicons/computer-laptop.svg +1 -0
- data/app/javascript/editor/assets/zondicons/conversation.svg +1 -0
- data/app/javascript/editor/assets/zondicons/copy.svg +1 -0
- data/app/javascript/editor/assets/zondicons/credit-card.svg +1 -0
- data/app/javascript/editor/assets/zondicons/currency-dollar.svg +1 -0
- data/app/javascript/editor/assets/zondicons/dashboard.svg +1 -0
- data/app/javascript/editor/assets/zondicons/date-add.svg +1 -0
- data/app/javascript/editor/assets/zondicons/dial-pad.svg +1 -0
- data/app/javascript/editor/assets/zondicons/directions.svg +1 -0
- data/app/javascript/editor/assets/zondicons/document-add.svg +1 -0
- data/app/javascript/editor/assets/zondicons/document.svg +1 -0
- data/app/javascript/editor/assets/zondicons/dots-horizontal-double.svg +1 -0
- data/app/javascript/editor/assets/zondicons/dots-horizontal-triple.svg +1 -0
- data/app/javascript/editor/assets/zondicons/download.svg +1 -0
- data/app/javascript/editor/assets/zondicons/duplicate.svg +1 -0
- data/app/javascript/editor/assets/zondicons/edit-copy.svg +1 -0
- data/app/javascript/editor/assets/zondicons/edit-crop.svg +1 -0
- data/app/javascript/editor/assets/zondicons/edit-cut.svg +1 -0
- data/app/javascript/editor/assets/zondicons/edit-pencil.svg +1 -0
- data/app/javascript/editor/assets/zondicons/education.svg +1 -0
- data/app/javascript/editor/assets/zondicons/envelope.svg +1 -0
- data/app/javascript/editor/assets/zondicons/exclamation-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/exclamation-solid.svg +1 -0
- data/app/javascript/editor/assets/zondicons/explore.svg +1 -0
- data/app/javascript/editor/assets/zondicons/factory.svg +1 -0
- data/app/javascript/editor/assets/zondicons/fast-forward.svg +1 -0
- data/app/javascript/editor/assets/zondicons/fast-rewind.svg +1 -0
- data/app/javascript/editor/assets/zondicons/film.svg +1 -0
- data/app/javascript/editor/assets/zondicons/filter.svg +1 -0
- data/app/javascript/editor/assets/zondicons/flag.svg +1 -0
- data/app/javascript/editor/assets/zondicons/flashlight.svg +1 -0
- data/app/javascript/editor/assets/zondicons/folder-outline-add.svg +1 -0
- data/app/javascript/editor/assets/zondicons/folder-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/folder.svg +1 -0
- data/app/javascript/editor/assets/zondicons/format-bold.svg +1 -0
- data/app/javascript/editor/assets/zondicons/format-font-size.svg +1 -0
- data/app/javascript/editor/assets/zondicons/format-italic.svg +1 -0
- data/app/javascript/editor/assets/zondicons/format-text-size.svg +1 -0
- data/app/javascript/editor/assets/zondicons/format-underline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/forward-step.svg +1 -0
- data/app/javascript/editor/assets/zondicons/forward.svg +1 -0
- data/app/javascript/editor/assets/zondicons/gift.svg +1 -0
- data/app/javascript/editor/assets/zondicons/globe.svg +1 -0
- data/app/javascript/editor/assets/zondicons/hand-stop.svg +1 -0
- data/app/javascript/editor/assets/zondicons/hard-drive.svg +1 -0
- data/app/javascript/editor/assets/zondicons/headphones.svg +1 -0
- data/app/javascript/editor/assets/zondicons/heart.svg +1 -0
- data/app/javascript/editor/assets/zondicons/home.svg +1 -0
- data/app/javascript/editor/assets/zondicons/hot.svg +1 -0
- data/app/javascript/editor/assets/zondicons/hour-glass.svg +1 -0
- data/app/javascript/editor/assets/zondicons/inbox-check.svg +1 -0
- data/app/javascript/editor/assets/zondicons/inbox-download.svg +1 -0
- data/app/javascript/editor/assets/zondicons/inbox-full.svg +1 -0
- data/app/javascript/editor/assets/zondicons/inbox.svg +1 -0
- data/app/javascript/editor/assets/zondicons/indent-decrease.svg +1 -0
- data/app/javascript/editor/assets/zondicons/indent-increase.svg +1 -0
- data/app/javascript/editor/assets/zondicons/information-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/information-solid.svg +1 -0
- data/app/javascript/editor/assets/zondicons/key.svg +1 -0
- data/app/javascript/editor/assets/zondicons/keyboard.svg +1 -0
- data/app/javascript/editor/assets/zondicons/layers.svg +1 -0
- data/app/javascript/editor/assets/zondicons/library.svg +1 -0
- data/app/javascript/editor/assets/zondicons/light-bulb.svg +1 -0
- data/app/javascript/editor/assets/zondicons/link.svg +1 -0
- data/app/javascript/editor/assets/zondicons/list-add.svg +1 -0
- data/app/javascript/editor/assets/zondicons/list-bullet.svg +1 -0
- data/app/javascript/editor/assets/zondicons/list.svg +1 -0
- data/app/javascript/editor/assets/zondicons/load-balancer.svg +1 -0
- data/app/javascript/editor/assets/zondicons/location-current.svg +1 -0
- data/app/javascript/editor/assets/zondicons/location-food.svg +1 -0
- data/app/javascript/editor/assets/zondicons/location-gas-station.svg +1 -0
- data/app/javascript/editor/assets/zondicons/location-hotel.svg +1 -0
- data/app/javascript/editor/assets/zondicons/location-marina.svg +1 -0
- data/app/javascript/editor/assets/zondicons/location-park.svg +1 -0
- data/app/javascript/editor/assets/zondicons/location-restroom.svg +1 -0
- data/app/javascript/editor/assets/zondicons/location-shopping.svg +1 -0
- data/app/javascript/editor/assets/zondicons/location.svg +1 -0
- data/app/javascript/editor/assets/zondicons/lock-closed.svg +1 -0
- data/app/javascript/editor/assets/zondicons/lock-open.svg +1 -0
- data/app/javascript/editor/assets/zondicons/map.svg +1 -0
- data/app/javascript/editor/assets/zondicons/menu.svg +1 -0
- data/app/javascript/editor/assets/zondicons/mic.svg +1 -0
- data/app/javascript/editor/assets/zondicons/minus-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/minus-solid.svg +1 -0
- data/app/javascript/editor/assets/zondicons/mobile-devices.svg +1 -0
- data/app/javascript/editor/assets/zondicons/mood-happy-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/mood-happy-solid.svg +1 -0
- data/app/javascript/editor/assets/zondicons/mood-neutral-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/mood-neutral-solid.svg +1 -0
- data/app/javascript/editor/assets/zondicons/mood-sad-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/mood-sad-solid.svg +1 -0
- data/app/javascript/editor/assets/zondicons/mouse.svg +1 -0
- data/app/javascript/editor/assets/zondicons/music-album.svg +1 -0
- data/app/javascript/editor/assets/zondicons/music-artist.svg +1 -0
- data/app/javascript/editor/assets/zondicons/music-notes.svg +1 -0
- data/app/javascript/editor/assets/zondicons/music-playlist.svg +1 -0
- data/app/javascript/editor/assets/zondicons/navigation-more.svg +1 -0
- data/app/javascript/editor/assets/zondicons/network.svg +1 -0
- data/app/javascript/editor/assets/zondicons/news-paper.svg +1 -0
- data/app/javascript/editor/assets/zondicons/notification.svg +1 -0
- data/app/javascript/editor/assets/zondicons/notifications-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/notifications.svg +1 -0
- data/app/javascript/editor/assets/zondicons/paste.svg +1 -0
- data/app/javascript/editor/assets/zondicons/pause-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/pause-solid.svg +1 -0
- data/app/javascript/editor/assets/zondicons/pause.svg +1 -0
- data/app/javascript/editor/assets/zondicons/pen-tool.svg +1 -0
- data/app/javascript/editor/assets/zondicons/phone.svg +1 -0
- data/app/javascript/editor/assets/zondicons/photo.svg +1 -0
- data/app/javascript/editor/assets/zondicons/php-elephant.svg +1 -0
- data/app/javascript/editor/assets/zondicons/pin.svg +1 -0
- data/app/javascript/editor/assets/zondicons/play-outline.svg +1 -0
- data/app/javascript/editor/assets/zondicons/play.svg +1 -0
- data/app/javascript/editor/assets/zondicons/playlist.svg +1 -0
- data/app/javascript/editor/assets/zondicons/plugin.svg +1 -0
- data/app/javascript/editor/assets/zondicons/portfolio.svg +1 -0
- data/app/javascript/editor/assets/zondicons/printer.svg +1 -0
- data/app/javascript/editor/assets/zondicons/pylon.svg +1 -0
- data/app/javascript/editor/assets/zondicons/question.svg +1 -0
- data/app/javascript/editor/assets/zondicons/queue.svg +1 -0
- data/app/javascript/editor/assets/zondicons/radar copy 2.svg +1 -0
- data/app/javascript/editor/assets/zondicons/radar.svg +1 -0
- data/app/javascript/editor/assets/zondicons/radio.svg +1 -0
- data/app/javascript/editor/assets/zondicons/refresh.svg +1 -0
- data/app/javascript/editor/assets/zondicons/reload.svg +1 -0
- data/app/javascript/editor/assets/zondicons/reply-all.svg +1 -0
- data/app/javascript/editor/assets/zondicons/reply.svg +1 -0
- data/app/javascript/editor/assets/zondicons/repost.svg +1 -0
- data/app/javascript/editor/assets/zondicons/save-disk.svg +1 -0
- data/app/javascript/editor/assets/zondicons/screen-full.svg +1 -0
- data/app/javascript/editor/assets/zondicons/search.svg +1 -0
- data/app/javascript/editor/assets/zondicons/send.svg +1 -0
- data/app/javascript/editor/assets/zondicons/servers.svg +1 -0
- data/app/javascript/editor/assets/zondicons/share-01.svg +1 -0
- data/app/javascript/editor/assets/zondicons/share-alt.svg +1 -0
- data/app/javascript/editor/assets/zondicons/share.svg +1 -0
- data/app/javascript/editor/assets/zondicons/shield.svg +1 -0
- data/app/javascript/editor/assets/zondicons/shopping-cart.svg +1 -0
- data/app/javascript/editor/assets/zondicons/show-sidebar.svg +1 -0
- data/app/javascript/editor/assets/zondicons/shuffle.svg +1 -0
- data/app/javascript/editor/assets/zondicons/stand-by.svg +1 -0
- data/app/javascript/editor/assets/zondicons/star-full.svg +1 -0
- data/app/javascript/editor/assets/zondicons/station.svg +1 -0
- data/app/javascript/editor/assets/zondicons/step-backward.svg +1 -0
- data/app/javascript/editor/assets/zondicons/step-forward.svg +1 -0
- data/app/javascript/editor/assets/zondicons/stethoscope.svg +1 -0
- data/app/javascript/editor/assets/zondicons/store-front.svg +1 -0
- data/app/javascript/editor/assets/zondicons/stroke-width.svg +1 -0
- data/app/javascript/editor/assets/zondicons/subdirectory-left.svg +1 -0
- data/app/javascript/editor/assets/zondicons/subdirectory-right.svg +1 -0
- data/app/javascript/editor/assets/zondicons/swap.svg +1 -0
- data/app/javascript/editor/assets/zondicons/tablet.svg +1 -0
- data/app/javascript/editor/assets/zondicons/tag.svg +1 -0
- data/app/javascript/editor/assets/zondicons/target.svg +1 -0
- data/app/javascript/editor/assets/zondicons/text-box.svg +1 -0
- data/app/javascript/editor/assets/zondicons/text-decoration.svg +1 -0
- data/app/javascript/editor/assets/zondicons/thermometer.svg +1 -0
- data/app/javascript/editor/assets/zondicons/thumbs-down.svg +1 -0
- data/app/javascript/editor/assets/zondicons/thumbs-up.svg +1 -0
- data/app/javascript/editor/assets/zondicons/ticket.svg +1 -0
- data/app/javascript/editor/assets/zondicons/time.svg +1 -0
- data/app/javascript/editor/assets/zondicons/timer.svg +1 -0
- data/app/javascript/editor/assets/zondicons/tools copy.svg +1 -0
- data/app/javascript/editor/assets/zondicons/translate.svg +1 -0
- data/app/javascript/editor/assets/zondicons/trash.svg +1 -0
- data/app/javascript/editor/assets/zondicons/travel-bus.svg +1 -0
- data/app/javascript/editor/assets/zondicons/travel-car.svg +1 -0
- data/app/javascript/editor/assets/zondicons/travel-case.svg +1 -0
- data/app/javascript/editor/assets/zondicons/travel-taxi-cab.svg +1 -0
- data/app/javascript/editor/assets/zondicons/travel-train.svg +1 -0
- data/app/javascript/editor/assets/zondicons/travel-walk.svg +1 -0
- data/app/javascript/editor/assets/zondicons/travel.svg +1 -0
- data/app/javascript/editor/assets/zondicons/trophy.svg +1 -0
- data/app/javascript/editor/assets/zondicons/tuning.svg +1 -0
- data/app/javascript/editor/assets/zondicons/upload.svg +1 -0
- data/app/javascript/editor/assets/zondicons/usb.svg +1 -0
- data/app/javascript/editor/assets/zondicons/user-add.svg +1 -0
- data/app/javascript/editor/assets/zondicons/user-group.svg +1 -0
- data/app/javascript/editor/assets/zondicons/user-solid-circle.svg +1 -0
- data/app/javascript/editor/assets/zondicons/user-solid-square.svg +1 -0
- data/app/javascript/editor/assets/zondicons/user.svg +1 -0
- data/app/javascript/editor/assets/zondicons/vector.svg +1 -0
- data/app/javascript/editor/assets/zondicons/video-camera.svg +1 -0
- data/app/javascript/editor/assets/zondicons/view-carousel.svg +1 -0
- data/app/javascript/editor/assets/zondicons/view-column.svg +1 -0
- data/app/javascript/editor/assets/zondicons/view-hide.svg +1 -0
- data/app/javascript/editor/assets/zondicons/view-list.svg +1 -0
- data/app/javascript/editor/assets/zondicons/view-show.svg +1 -0
- data/app/javascript/editor/assets/zondicons/view-tile.svg +1 -0
- data/app/javascript/editor/assets/zondicons/volume-down.svg +1 -0
- data/app/javascript/editor/assets/zondicons/volume-mute.svg +1 -0
- data/app/javascript/editor/assets/zondicons/volume-off.svg +1 -0
- data/app/javascript/editor/assets/zondicons/volume-up.svg +1 -0
- data/app/javascript/editor/assets/zondicons/wallet.svg +1 -0
- data/app/javascript/editor/assets/zondicons/watch.svg +1 -0
- data/app/javascript/editor/assets/zondicons/window-new.svg +1 -0
- data/app/javascript/editor/assets/zondicons/window-open.svg +1 -0
- data/app/javascript/editor/assets/zondicons/window.svg +1 -0
- data/app/javascript/editor/assets/zondicons/wrench.svg +1 -0
- data/app/javascript/editor/assets/zondicons/yin-yang.svg +1 -0
- data/app/javascript/editor/assets/zondicons/zoom-in.svg +1 -0
- data/app/javascript/editor/assets/zondicons/zoom-out.svg +1 -0
- data/app/javascript/editor/components/dynamic-form/dynamic-input.vue +121 -0
- data/app/javascript/editor/components/dynamic-form/index.vue +34 -0
- data/app/javascript/editor/components/errors/stale-record.vue +24 -0
- data/app/javascript/editor/components/header-nav/device-toggler.vue +37 -0
- data/app/javascript/editor/components/header-nav/index.vue +103 -0
- data/app/javascript/editor/components/header-nav/locale-toggler/index.vue +51 -0
- data/app/javascript/editor/components/header-nav/locale-toggler/locale-link.vue +32 -0
- data/app/javascript/editor/components/header-nav/preview-button.vue +15 -0
- data/app/javascript/editor/components/header-nav/preview-toggler.vue +40 -0
- data/app/javascript/editor/components/header-nav/publish-button.vue +87 -0
- data/app/javascript/editor/components/header-nav/save-button.vue +42 -0
- data/app/javascript/editor/components/header-nav/separator.vue +11 -0
- data/app/javascript/editor/components/icon-library/index.vue +39 -0
- data/app/javascript/editor/components/image-library/index.vue +110 -0
- data/app/javascript/editor/components/image-library/list-item.vue +93 -0
- data/app/javascript/editor/components/image-library/list.vue +26 -0
- data/app/javascript/editor/components/image-library/uploader.vue +78 -0
- data/app/javascript/editor/components/kit/accordion.vue +63 -0
- data/app/javascript/editor/components/kit/checkbox-input.vue +59 -0
- data/app/javascript/editor/components/kit/collection-item-input.vue +64 -0
- data/app/javascript/editor/components/kit/color-picker.vue +81 -0
- data/app/javascript/editor/components/kit/confirmation-button.vue +65 -0
- data/app/javascript/editor/components/kit/dropdown.vue +60 -0
- data/app/javascript/editor/components/kit/icon-input.vue +96 -0
- data/app/javascript/editor/components/kit/icon.vue +35 -0
- data/app/javascript/editor/components/kit/image-input.vue +124 -0
- data/app/javascript/editor/components/kit/index.js +50 -0
- data/app/javascript/editor/components/kit/link-input.vue +117 -0
- data/app/javascript/editor/components/kit/list-item-button.vue +16 -0
- data/app/javascript/editor/components/kit/modal-root.vue +81 -0
- data/app/javascript/editor/components/kit/modal.vue +39 -0
- data/app/javascript/editor/components/kit/page-icon.vue +21 -0
- data/app/javascript/editor/components/kit/pagination/button.vue +35 -0
- data/app/javascript/editor/components/kit/pagination/index.vue +116 -0
- data/app/javascript/editor/components/kit/rich-text-input/block-button.vue +75 -0
- data/app/javascript/editor/components/kit/rich-text-input/extensions/Doc.js +12 -0
- data/app/javascript/editor/components/kit/rich-text-input/extensions/LineBreak.js +38 -0
- data/app/javascript/editor/components/kit/rich-text-input/extensions/marks/Link.js +57 -0
- data/app/javascript/editor/components/kit/rich-text-input/format-buttons.vue +39 -0
- data/app/javascript/editor/components/kit/rich-text-input/link-buttons.vue +91 -0
- data/app/javascript/editor/components/kit/rich-text-input/list-buttons.vue +29 -0
- data/app/javascript/editor/components/kit/rich-text-input/menu-button.vue +22 -0
- data/app/javascript/editor/components/kit/rich-text-input/table-button.vue +106 -0
- data/app/javascript/editor/components/kit/rich-text-input.vue +181 -0
- data/app/javascript/editor/components/kit/search-input.vue +53 -0
- data/app/javascript/editor/components/kit/select-input.vue +188 -0
- data/app/javascript/editor/components/kit/simple-select.vue +44 -0
- data/app/javascript/editor/components/kit/submit-button.vue +117 -0
- data/app/javascript/editor/components/kit/tabs.vue +88 -0
- data/app/javascript/editor/components/kit/text-input.vue +62 -0
- data/app/javascript/editor/components/kit/textarea-input.vue +59 -0
- data/app/javascript/editor/components/link-picker/actions.vue +32 -0
- data/app/javascript/editor/components/link-picker/email.vue +32 -0
- data/app/javascript/editor/components/link-picker/index.vue +97 -0
- data/app/javascript/editor/components/link-picker/page.vue +124 -0
- data/app/javascript/editor/components/link-picker/url.vue +43 -0
- data/app/javascript/editor/components/page/edit.vue +98 -0
- data/app/javascript/editor/components/page/form/main.vue +64 -0
- data/app/javascript/editor/components/page/form/seo.vue +94 -0
- data/app/javascript/editor/components/page/list/index.vue +67 -0
- data/app/javascript/editor/components/page/list/list-item.vue +147 -0
- data/app/javascript/editor/components/page/new.vue +78 -0
- data/app/javascript/editor/components/section-block-pane/index.vue +69 -0
- data/app/javascript/editor/components/section-block-pane/setting-list.vue +49 -0
- data/app/javascript/editor/components/section-highlighter/bottom-actions.vue +60 -0
- data/app/javascript/editor/components/section-highlighter/index.vue +133 -0
- data/app/javascript/editor/components/section-highlighter/top-left-actions.vue +68 -0
- data/app/javascript/editor/components/section-highlighter/top-right-actions.vue +127 -0
- data/app/javascript/editor/components/section-list/index.vue +64 -0
- data/app/javascript/editor/components/section-list/list-item.vue +33 -0
- data/app/javascript/editor/components/section-pane/block-list/index.vue +67 -0
- data/app/javascript/editor/components/section-pane/block-list/list-item.vue +71 -0
- data/app/javascript/editor/components/section-pane/block-list/new-block-button.vue +74 -0
- data/app/javascript/editor/components/section-pane/block-tree/index.vue +63 -0
- data/app/javascript/editor/components/section-pane/block-tree/new-nested-block-button.vue +67 -0
- data/app/javascript/editor/components/section-pane/block-tree/tree-node.vue +109 -0
- data/app/javascript/editor/components/section-pane/index.vue +92 -0
- data/app/javascript/editor/components/section-pane/setting-list.vue +46 -0
- data/app/javascript/editor/components/sidebar-nav.vue +125 -0
- data/app/javascript/editor/components/style-pane/index.vue +44 -0
- data/app/javascript/editor/components/theme-section-list/index.vue +51 -0
- data/app/javascript/editor/components/theme-section-list/list-item.vue +88 -0
- data/app/javascript/editor/design/application.scss +17 -0
- data/app/javascript/editor/design/components/buttons.scss +25 -0
- data/app/javascript/editor/design/components/modal.scss +49 -0
- data/app/javascript/editor/design/components/rich-text-editor.scss +180 -0
- data/app/javascript/editor/design/components/tooltip.scss +117 -0
- data/app/javascript/editor/design/components/tree.scss +6 -0
- data/app/javascript/editor/design/helpers.scss +30 -0
- data/app/javascript/editor/design/transitions.scss +121 -0
- data/app/javascript/editor/layouts/app.vue +30 -0
- data/app/javascript/editor/layouts/default.vue +42 -0
- data/app/javascript/editor/layouts/slide-pane.vue +87 -0
- data/app/javascript/editor/locales/editor.en.json +257 -0
- data/app/javascript/editor/locales/editor.fr.json +244 -0
- data/app/javascript/editor/locales/index.js +11 -0
- data/app/javascript/editor/main.js +19 -0
- data/app/javascript/editor/mixins/error-modal.js +23 -0
- data/app/javascript/editor/mixins/focused-input.js +20 -0
- data/app/javascript/editor/mixins/global.js +125 -0
- data/app/javascript/editor/mixins/grouped-dropdowns.js +17 -0
- data/app/javascript/editor/mixins/index.js +1 -0
- data/app/javascript/editor/mixins/preview-transformation.js +60 -0
- data/app/javascript/editor/plugins/event-bus.js +3 -0
- data/app/javascript/editor/plugins/filters.js +7 -0
- data/app/javascript/editor/plugins/i18n.js +28 -0
- data/app/javascript/editor/plugins/index.js +3 -0
- data/app/javascript/editor/plugins/tooltip.js +4 -0
- data/app/javascript/editor/router/index.js +20 -0
- data/app/javascript/editor/router/routes/base.js +53 -0
- data/app/javascript/editor/router/routes/index.js +3 -0
- data/app/javascript/editor/router/routes/page.js +30 -0
- data/app/javascript/editor/router/routes/section-block.js +29 -0
- data/app/javascript/editor/router/routes/section.js +67 -0
- data/app/javascript/editor/router/routes/style.js +17 -0
- data/app/javascript/editor/services/__tests__/page.spec.js +38 -0
- data/app/javascript/editor/services/__tests__/section.spec.js +32 -0
- data/app/javascript/editor/services/api.js +40 -0
- data/app/javascript/editor/services/block.js +26 -0
- data/app/javascript/editor/services/collection-item.js +12 -0
- data/app/javascript/editor/services/image.js +23 -0
- data/app/javascript/editor/services/index.js +21 -0
- data/app/javascript/editor/services/inline-editing.js +403 -0
- data/app/javascript/editor/services/page.js +107 -0
- data/app/javascript/editor/services/section.js +180 -0
- data/app/javascript/editor/services/site.js +21 -0
- data/app/javascript/editor/services/theme.js +8 -0
- data/app/javascript/editor/spec/__mocks__/page.js +432 -0
- data/app/javascript/editor/spec/__mocks__/section.js +232 -0
- data/app/javascript/editor/spec/__mocks__/services.js +77 -0
- data/app/javascript/editor/spec/__mocks__/site.js +95 -0
- data/app/javascript/editor/spec/__mocks__/theme.js +518 -0
- data/app/javascript/editor/store/__tests__/getters.spec.js +102 -0
- data/app/javascript/editor/store/actions/__tests__/page.spec.js +93 -0
- data/app/javascript/editor/store/actions/__tests__/section-block.spec.js +104 -0
- data/app/javascript/editor/store/actions/__tests__/section.spec.js +61 -0
- data/app/javascript/editor/store/actions/index.js +37 -0
- data/app/javascript/editor/store/actions/page.js +52 -0
- data/app/javascript/editor/store/actions/section-block.js +74 -0
- data/app/javascript/editor/store/actions/section.js +86 -0
- data/app/javascript/editor/store/actions/site.js +32 -0
- data/app/javascript/editor/store/default-state.js +28 -0
- data/app/javascript/editor/store/getters.js +91 -0
- data/app/javascript/editor/store/index.js +28 -0
- data/app/javascript/editor/store/mutations.js +183 -0
- data/app/javascript/editor/utils.js +127 -0
- data/app/javascript/editor/views/content-pane.vue +105 -0
- data/app/javascript/editor/views/page-preview.vue +183 -0
- data/app/javascript/editor/views/pages/edit.vue +26 -0
- data/app/javascript/editor/views/pages/index.vue +65 -0
- data/app/javascript/editor/views/sections/add-pane.vue +23 -0
- data/app/javascript/editor/views/sections/list-pane.vue +20 -0
- data/app/javascript/editor/views/slide-pane.vue +14 -0
- data/app/javascript/editor/views/slide-pane2.vue +14 -0
- data/app/javascript/editor/views/style/edit-pane.vue +22 -0
- data/app/javascript/packs/application.js +8 -0
- data/app/javascript/packs/editor.js +2 -0
- data/app/javascript/style/application/_changes.scss +1 -0
- data/app/javascript/style/application/_variables.scss +0 -0
- data/app/javascript/style/application.scss +5 -0
- data/app/javascript/utils/axios.js +16 -0
- data/app/jobs/maglev/application_job.rb +6 -0
- data/app/mailers/maglev/application_mailer.rb +8 -0
- data/app/models/concerns/maglev/sections_concern.rb +45 -0
- data/app/models/concerns/maglev/translatable.rb +44 -0
- data/app/models/maglev/application_record.rb +7 -0
- data/app/models/maglev/asset.rb +28 -0
- data/app/models/maglev/page/path_concern.rb +70 -0
- data/app/models/maglev/page/search_concern.rb +40 -0
- data/app/models/maglev/page.rb +38 -0
- data/app/models/maglev/page_path.rb +46 -0
- data/app/models/maglev/section/block.rb +41 -0
- data/app/models/maglev/section/content_concern.rb +83 -0
- data/app/models/maglev/section/setting.rb +53 -0
- data/app/models/maglev/section.rb +85 -0
- data/app/models/maglev/site/locale.rb +19 -0
- data/app/models/maglev/site/locales_concern.rb +37 -0
- data/app/models/maglev/site/style_value.rb +43 -0
- data/app/models/maglev/site.rb +25 -0
- data/app/models/maglev/static_page.rb +40 -0
- data/app/models/maglev/theme/section_category.rb +23 -0
- data/app/models/maglev/theme/style_setting.rb +43 -0
- data/app/models/maglev/theme.rb +16 -0
- data/app/services/concerns/maglev/get_page_sections/transform_collection_item_concern.rb +18 -0
- data/app/services/concerns/maglev/get_page_sections/transform_link_concern.rb +35 -0
- data/app/services/concerns/maglev/get_page_sections/transform_text_concern.rb +38 -0
- data/app/services/maglev/app_container.rb +48 -0
- data/app/services/maglev/change_site_locales.rb +37 -0
- data/app/services/maglev/clone_page.rb +62 -0
- data/app/services/maglev/extract_locale.rb +36 -0
- data/app/services/maglev/fetch_collection_items.rb +97 -0
- data/app/services/maglev/fetch_page.rb +26 -0
- data/app/services/maglev/fetch_section_screenshot_path.rb +17 -0
- data/app/services/maglev/fetch_section_screenshot_url.rb +14 -0
- data/app/services/maglev/fetch_sections_path.rb +13 -0
- data/app/services/maglev/fetch_site.rb +20 -0
- data/app/services/maglev/fetch_static_pages.rb +56 -0
- data/app/services/maglev/fetch_style.rb +38 -0
- data/app/services/maglev/fetch_theme.rb +12 -0
- data/app/services/maglev/fetch_theme_layout.rb +14 -0
- data/app/services/maglev/generate_site.rb +26 -0
- data/app/services/maglev/get_base_url.rb +32 -0
- data/app/services/maglev/get_page_fullpath.rb +65 -0
- data/app/services/maglev/get_page_section_names.rb +25 -0
- data/app/services/maglev/get_page_sections.rb +103 -0
- data/app/services/maglev/persist_page.rb +74 -0
- data/app/services/maglev/persist_section_screenshot.rb +58 -0
- data/app/services/maglev/search_pages.rb +60 -0
- data/app/services/maglev/setup_pages.rb +45 -0
- data/app/validators/maglev/collection_validator.rb +24 -0
- data/app/validators/maglev/presence_validator.rb +16 -0
- data/app/views/layouts/maglev/admin/_header_actions.html.erb +5 -0
- data/app/views/layouts/maglev/admin/application.html.erb +25 -0
- data/app/views/maglev/admin/sections/previews/show.html.erb +32 -0
- data/app/views/maglev/admin/themes/_empty.html.erb +20 -0
- data/app/views/maglev/admin/themes/_section_categories.html.erb +9 -0
- data/app/views/maglev/admin/themes/_sections.html.erb +54 -0
- data/app/views/maglev/admin/themes/show.html.erb +21 -0
- data/app/views/maglev/api/_pagination.json.jbuilder +6 -0
- data/app/views/maglev/api/assets/_show.json.jbuilder +8 -0
- data/app/views/maglev/api/assets/index.json.jbuilder +9 -0
- data/app/views/maglev/api/assets/show.json.jbuilder +3 -0
- data/app/views/maglev/api/collection_items/_show.json.jbuilder +5 -0
- data/app/views/maglev/api/collection_items/index.json.jbuilder +5 -0
- data/app/views/maglev/api/pages/index.json.jbuilder +18 -0
- data/app/views/maglev/api/pages/show.json.jbuilder +24 -0
- data/app/views/maglev/api/sites/_show.json.jbuilder +15 -0
- data/app/views/maglev/api/sites/show.json.jbuilder +3 -0
- data/app/views/maglev/api/themes/_show.json.jbuilder +17 -0
- data/app/views/maglev/editor/_header.html.erb +1 -0
- data/app/views/maglev/editor/show.html.erb +39 -0
- data/config/initializers/assets.rb +24 -0
- data/config/initializers/filter_parameters_logging.rb +6 -0
- data/config/initializers/kaminari.rb +16 -0
- data/config/locales/activerecord.en.yml +7 -0
- data/config/locales/activerecord.fr.yml +26 -0
- data/config/routes.rb +46 -0
- data/config/webpack/development.js +5 -0
- data/config/webpack/environment.js +38 -0
- data/config/webpack/loaders/optional_chaining.js +10 -0
- data/config/webpack/loaders/vue.js +6 -0
- data/config/webpack/production.js +5 -0
- data/config/webpack/test.js +5 -0
- data/config/webpacker.yml +95 -0
- data/db/migrate/20200824085207_create_maglev_sites.rb +8 -0
- data/db/migrate/20200824104648_create_maglev_pages.rb +17 -0
- data/db/migrate/20200831101942_create_maglev_section_content.rb +11 -0
- data/db/migrate/20201206172020_create_maglev_assets.rb +13 -0
- data/db/migrate/20210819092740_switch_to_localized_page_fields.rb +17 -0
- data/db/migrate/20210830085101_create_maglev_page_paths.rb +13 -0
- data/db/migrate/20210906102712_add_canonical_to_pages.rb +6 -0
- data/db/migrate/20211008064437_add_locales_to_sites.rb +5 -0
- data/db/migrate/20211013210954_translate_section_content.rb +8 -0
- data/db/migrate/20211101205001_add_lock_version_to_maglev_pages.rb +6 -0
- data/db/migrate/20211116161121_better_page_path_canonical_indices.rb +8 -0
- data/db/migrate/20211124101005_fix_page_path_indices.rb +6 -0
- data/db/migrate/20211203224112_add_open_graph_tags_to_pages.rb +9 -0
- data/db/migrate/20220612092235_add_style_to_sites.rb +7 -0
- data/lib/generators/maglev/install_generator.rb +50 -0
- data/lib/generators/maglev/section_generator.rb +128 -0
- data/lib/generators/maglev/templates/install/config/initializers/maglev.rb +77 -0
- data/lib/generators/maglev/templates/install/public/theme/image-placeholder.jpg +0 -0
- data/lib/generators/maglev/templates/section/app/theme/sections/%category%/%file_name%.yml.tt +102 -0
- data/lib/generators/maglev/templates/section/app/views/theme/sections/%category%/%file_name%.html.erb.tt +55 -0
- data/lib/generators/maglev/templates/theme/app/theme/theme.yml.tt +22 -0
- data/lib/generators/maglev/templates/theme/app/views/theme/layout.html.erb.tt +21 -0
- data/lib/generators/maglev/theme_generator.rb +12 -0
- data/lib/maglev/active_storage.rb +36 -0
- data/lib/maglev/config.rb +9 -0
- data/lib/maglev/engine.rb +65 -0
- data/lib/maglev/errors.rb +8 -0
- data/lib/maglev/i18n.rb +46 -0
- data/lib/maglev/preview_constraint.rb +25 -0
- data/lib/maglev/theme_filesystem_loader.rb +55 -0
- data/lib/maglev/version.rb +5 -0
- data/lib/maglev.rb +70 -0
- data/lib/maglevcms.rb +4 -0
- data/lib/tasks/maglev_tasks.rake +108 -0
- metadata +827 -0
@@ -0,0 +1,128 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maglev
|
4
|
+
class SectionGenerator < Rails::Generators::NamedBase
|
5
|
+
source_root File.expand_path('templates/section', __dir__)
|
6
|
+
|
7
|
+
class_option :category, type: :string, default: nil
|
8
|
+
class_option :settings, type: :array, default: []
|
9
|
+
|
10
|
+
hook_for :maglev_section
|
11
|
+
|
12
|
+
attr_reader :theme_name, :category, :settings, :blocks
|
13
|
+
|
14
|
+
def verify_theme_exists
|
15
|
+
raise Thor::Error, set_color('ERROR: You must first create a theme.', :red) if theme.nil?
|
16
|
+
end
|
17
|
+
|
18
|
+
def verify_categories_exist
|
19
|
+
raise Thor::Error, set_color('ERROR: You must add categories to your theme.', :red) if categories.blank?
|
20
|
+
end
|
21
|
+
|
22
|
+
def select_category
|
23
|
+
@category = options['category']
|
24
|
+
return if @category.present?
|
25
|
+
|
26
|
+
say 'You have to select a category for your section. Please check your Maglev theme.yml file to manage them.',
|
27
|
+
:blue
|
28
|
+
@category = ask 'Please choose a category', limited_to: categories, default: categories.first
|
29
|
+
end
|
30
|
+
|
31
|
+
def build_settings
|
32
|
+
@settings = extract_section_settings
|
33
|
+
@blocks = extract_blocks
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_section_files
|
37
|
+
directory 'app'
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def theme
|
43
|
+
Maglev.local_themes&.first
|
44
|
+
end
|
45
|
+
|
46
|
+
def categories
|
47
|
+
theme.section_categories.map(&:id)
|
48
|
+
end
|
49
|
+
|
50
|
+
def extract_section_settings
|
51
|
+
return default_section_settings if options['settings'].blank?
|
52
|
+
|
53
|
+
# build section settings only
|
54
|
+
options['settings'].map do |raw_setting|
|
55
|
+
next if raw_setting.starts_with?('block:') # block setting
|
56
|
+
|
57
|
+
id, type = raw_setting.split(':')
|
58
|
+
SectionSetting.new(id, type)
|
59
|
+
end.compact.presence
|
60
|
+
end
|
61
|
+
|
62
|
+
def extract_blocks
|
63
|
+
# build block settings
|
64
|
+
blocks = options['settings'].map do |raw_setting|
|
65
|
+
next unless raw_setting.starts_with?('block:') # block setting
|
66
|
+
|
67
|
+
_, block_type, id, type = raw_setting.split(':')
|
68
|
+
BlockSetting.new(block_type, id, type)
|
69
|
+
end.compact.presence || []
|
70
|
+
|
71
|
+
blocks = default_block_settings if blocks.blank? && @settings.blank?
|
72
|
+
|
73
|
+
# group them by block types
|
74
|
+
blocks.group_by(&:block_type)
|
75
|
+
end
|
76
|
+
|
77
|
+
def default_section_settings
|
78
|
+
[
|
79
|
+
SectionSetting.new('title', 'text', 'My awesome title'),
|
80
|
+
SectionSetting.new('image', 'image', 'An image')
|
81
|
+
]
|
82
|
+
end
|
83
|
+
|
84
|
+
def default_block_settings
|
85
|
+
[
|
86
|
+
BlockSetting.new('list_item', 'title', 'text', 'Item title'),
|
87
|
+
BlockSetting.new('list_item', 'image', 'image', 'Item image')
|
88
|
+
]
|
89
|
+
end
|
90
|
+
|
91
|
+
class SectionSetting
|
92
|
+
attr_reader :id, :type, :label
|
93
|
+
|
94
|
+
def initialize(id, type, label = nil)
|
95
|
+
@id = id
|
96
|
+
@type = type || 'text'
|
97
|
+
@label = label || id.humanize
|
98
|
+
end
|
99
|
+
|
100
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
101
|
+
def default
|
102
|
+
case type
|
103
|
+
when 'text' then label
|
104
|
+
when 'image' then '"/theme/image-placeholder.jpg"'
|
105
|
+
when 'checkbox' then true
|
106
|
+
when 'link' then '"#"'
|
107
|
+
when 'color' then '#E5E7EB'
|
108
|
+
when 'radio', 'select' then 'option_1'
|
109
|
+
when 'icon' then 'default-icon-class'
|
110
|
+
end
|
111
|
+
end
|
112
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
113
|
+
|
114
|
+
def value?
|
115
|
+
!%w[hint content_type].include?(type)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
class BlockSetting < SectionSetting
|
120
|
+
attr_reader :block_type
|
121
|
+
|
122
|
+
def initialize(block_type, id, type, label = nil)
|
123
|
+
super(id, type, label)
|
124
|
+
@block_type = block_type
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Maglev.configure do |config|
|
4
|
+
# Title of the Editor window
|
5
|
+
# config.title = 'Maglev - Editor'
|
6
|
+
|
7
|
+
# Logo of the Editor (top left corner).
|
8
|
+
# Put your custom logo in the app/assets/images folder of your Rails application.
|
9
|
+
# config.logo = 'logo.png'
|
10
|
+
|
11
|
+
# Favicon (window tab)
|
12
|
+
# Put your custom favicon in the app/assets/images folder of your Rails application.
|
13
|
+
# config.favicon = 'favicon.ico'
|
14
|
+
|
15
|
+
# Primary color of the Editor
|
16
|
+
# config.primary_color = '#7E6EDB'
|
17
|
+
|
18
|
+
# Action triggered when clicking on the very bottom left button in the Editor
|
19
|
+
# NOTE: If you want the user to signed out from the Editor UI once the back action has been triggered,
|
20
|
+
# you'll have to clear the `maglev_site_id` session variable.
|
21
|
+
# config.back_action = 'https://www.mysite.dev' # External url
|
22
|
+
# config.back_action = :my_account_path # name of the route in your Rails application
|
23
|
+
# config.back_action = ->(site) { redirect_to main_app.my_account_path(site_id: site.id) }
|
24
|
+
|
25
|
+
# I18n locale used in the Editor UI (by default, I18n.locale will be used)
|
26
|
+
# config.ui_locale = 'fr' # make sure your locale has been registered in Rails.
|
27
|
+
# config.ui_locale = :find_my_locale # name of any protected method from your Rails application controller
|
28
|
+
# config.ui_locale = ->(site) { 'fr' }
|
29
|
+
|
30
|
+
# Default locales of a site. By default, Maglev will use English (en).
|
31
|
+
# This setting will only be used when creating the site.
|
32
|
+
# If you want add more locales to your site, use the SetSiteLocalesService (https://docs.maglev.dev/guides/i18n).
|
33
|
+
# The first locale of the array will be considered as the default locale of the site
|
34
|
+
# config.default_site_locales = [
|
35
|
+
# { label: 'English', prefix: 'en' },
|
36
|
+
# { label: 'French', prefix: 'fr' }
|
37
|
+
# ]
|
38
|
+
|
39
|
+
# Editor UI authentication (https://docs.maglev.dev/guides/setup-authentication)
|
40
|
+
# config.is_authenticated = :editor_allowed? # name of any protected method from your Rails application controller
|
41
|
+
# config.is_authenticated = ->(site) { current_user&.role == 'editor' }
|
42
|
+
|
43
|
+
# Admin UI authentication (https://docs.maglev.dev/guides/setup-authentication)
|
44
|
+
config.admin_username = Rails.env.production? ? ENV.fetch('MAGLEV_ADMIN_USERNAME') : nil
|
45
|
+
config.admin_password = Rails.env.production? ? ENV.fetch('MAGLEV_ADMIN_PASSWORD') : nil
|
46
|
+
|
47
|
+
# Uploader engine (:active_storage is only supported for now)
|
48
|
+
config.uploader = :active_storage
|
49
|
+
|
50
|
+
# Collections mapping (https://docs.maglev.dev/guides/setup-collections)
|
51
|
+
# config.collections = {
|
52
|
+
# products: {
|
53
|
+
# model: 'Product',
|
54
|
+
# fields: {
|
55
|
+
# label: :name,
|
56
|
+
# image: :thumbnail_url
|
57
|
+
# }
|
58
|
+
# }
|
59
|
+
# }
|
60
|
+
|
61
|
+
# Let your content editors references existing pages of your application but
|
62
|
+
# not served/rendered by Maglev.
|
63
|
+
# config.static_pages = [
|
64
|
+
# {
|
65
|
+
# title: { en: 'Products', fr: 'Produits' },
|
66
|
+
# path: { en: 'products', fr: 'fr/produits' }
|
67
|
+
# },
|
68
|
+
# {
|
69
|
+
# title: { en: 'Authentication', fr: 'Authentification' },
|
70
|
+
# path: { en: 'sign-in', fr: 'fr/se-connecter' }
|
71
|
+
# }
|
72
|
+
# ]
|
73
|
+
|
74
|
+
# Prevent the content editors to create pages sharing the same path with other
|
75
|
+
# existing pages of the application.
|
76
|
+
# config.reserved_paths = %w(products sign-in search)
|
77
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# Name of the section displayed in the editor UI
|
2
|
+
name: "<%= file_name %>"
|
3
|
+
|
4
|
+
# Category of the section in the editor UI (headers, features, testimonials, ...etc)
|
5
|
+
category: <%= category %>
|
6
|
+
|
7
|
+
# A section might have the same content all over the site, like a menu or a footer for instance.
|
8
|
+
# To enable this behavior, uncomment the following statement
|
9
|
+
# site_scoped: true
|
10
|
+
|
11
|
+
# Display or not the button to insert a new section after this one
|
12
|
+
# insert_button: false
|
13
|
+
|
14
|
+
# Insert this section at the top or the bottom of the page (default: nil)
|
15
|
+
# insert_at: top
|
16
|
+
|
17
|
+
# one single instance per page?
|
18
|
+
# singleton: true
|
19
|
+
|
20
|
+
# Definition of the settings:
|
21
|
+
# A setting type can be one of the following values: text, image, link, collection_item, checkbox, color and icon.
|
22
|
+
# Please visit: https://docs.maglev.dev/concepts/setting for more explanation.
|
23
|
+
settings:
|
24
|
+
<%- settings.each do |setting| -%>
|
25
|
+
- label: "<%= setting.label %>"
|
26
|
+
id: <%= setting.id %>
|
27
|
+
type: <%= setting.type %>
|
28
|
+
<%- case setting.type -%>
|
29
|
+
<%- when 'text' -%>
|
30
|
+
# html: true
|
31
|
+
# line_break: true
|
32
|
+
# nb_rows: 5
|
33
|
+
<%- when 'select', 'radio' -%>
|
34
|
+
options:
|
35
|
+
- label: Option 1
|
36
|
+
value: option_1
|
37
|
+
- label: Option 2
|
38
|
+
value: option_2
|
39
|
+
<%- when 'color' -%>
|
40
|
+
presents: ['#E5E7EB', '#FECACA', '#FDE68A', '#A7F3D0', '#BFDBFE']
|
41
|
+
<%- end -%>
|
42
|
+
<% if setting.value? -%>default: <%= setting.default %><% end -%>
|
43
|
+
|
44
|
+
<%- end -%>
|
45
|
+
# Definition of the blocks.
|
46
|
+
# You can define as many types of blocks as you want.
|
47
|
+
blocks: <%- if blocks.blank? -%>[]
|
48
|
+
<% end %>
|
49
|
+
<%- blocks.each do |(type, settings)| -%>
|
50
|
+
- name: "<%= type.humanize %>"
|
51
|
+
type: <%= type %>
|
52
|
+
settings:
|
53
|
+
<%- settings.each do |setting| -%>
|
54
|
+
- label: "<%= setting.label %>"
|
55
|
+
id: <%= setting.id %>
|
56
|
+
type: <%= setting.type %>
|
57
|
+
<%- case setting.type -%>
|
58
|
+
<%- when 'text' -%>
|
59
|
+
# html: true
|
60
|
+
# line_break: true
|
61
|
+
# nb_rows: 5
|
62
|
+
<%- when 'select', 'radio' -%>
|
63
|
+
options:
|
64
|
+
- label: Option 1
|
65
|
+
value: option_1
|
66
|
+
- label: Option 2
|
67
|
+
value: option_2
|
68
|
+
<%- end -%>
|
69
|
+
<%- if setting.value? -%>
|
70
|
+
default: <%= setting.default %>
|
71
|
+
<%- end -%>
|
72
|
+
<%- end -%>
|
73
|
+
|
74
|
+
<%- end -%>
|
75
|
+
# By default, in the editor UI, blocks will be listed below the "Content" title.
|
76
|
+
# The title can be changed with the following property:
|
77
|
+
# blocks_label: "My list of items"
|
78
|
+
|
79
|
+
# By default, blocks are presented as a list in the editor UI.
|
80
|
+
# If you like to use blocks to build a menu with sub menu items,
|
81
|
+
# consider using the tree presentation
|
82
|
+
# blocks_presentation: "tree"
|
83
|
+
|
84
|
+
# In order to get a section with "meaning" content for the editors,
|
85
|
+
# you can set the default content of a new instance of this section.
|
86
|
+
# (it's also be useful when taking a screenshot of the section).
|
87
|
+
# sample:
|
88
|
+
# settings:
|
89
|
+
<%- settings.each do |setting| -%>
|
90
|
+
# <% if setting.value? -%><%= setting.id %>: <%= setting.default %><% end -%>
|
91
|
+
|
92
|
+
<%- end -%>
|
93
|
+
# blocks: <%- if blocks.blank? -%>[]
|
94
|
+
<% end %>
|
95
|
+
<%- blocks.each do |(type, settings)| -%>
|
96
|
+
# - type: <%= type %>
|
97
|
+
# settings:
|
98
|
+
<%- settings.each do |setting| -%>
|
99
|
+
# <% if setting.value? -%><%= setting.id %>: <%= setting.default %><% end -%>
|
100
|
+
|
101
|
+
<%- end -%>
|
102
|
+
<%- end -%>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<%%= maglev_section.wrapper_tag.div class: 'py-6 md:py-12 px-4 md:px-6' do %>
|
2
|
+
<div class="container mx-auto">
|
3
|
+
<div class="mb-4">
|
4
|
+
<h2 class="text-2xl font-bold"><%= file_name %></h2>
|
5
|
+
<p class="mt-1 text-sm text-gray-500">
|
6
|
+
Generated by the <strong class="text-black">Maglev</strong> generator.
|
7
|
+
</p>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<!-- Section settings -->
|
11
|
+
<div class="border-t border-gray-200 px-0 md:px-10 py-5">
|
12
|
+
<div class="grid grid-cols-1 md:grid-cols-4 gap-x-4 gap-y-8">
|
13
|
+
<%- settings.each do |setting| -%>
|
14
|
+
<div class="col-span-1">
|
15
|
+
<h4 class="text-sm font-medium text-gray-500">
|
16
|
+
<%= setting.label %>
|
17
|
+
</h4>
|
18
|
+
<div class="mt-1 text-sm text-gray-900">
|
19
|
+
<%%= maglev_section.setting_tag :<%= setting.id -%> %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<%- end -%>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<%- unless blocks.empty? -%>
|
27
|
+
<!-- Section blocks -->
|
28
|
+
<div class="bg-gray-50 px-4 md:px-10 py-4 md:py-10">
|
29
|
+
<h3 class="text-sm uppercase font-bold">Blocks</h3>
|
30
|
+
|
31
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-8 mt-10">
|
32
|
+
<%% section.blocks.each do |maglev_block| %>
|
33
|
+
<%%= maglev_block.wrapper_tag.div class: 'col-span-1 bg-white rounded-lg shadow px-4 py-4' do %>
|
34
|
+
<%% case maglev_block.type %>
|
35
|
+
<%- blocks.each do |(type, block_settings)| -%>
|
36
|
+
<%% when '<%= type %>' %>
|
37
|
+
<%- block_settings.each do |setting| -%>
|
38
|
+
<div class="mb-4">
|
39
|
+
<h4 class="text-sm font-medium text-gray-500">
|
40
|
+
<%= setting.label %>
|
41
|
+
</h4>
|
42
|
+
<div class="mt-1 text-sm text-gray-900">
|
43
|
+
<%%= maglev_block.setting_tag :<%= setting.id -%> %>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
<%- end -%>
|
47
|
+
<%- end -%>
|
48
|
+
<%% end %>
|
49
|
+
<%% end %>
|
50
|
+
<%% end %>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
<%- end -%>
|
54
|
+
</div>
|
55
|
+
<%% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Please, do not change the id of the theme
|
2
|
+
id: "theme"
|
3
|
+
|
4
|
+
name: "theme"
|
5
|
+
|
6
|
+
description: "A brief description of the theme"
|
7
|
+
|
8
|
+
section_categories:
|
9
|
+
- name: content
|
10
|
+
|
11
|
+
# Properties of your theme such as the primary color, font name, ...etc.
|
12
|
+
style_settings: []
|
13
|
+
|
14
|
+
pages:
|
15
|
+
- title: "Home page"
|
16
|
+
path: "/index"
|
17
|
+
|
18
|
+
# List of CSS class names used by your library of icons (font awesome, remixicons, ...etc)
|
19
|
+
icons: []
|
20
|
+
|
21
|
+
|
22
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%%= maglev_page.seo_title.presence || maglev_site.name %></title>
|
5
|
+
<meta content="width=device-width, initial-scale=1" name="viewport">
|
6
|
+
|
7
|
+
<meta name="description" content="<%%= maglev_page.meta_description %>" />
|
8
|
+
<meta property="og:title" content="<%%= maglev_page.og_title %>" />
|
9
|
+
<meta property="og:description" content="<%%= maglev_page.og_description %>" />
|
10
|
+
<meta property="og:image" content="<%%= maglev_page.og_image_url %>" />
|
11
|
+
|
12
|
+
<%%= render_maglev_alternate_links %>
|
13
|
+
|
14
|
+
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,line-clamp"></script>
|
15
|
+
</head>
|
16
|
+
<body class="bg-white">
|
17
|
+
<main data-maglev-dropzone>
|
18
|
+
<%%= render_maglev_sections %>
|
19
|
+
</main>
|
20
|
+
</body>
|
21
|
+
</html>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maglev
|
4
|
+
module ActiveStorage
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
after_commit :save_metadata_now, on: :create
|
9
|
+
|
10
|
+
has_one_attached :file
|
11
|
+
|
12
|
+
delegate :url, :download, to: :file
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
# rubocop:disable Metrics/AbcSize
|
18
|
+
def save_metadata_now
|
19
|
+
file.analyze if file.attached?
|
20
|
+
update(
|
21
|
+
filename: file.filename.to_s,
|
22
|
+
content_type: file.content_type,
|
23
|
+
byte_size: file.byte_size,
|
24
|
+
height: file.metadata['height'],
|
25
|
+
width: file.metadata['width']
|
26
|
+
)
|
27
|
+
end
|
28
|
+
# rubocop:enable Metrics/AbcSize
|
29
|
+
|
30
|
+
module ClassMethods
|
31
|
+
def optimized
|
32
|
+
all.with_attached_file
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maglev
|
4
|
+
Config = Struct.new(:primary_color, :title, :favicon, :logo, :back_action,
|
5
|
+
:site_publishable, :uploader, :preview_host, :asset_host, :services,
|
6
|
+
:collections, :is_authenticated, :ui_locale, :default_site_locales,
|
7
|
+
:static_pages, :reserved_paths,
|
8
|
+
:admin_username, :admin_password)
|
9
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maglev
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
isolate_namespace Maglev
|
6
|
+
|
7
|
+
config.generators do |g|
|
8
|
+
g.test_framework :rspec
|
9
|
+
g.fixture_replacement :factory_bot
|
10
|
+
g.factory_bot dir: 'spec/factories'
|
11
|
+
end
|
12
|
+
|
13
|
+
config.assets.precompile += %w[maglev/logo.png maglev/favicon.png]
|
14
|
+
|
15
|
+
initializer 'maglev.theme_reloader' do |app|
|
16
|
+
require_relative './theme_filesystem_loader'
|
17
|
+
theme_path = Rails.root.join('app/theme')
|
18
|
+
theme_reloader = app.config.file_watcher.new([], { theme_path.to_s => ['.yml', 'yml'] }) do
|
19
|
+
theme_loader = Maglev::ThemeFilesystemLoader.new(
|
20
|
+
Maglev.services(context: nil).fetch_section_screenshot_path
|
21
|
+
)
|
22
|
+
Maglev.local_themes = [theme_loader.call(theme_path)]
|
23
|
+
end
|
24
|
+
|
25
|
+
app.reloaders << theme_reloader
|
26
|
+
|
27
|
+
config.to_prepare do
|
28
|
+
# everytime the code of the app or the engine changes, we reload the themes
|
29
|
+
theme_reloader.execute
|
30
|
+
end
|
31
|
+
|
32
|
+
config.after_initialize do
|
33
|
+
theme_reloader.execute
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
initializer 'maglev.i18n' do |_app|
|
38
|
+
Rails.application.config.i18n.load_path += Dir["#{config.root}/config/locales/**/*.yml"]
|
39
|
+
end
|
40
|
+
|
41
|
+
initializer 'maglev.webpacker.proxy' do |app|
|
42
|
+
insert_middleware = begin
|
43
|
+
Maglev.webpacker.config.dev_server.present?
|
44
|
+
rescue StandardError
|
45
|
+
nil
|
46
|
+
end
|
47
|
+
next unless insert_middleware
|
48
|
+
|
49
|
+
app.middleware.insert_before(
|
50
|
+
0, Webpacker::DevServerProxy,
|
51
|
+
ssl_verify_none: true,
|
52
|
+
webpacker: Maglev.webpacker
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Serves the engine's webpack when requested
|
57
|
+
initializer 'maglev.webpacker.static' do |app|
|
58
|
+
app.config.middleware.use(
|
59
|
+
Rack::Static,
|
60
|
+
urls: ['/maglev-packs'],
|
61
|
+
root: File.expand_path(File.join(__dir__, '..', '..', 'public'))
|
62
|
+
)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/lib/maglev/i18n.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# For example, the editor UI can be in English while the displayed Maglev content is in French.
|
4
|
+
# That's why we need another kind of I18n.locale only dedicated to Maglev content.
|
5
|
+
# Our Maglev::Translatable concern relies on this specific locale.
|
6
|
+
module Maglev
|
7
|
+
module I18n
|
8
|
+
class UnavailableLocaleError < RuntimeError; end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def available_locales
|
12
|
+
Current.available_locales || %i[en]
|
13
|
+
end
|
14
|
+
|
15
|
+
def available_locales=(locales)
|
16
|
+
Current.available_locales = locales.map(&:to_sym)
|
17
|
+
end
|
18
|
+
|
19
|
+
def default_locale
|
20
|
+
available_locales.first
|
21
|
+
end
|
22
|
+
|
23
|
+
def current_locale
|
24
|
+
Current.locale || default_locale
|
25
|
+
end
|
26
|
+
|
27
|
+
def current_locale=(locale)
|
28
|
+
locale = locale.to_sym
|
29
|
+
|
30
|
+
raise UnavailableLocaleError unless available_locales.include?(locale)
|
31
|
+
|
32
|
+
Current.locale = locale
|
33
|
+
end
|
34
|
+
|
35
|
+
def with_locale(locale, &block)
|
36
|
+
Current.set(locale: locale, &block)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class Current < ActiveSupport::CurrentAttributes
|
41
|
+
attribute :locale
|
42
|
+
attribute :available_locales
|
43
|
+
end
|
44
|
+
private_constant :Current
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'uri'
|
4
|
+
|
5
|
+
module Maglev
|
6
|
+
class PreviewConstraint
|
7
|
+
attr_reader :preview_host
|
8
|
+
|
9
|
+
def initialize(preview_host: nil)
|
10
|
+
@preview_host = preview_host == true ? default_preview_host : preview_host
|
11
|
+
end
|
12
|
+
|
13
|
+
def matches?(request)
|
14
|
+
%i[html xml].include?(request.format.symbol) && (!preview_host || preview_host == request.host)
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def default_preview_host
|
20
|
+
return nil if Maglev.config.preview_host.blank?
|
21
|
+
|
22
|
+
URI.parse(Maglev.config.preview_host).host # make sure we get only the host here
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maglev
|
4
|
+
class ThemeFilesystemLoader
|
5
|
+
attr_reader :fetch_section_screenshot_path
|
6
|
+
|
7
|
+
def initialize(fetch_section_screenshot_path)
|
8
|
+
@fetch_section_screenshot_path = fetch_section_screenshot_path
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(path)
|
12
|
+
theme = add(YAML.safe_load(File.read(path.join('theme.yml'))))
|
13
|
+
sections = load_sections(theme, Pathname.new(path).join('sections/**/*.yml'))
|
14
|
+
theme.sections = Maglev::Section::Store.new(sections)
|
15
|
+
theme
|
16
|
+
rescue Errno::ENOENT
|
17
|
+
Kernel.puts "Missing theme file(s) in #{path}"
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def add(hash)
|
23
|
+
attributes = hash.merge(
|
24
|
+
section_categories: Maglev::Theme::SectionCategory.build_many(hash['section_categories']),
|
25
|
+
style_settings: Maglev::Theme::StyleSetting.build_many(hash['style_settings']),
|
26
|
+
sections: []
|
27
|
+
)
|
28
|
+
|
29
|
+
Maglev::Theme.new(HashWithIndifferentAccess.new(attributes)).tap do |theme|
|
30
|
+
Rails.logger.info("[Maglev] adding theme: #{theme.name} (##{theme.id})")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def load_sections(theme, source_path)
|
35
|
+
Dir.glob(source_path).map do |path|
|
36
|
+
section_id = File.basename(path, '.yml')
|
37
|
+
attributes = YAML.safe_load(File.read(path)).with_indifferent_access
|
38
|
+
build_section(theme, section_id, attributes)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def build_section(theme, section_id, attributes)
|
43
|
+
section = Maglev::Section.build(
|
44
|
+
attributes.merge(id: section_id, theme: theme)
|
45
|
+
)
|
46
|
+
section.screenshot_timestamp = find_section_screenshot_timestamp(theme, section)
|
47
|
+
section
|
48
|
+
end
|
49
|
+
|
50
|
+
def find_section_screenshot_timestamp(theme, section)
|
51
|
+
path = fetch_section_screenshot_path.call(theme: theme, section: section, absolute: true)
|
52
|
+
File.exist?(path) ? File.mtime(path).to_i : nil
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|