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,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maglev
|
4
|
+
class Page < ApplicationRecord
|
5
|
+
## concerns ##
|
6
|
+
include Maglev::Translatable
|
7
|
+
include Maglev::SectionsConcern
|
8
|
+
include Maglev::Page::PathConcern
|
9
|
+
include Maglev::Page::SearchConcern
|
10
|
+
|
11
|
+
## translations ##
|
12
|
+
translates :title, presence: true
|
13
|
+
translates :sections
|
14
|
+
translates :seo_title, :meta_description
|
15
|
+
translates :og_title, :og_description, :og_image_url
|
16
|
+
|
17
|
+
## scopes ##
|
18
|
+
scope :home, ->(locale = nil) { by_path('index', locale) }
|
19
|
+
scope :visible, -> { where(visible: true) }
|
20
|
+
scope :by_id_or_path, lambda { |id_or_path, locale = nil|
|
21
|
+
joins(:paths).where(id: id_or_path).or(core_by_path(id_or_path, locale))
|
22
|
+
}
|
23
|
+
scope :by_path, ->(path, locale = nil) { core_by_path(path, locale).joins(:paths) }
|
24
|
+
scope :core_by_path, lambda { |path, locale = nil|
|
25
|
+
where(paths: { locale: locale || Maglev::I18n.current_locale, value: path })
|
26
|
+
}
|
27
|
+
|
28
|
+
## methods ##
|
29
|
+
|
30
|
+
def index?
|
31
|
+
path == 'index'
|
32
|
+
end
|
33
|
+
|
34
|
+
def static?
|
35
|
+
false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maglev
|
4
|
+
class PagePath < ApplicationRecord
|
5
|
+
## associations ##
|
6
|
+
belongs_to :page, class_name: 'Maglev::Page', foreign_key: 'maglev_page_id', inverse_of: :paths
|
7
|
+
|
8
|
+
## scopes ##
|
9
|
+
scope :canonical, -> { where(canonical: true) }
|
10
|
+
scope :not_canonical, -> { where(canonical: false) }
|
11
|
+
scope :by_value, ->(value, locale = nil) { where(value: value, locale: locale || Maglev::I18n.current_locale) }
|
12
|
+
|
13
|
+
## validations ##
|
14
|
+
validates :value, presence: true, exclusion: { in: Maglev.config.reserved_paths }
|
15
|
+
validates :value, uniqueness: { scope: %i[locale canonical] }, if: :canonical?
|
16
|
+
validates :canonical, uniqueness: { scope: %i[locale maglev_page_id] }, if: :canonical?
|
17
|
+
|
18
|
+
## callbacks ##
|
19
|
+
after_initialize -> { self.locale ||= Maglev::I18n.current_locale }
|
20
|
+
before_validation :clean_value!
|
21
|
+
|
22
|
+
## methods ##
|
23
|
+
|
24
|
+
## class methods ##
|
25
|
+
|
26
|
+
def self.build_hash(page_id = nil)
|
27
|
+
query = page_id ? where(maglev_page_id: page_id) : all
|
28
|
+
query.canonical.pluck(:locale, :value).to_h
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def clean_value!
|
34
|
+
return if value.blank?
|
35
|
+
|
36
|
+
self.value = clean_value
|
37
|
+
end
|
38
|
+
|
39
|
+
def clean_value
|
40
|
+
value
|
41
|
+
.strip
|
42
|
+
.gsub(%r{(^/|/$)}, '')
|
43
|
+
.gsub(%r{//+/}, '/')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
4
|
+
class Maglev::Section::Block
|
5
|
+
## concerns ##
|
6
|
+
include ActiveModel::Model
|
7
|
+
|
8
|
+
## attributes ##
|
9
|
+
attr_accessor :name, :type, :settings, :root, :accept, :limit
|
10
|
+
|
11
|
+
## validation ##
|
12
|
+
validates :name, :type, presence: true
|
13
|
+
validates :settings, 'maglev/collection': true
|
14
|
+
|
15
|
+
## methods
|
16
|
+
|
17
|
+
def root?
|
18
|
+
!!root
|
19
|
+
end
|
20
|
+
|
21
|
+
## class methods ##
|
22
|
+
|
23
|
+
def self.build(hash)
|
24
|
+
attributes = hash.slice('name', 'type', 'accept', 'root', 'limit')
|
25
|
+
attributes['root'] = true if attributes['root'].nil?
|
26
|
+
attributes['limit'] = -1 if attributes['limit'].nil?
|
27
|
+
|
28
|
+
new(
|
29
|
+
attributes.merge(
|
30
|
+
settings: Maglev::Section::Setting.build_many(hash['settings'])
|
31
|
+
)
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.build_many(list)
|
36
|
+
return [] if list.blank?
|
37
|
+
|
38
|
+
list.map { |hash| build(hash) }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
# rubocop:enable Style/ClassAndModuleChildren
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
4
|
+
module Maglev::Section::ContentConcern
|
5
|
+
def build_default_content
|
6
|
+
{
|
7
|
+
id: SecureRandom.urlsafe_base64(8),
|
8
|
+
type: id,
|
9
|
+
settings: build_default_settings_content,
|
10
|
+
blocks: build_default_blocks_content
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def build_default_settings_content(source = nil, custom_settings = nil)
|
17
|
+
return fallback_build_default_settings_content unless sample
|
18
|
+
|
19
|
+
(custom_settings || settings).map do |definition|
|
20
|
+
source ||= sample[:settings]
|
21
|
+
value = definition.build_default_content(source[definition.id.to_sym])
|
22
|
+
{ id: definition.id, value: value }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def build_default_blocks_content
|
27
|
+
return fallback_build_default_blocks_content unless sample
|
28
|
+
|
29
|
+
blocks_content = {}
|
30
|
+
|
31
|
+
sample[:blocks]&.each do |block|
|
32
|
+
build_default_block_content(block, blocks_content, nil)
|
33
|
+
end
|
34
|
+
|
35
|
+
blocks_content.values.compact
|
36
|
+
end
|
37
|
+
|
38
|
+
def build_default_block_content(block, memo, parent_id = nil)
|
39
|
+
content = core_build_default_block_content(block, parent_id)
|
40
|
+
return unless content
|
41
|
+
|
42
|
+
memo[content[:id]] = content
|
43
|
+
|
44
|
+
(block[:children] || []).each do |child_block|
|
45
|
+
build_default_block_content(child_block, memo, content[:id])
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def core_build_default_block_content(block, parent_id = nil)
|
50
|
+
settings = blocks.find { |bd| bd.type == block[:type] }&.settings
|
51
|
+
return unless settings
|
52
|
+
|
53
|
+
content = {
|
54
|
+
id: SecureRandom.urlsafe_base64(8),
|
55
|
+
type: block[:type],
|
56
|
+
settings: build_default_settings_content(block[:settings], settings)
|
57
|
+
}
|
58
|
+
|
59
|
+
content[:parent_id] = parent_id if parent_id
|
60
|
+
|
61
|
+
content
|
62
|
+
end
|
63
|
+
|
64
|
+
def fallback_build_default_settings_content(custom_settings = nil)
|
65
|
+
(custom_settings || settings).map do |definition|
|
66
|
+
{ id: definition.id, value: definition.build_default_content }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def fallback_build_default_blocks_content
|
71
|
+
return [] if blocks.blank?
|
72
|
+
|
73
|
+
blocks.map do |block|
|
74
|
+
3.times.to_a.map do
|
75
|
+
{
|
76
|
+
type: block.type,
|
77
|
+
settings: fallback_build_default_settings_content(block.settings)
|
78
|
+
}
|
79
|
+
end
|
80
|
+
end.flatten
|
81
|
+
end
|
82
|
+
end
|
83
|
+
# rubocop:enable Style/ClassAndModuleChildren
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
4
|
+
class Maglev::Section::Setting
|
5
|
+
## concerns ##
|
6
|
+
include ActiveModel::Model
|
7
|
+
|
8
|
+
## attributes ##
|
9
|
+
attr_accessor :id, :label, :type, :default, :options
|
10
|
+
|
11
|
+
## validations ##
|
12
|
+
validates :id, :label, :type, :default, 'maglev/presence': true
|
13
|
+
validates :type, inclusion: { in: %w[text image checkbox link color select collection_item icon] }
|
14
|
+
|
15
|
+
## methods ##
|
16
|
+
|
17
|
+
# NOTE: any modification to that method must be reflected to the JS editor
|
18
|
+
def build_default_content(custom_default = nil)
|
19
|
+
default = custom_default.nil? ? self.default : custom_default
|
20
|
+
case type.to_sym
|
21
|
+
when :image then build_default_image_content(default)
|
22
|
+
when :link then build_default_link_content(default)
|
23
|
+
when :checkbox then build_default_checkbox_content(default)
|
24
|
+
else
|
25
|
+
default || label
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def build_default_image_content(default)
|
30
|
+
default.is_a?(String) ? { url: default } : default || {}
|
31
|
+
end
|
32
|
+
|
33
|
+
def build_default_link_content(default)
|
34
|
+
default.is_a?(String) ? { link_type: 'url', href: default } : { link_type: 'url', href: '#' }.merge(default)
|
35
|
+
end
|
36
|
+
|
37
|
+
def build_default_checkbox_content(default)
|
38
|
+
default.presence || false
|
39
|
+
end
|
40
|
+
|
41
|
+
## class methods ##
|
42
|
+
def self.build(hash)
|
43
|
+
attributes = hash.slice('id', 'label', 'type', 'default')
|
44
|
+
options = hash.except('id', 'label', 'type', 'default')
|
45
|
+
|
46
|
+
new(attributes.merge(options: options))
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.build_many(list)
|
50
|
+
list.map { |hash| build(hash) }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
# rubocop:enable Style/ClassAndModuleChildren
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maglev
|
4
|
+
class Section
|
5
|
+
include ActiveModel::Model
|
6
|
+
include ActiveModel::Serializers::JSON
|
7
|
+
include ::Maglev::Section::ContentConcern
|
8
|
+
|
9
|
+
HASH_ATTRIBUTES = %w[id theme name site_scoped singleton viewport_fixed_position insert_button max_width_pane
|
10
|
+
insert_at category blocks_label blocks_presentation sample screenshot_timestamp].freeze
|
11
|
+
|
12
|
+
## attributes ##
|
13
|
+
attr_accessor :id, :theme, :name, :category,
|
14
|
+
:site_scoped, :singleton, :viewport_fixed_position,
|
15
|
+
:insert_button, :insert_at, :max_width_pane,
|
16
|
+
:settings, :blocks, :blocks_label, :blocks_presentation,
|
17
|
+
:sample, :screenshot_timestamp
|
18
|
+
|
19
|
+
## validations ##
|
20
|
+
validates :id, :theme, :name, :category, presence: true
|
21
|
+
validates :settings, 'maglev/collection': true
|
22
|
+
validates :blocks, 'maglev/collection': true
|
23
|
+
|
24
|
+
## methods ##
|
25
|
+
|
26
|
+
def site_scoped?
|
27
|
+
!!site_scoped
|
28
|
+
end
|
29
|
+
|
30
|
+
def singleton?
|
31
|
+
!!singleton
|
32
|
+
end
|
33
|
+
|
34
|
+
def viewport_fixed_position?
|
35
|
+
!!viewport_fixed_position?
|
36
|
+
end
|
37
|
+
|
38
|
+
## class methods ##
|
39
|
+
def self.build(hash)
|
40
|
+
attributes = prepare_attributes(hash)
|
41
|
+
|
42
|
+
new(
|
43
|
+
attributes.merge(
|
44
|
+
settings: ::Maglev::Section::Setting.build_many(hash['settings']),
|
45
|
+
blocks: ::Maglev::Section::Block.build_many(hash['blocks'])
|
46
|
+
)
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.prepare_attributes(hash)
|
51
|
+
attributes = hash.slice(*HASH_ATTRIBUTES)
|
52
|
+
|
53
|
+
%w[site_scoped singleton viewport_fixed_position max_width_pane].each do |name|
|
54
|
+
attributes[name] = false if attributes[name].nil?
|
55
|
+
end
|
56
|
+
|
57
|
+
attributes['insert_button'] = true if attributes['insert_button'].nil?
|
58
|
+
|
59
|
+
attributes
|
60
|
+
end
|
61
|
+
|
62
|
+
class Store
|
63
|
+
extend Forwardable
|
64
|
+
def_delegators :@array, :all, :first, :last, :count, :each, :each_with_index, :map, :group_by
|
65
|
+
|
66
|
+
attr_reader :array
|
67
|
+
|
68
|
+
def initialize(array)
|
69
|
+
@array = array
|
70
|
+
end
|
71
|
+
|
72
|
+
def find(id)
|
73
|
+
@array.find { |section| section.id == id }
|
74
|
+
end
|
75
|
+
|
76
|
+
def grouped_by_category
|
77
|
+
@array.group_by(&:category)
|
78
|
+
end
|
79
|
+
|
80
|
+
def as_json(**_options)
|
81
|
+
@array.as_json
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
4
|
+
class Maglev::Site::Locale
|
5
|
+
## concerns ##
|
6
|
+
include ActiveModel::Model
|
7
|
+
|
8
|
+
## attributes ##
|
9
|
+
attr_accessor :label, :prefix
|
10
|
+
|
11
|
+
## validations ##
|
12
|
+
validates :label, :prefix, 'maglev/presence': true
|
13
|
+
|
14
|
+
## methods ##
|
15
|
+
def as_json(_options = nil)
|
16
|
+
{ label: label, prefix: prefix }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
# rubocop:enable Style/ClassAndModuleChildren
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
4
|
+
module Maglev::Site::LocalesConcern
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
## serializers ##
|
9
|
+
serialize :locales, LocalesSerializer
|
10
|
+
|
11
|
+
## validation ##
|
12
|
+
validates :locales, 'maglev/collection': true, length: { minimum: 1 }
|
13
|
+
end
|
14
|
+
|
15
|
+
def default_locale
|
16
|
+
locales.first
|
17
|
+
end
|
18
|
+
|
19
|
+
def default_locale_prefix
|
20
|
+
default_locale.prefix.to_sym
|
21
|
+
end
|
22
|
+
|
23
|
+
def locale_prefixes
|
24
|
+
locales.map { |locale| locale.prefix.to_sym }
|
25
|
+
end
|
26
|
+
|
27
|
+
class LocalesSerializer
|
28
|
+
def self.dump(array)
|
29
|
+
(array || []).map(&:as_json)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.load(array)
|
33
|
+
(array || []).map { |attributes| Maglev::Site::Locale.new(**attributes.symbolize_keys) }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
# rubocop:enable Style/ClassAndModuleChildren
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
4
|
+
class Maglev::Site::StyleValue
|
5
|
+
## attributes ##
|
6
|
+
attr_accessor :id, :value, :type
|
7
|
+
|
8
|
+
def initialize(id, type, value)
|
9
|
+
@id = id
|
10
|
+
@type = type
|
11
|
+
@value = value
|
12
|
+
end
|
13
|
+
|
14
|
+
class Store
|
15
|
+
extend Forwardable
|
16
|
+
def_delegators :@array, :all, :first, :last, :count, :each, :each_with_index, :map, :group_by
|
17
|
+
|
18
|
+
attr_reader :array
|
19
|
+
|
20
|
+
def initialize(array)
|
21
|
+
@array = array
|
22
|
+
end
|
23
|
+
|
24
|
+
def method_missing(method_name, *_args)
|
25
|
+
setting = array.find { |local_setting| local_setting.id == method_name.to_s }
|
26
|
+
if setting
|
27
|
+
setting.value
|
28
|
+
else
|
29
|
+
super
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def respond_to_missing?(method_name, include_private = false)
|
34
|
+
Rails.logger.debug 'yeasss!!!'
|
35
|
+
array.map(&:id).include?(method_name.to_s) || super
|
36
|
+
end
|
37
|
+
|
38
|
+
def as_json(**_options)
|
39
|
+
@array.as_json
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
# rubocop:enable Style/ClassAndModuleChildren
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maglev
|
4
|
+
class Site < ApplicationRecord
|
5
|
+
## concerns ##
|
6
|
+
include Maglev::Site::LocalesConcern
|
7
|
+
include Maglev::SectionsConcern
|
8
|
+
include Maglev::Translatable
|
9
|
+
|
10
|
+
## translations ##
|
11
|
+
translates :sections
|
12
|
+
|
13
|
+
## validations ##
|
14
|
+
validates :name, presence: true
|
15
|
+
|
16
|
+
## methods ##
|
17
|
+
def api_attributes
|
18
|
+
%i[id name]
|
19
|
+
end
|
20
|
+
|
21
|
+
def find_section(type)
|
22
|
+
sections&.find { |section| section['type'] == type }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maglev
|
4
|
+
# Mimic the Page model
|
5
|
+
class StaticPage
|
6
|
+
## concerns ##
|
7
|
+
include ActiveModel::Model
|
8
|
+
include Maglev::Translatable
|
9
|
+
|
10
|
+
## attributes ##
|
11
|
+
attr_accessor :id, :title_translations, :path_translations,
|
12
|
+
:seo_title_translations, :meta_description_translations,
|
13
|
+
:og_title_translations, :og_description_translations, :og_image_url_translations
|
14
|
+
|
15
|
+
## translations ##
|
16
|
+
translates :title, :path, :seo_title, :meta_description, :og_title, :og_description, :og_image_url
|
17
|
+
|
18
|
+
## methods ##
|
19
|
+
|
20
|
+
def visible
|
21
|
+
true
|
22
|
+
end
|
23
|
+
|
24
|
+
def static?
|
25
|
+
true
|
26
|
+
end
|
27
|
+
|
28
|
+
def sections
|
29
|
+
[]
|
30
|
+
end
|
31
|
+
|
32
|
+
def path_hash
|
33
|
+
path_translations
|
34
|
+
end
|
35
|
+
|
36
|
+
def lock_version
|
37
|
+
0
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
4
|
+
class Maglev::Theme::SectionCategory
|
5
|
+
## concerns ##
|
6
|
+
include ActiveModel::Model
|
7
|
+
|
8
|
+
## attributes ##
|
9
|
+
attr_accessor :name, :id
|
10
|
+
|
11
|
+
## class methods ##
|
12
|
+
|
13
|
+
def self.build(hash)
|
14
|
+
attributes = hash.slice('name', 'id')
|
15
|
+
attributes['id'] ||= attributes['name'].parameterize(separator: '_')
|
16
|
+
new(attributes)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.build_many(list)
|
20
|
+
(list || []).map { |hash| build(hash) }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
# rubocop:enable Style/ClassAndModuleChildren
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
4
|
+
class Maglev::Theme::StyleSetting
|
5
|
+
## concerns ##
|
6
|
+
include ActiveModel::Model
|
7
|
+
|
8
|
+
## attributes ##
|
9
|
+
attr_accessor :id, :label, :type, :default, :options
|
10
|
+
|
11
|
+
## validations ##
|
12
|
+
validates :id, :label, :type, :default, 'maglev/presence': true
|
13
|
+
validates :type, inclusion: { in: %w[text color select checkbox] }
|
14
|
+
|
15
|
+
## methods ##
|
16
|
+
|
17
|
+
# NOTE: any modification to that method must be reflected to the JS editor
|
18
|
+
def build_default_content(custom_default = nil)
|
19
|
+
default = custom_default || self.default
|
20
|
+
case type.to_sym
|
21
|
+
when :checkbox then build_default_checkbox_content(default)
|
22
|
+
else
|
23
|
+
default || label
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def build_default_checkbox_content(default)
|
28
|
+
!default.nil?
|
29
|
+
end
|
30
|
+
|
31
|
+
## class methods ##
|
32
|
+
def self.build(hash)
|
33
|
+
attributes = hash.slice('id', 'label', 'type', 'default')
|
34
|
+
options = hash.except('id', 'label', 'type', 'default')
|
35
|
+
|
36
|
+
new(attributes.merge(options: options))
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.build_many(list)
|
40
|
+
list.map { |hash| build(hash) }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
# rubocop:enable Style/ClassAndModuleChildren
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maglev
|
4
|
+
class Theme
|
5
|
+
## concerns ##
|
6
|
+
include ActiveModel::Model
|
7
|
+
|
8
|
+
## attributes ##
|
9
|
+
attr_accessor :id, :name, :description, :section_categories, :sections, :style_settings, :pages, :icons
|
10
|
+
|
11
|
+
## validations ##
|
12
|
+
validates :id, :name, presence: true
|
13
|
+
|
14
|
+
## methods ##
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
4
|
+
module Maglev::GetPageSections::TransformCollectionItemConcern
|
5
|
+
def transform_collection_item_content_setting(content, setting)
|
6
|
+
item_id = content.dig('value', 'id')
|
7
|
+
return if item_id.blank?
|
8
|
+
|
9
|
+
item = fetch_collection_items.call(
|
10
|
+
collection_id: setting.options[:collection_id],
|
11
|
+
id: item_id
|
12
|
+
)
|
13
|
+
|
14
|
+
content['value']['label'] = item.label
|
15
|
+
content['value']['item'] = item.source
|
16
|
+
end
|
17
|
+
end
|
18
|
+
# rubocop:enable Style/ClassAndModuleChildren
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
4
|
+
module Maglev::GetPageSections::TransformLinkConcern
|
5
|
+
def transform_link_content_setting(content, _setting)
|
6
|
+
return unless content['value'].is_a?(Hash) && %w[page static_page].include?(content.dig('value', 'link_type'))
|
7
|
+
|
8
|
+
content['value'] = replace_href_in_link(content['value'])
|
9
|
+
end
|
10
|
+
|
11
|
+
def replace_href_in_link(link)
|
12
|
+
path = get_fullpath_from_link(link)
|
13
|
+
|
14
|
+
if path
|
15
|
+
anchor = link['section_id']
|
16
|
+
link['href'] = anchor.present? ? "#{path}#section-#{anchor}" : path
|
17
|
+
end
|
18
|
+
|
19
|
+
link
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_fullpath_from_link(link)
|
23
|
+
is_static_page = link['link_type'] == 'static_page'
|
24
|
+
page_id = link['link_id']
|
25
|
+
|
26
|
+
# since the static pages don't have a preview version, we need the raw url
|
27
|
+
if is_static_page
|
28
|
+
page = fetch_static_pages.call.find { |static_page| static_page.id == page_id }
|
29
|
+
page&.path
|
30
|
+
else
|
31
|
+
get_page_fullpath.call(page: page_id, locale: locale)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
# rubocop:enable Style/ClassAndModuleChildren
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Style/ClassAndModuleChildren
|
4
|
+
module Maglev::GetPageSections::TransformTextConcern
|
5
|
+
def transform_text_content_setting(content, setting)
|
6
|
+
return unless setting.options['html']
|
7
|
+
|
8
|
+
content['value'] = replace_links_in_text(content['value'])
|
9
|
+
end
|
10
|
+
|
11
|
+
def replace_links_in_text(text)
|
12
|
+
text.gsub(/<a([^>]+)>/) do |tag|
|
13
|
+
link_type_matches = tag.match(/maglev-link-type="([^"]+)"/)
|
14
|
+
link_id_matches = tag.match(/maglev-link-id="([^"]+)"/)
|
15
|
+
section_id_matches = tag.match(/maglev-section-id="([^"]+)"/)
|
16
|
+
path = find_link_page_path(link_type_matches, link_id_matches, section_id_matches)
|
17
|
+
|
18
|
+
tag.gsub!(/href="([^"]+)"/, "href=\"#{path}\"") if path
|
19
|
+
|
20
|
+
tag
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def find_link_page_path(link_type_matches, link_id_matches, section_id_matches)
|
25
|
+
return unless link_type_matches && link_id_matches
|
26
|
+
|
27
|
+
# rubocop:disable Style/StringHashKeys
|
28
|
+
link = { 'link_type' => link_type_matches[1], 'link_id' => link_id_matches[1] }
|
29
|
+
# rubocop:enable Style/StringHashKeys
|
30
|
+
|
31
|
+
return unless %w[page static_page].include?(link['link_type'])
|
32
|
+
|
33
|
+
link['section_id'] = section_id_matches[1] if section_id_matches
|
34
|
+
|
35
|
+
replace_href_in_link(link)['href']
|
36
|
+
end
|
37
|
+
end
|
38
|
+
# rubocop:enable Style/ClassAndModuleChildren
|