maglevhq / maglev-core Goto Github PK
View Code? Open in Web Editor NEWRuby on Rails page builder
Home Page: https://www.maglev.dev
License: MIT License
Ruby on Rails page builder
Home Page: https://www.maglev.dev
License: MIT License
We are not using sprockets in our app, but the engine config calls this line:
config.assets.precompile += %w[maglev/logo.png maglev/favicon.png]
Which is a sprockets config. How can we skip that?
(we are using cssbundling-rails jsbundling-rails and propshaft)
Section generator produces options
to specify the available options for select
settings, the dropdown in the editor is empty until we rename it to select_options
.
Create a new section with select
settings, e.g.:
bundle exec rails generate maglev:section section_01 \
--category=content \
--settings foo:select block:list_item:bar:select
The options listed in the editor dropdown.
The dropdown in the editor is empty.
--- a/app/theme/sections/content/section_01.yml [EXPECTATION]
+++ b/app/theme/sections/content/section_01.yml [ACTUAL]
@@ -1,67 +1,67 @@
# Name of the section displayed in the editor UI
name: "Section 01"
# Category of the section in the editor UI (headers, features, testimonials, ...etc)
category: content
# A section might have the same content all over the site, like a menu or a footer for instance.
# To enable this behavior, uncomment the following statement
# site_scoped: true
# Display or not the button to insert a new section after this one
# insert_button: false
# Insert this section at the top or the bottom of the page (default: nil)
# insert_at: top
# One single instance per page?
# singleton: true
# Definition of the settings:
# A setting type can be one of the following values: text, image, link, collection_item, checkbox, color and icon.
# Please visit: https://docs.maglev.dev/concepts/setting for more explanation.
settings:
- label: "Foo"
id: foo
type: select
- select_options:
+ options:
- label: Option 1
value: option_1
- label: Option 2
value: option_2
default: option_1
# Definition of the blocks.
# You can define as many types of blocks as you want.
blocks:
- name: "List item"
type: list_item
settings:
- label: "Bar"
id: bar
type: select
- select_options:
+ options:
- label: Option 1
value: option_1
- label: Option 2
value: option_2
default: option_1
# By default, in the editor UI, blocks will be listed below the "Content" title.
# The title can be changed with the following property:
# blocks_label: "My list of items"
# By default, blocks are presented as a list in the editor UI.
# If you like to use blocks to build a menu with sub menu items,
# consider using the tree presentation
# blocks_presentation: "tree"
# In order to get a section with "meaning" content for the editors,
# you can set the default content of a new instance of this section.
# (it's also be useful when taking a screenshot of the section).
# sample:
# settings:
# foo: option_1
# blocks:
# - type: list_item
# settings:
# bar: option_1
Maglev version: 1.1.7
Rails version: 7.0.4.2
Ruby version: 3.2.0
If lost on the internet one of my strategies to reorient myself is to move my cursor to the top left corner of the viewport and click the logo
I am trying to make it possible to view the entire collection_item records when the select input is empty, instead of showing no records. I wanted to override the js files so it triggers the fetch when it is empty
Is this currently possible?
If, say, a home page has an English and a French version, one could provide a language switcher as follows:
However, when switching language from other pages (e.g. Careers), the viewer will then be redirected to the home page instead of being shown the Careers page in the alternate language. How to ensure each page's language switcher links to its alternative language version(s) instead of linking back home?
in package.json file currently
"vite-plugin-ruby": "^3.1.2",
please update it to
"vite-plugin-ruby": "^3.2.2",
so it can fix this error
vite_ruby/compatibility_check.rb:24:in
raise_unless_satisfied': vite-plugin-ruby@^3.1.2 might not be compatible with vite_ruby-3.3.2 (ArgumentError)
You may disable this check if needed: https://vite-ruby.netlify.app/config/#skipcompatibilitycheck
`
I'm trying to use the collections feature to pull in an ActiveRecord model. I believe the settings for a section should determine which collection is called, but unless the collection is name products, it doesn't work, and you see a 500 error in the logs.
The API call here uses a hardcoded value, products, so the API call won't work if you have a collection of any other name.
Thanks for this great library! I've been looking for something like this for a while.
Hello there
I would like to learn more about the PRO version of Maglev Theme Builder. Please describe the pricing and the detailed list of features that come with the PRO version.
I also dropped the mail regarding it, but I didn't get any response regarding it. If there is any option, please let me know.
Thanks and Regards
https://docs.maglev.dev/pro/introduction
https://docs.maglev.dev/pro/getting-started
pages:
- title:
en: "Home page"
fr: "Page d'accueil"
path: "index"
sections:
en:
- type: "jumbotron"
settings:
title: "Let's create the product<br/>your clients<br/>will love."
body: "<p>NoCoffee, passionated developers,<br/>creators of web applications, mobiles apps and<br/>fancy R&D projects.</p>"
blocks: []
- type: "showcase"
settings:
title: "Our projects"
blocks: []
fr: []
Update: the installation requires Node v16, and fails for Node v18.
Running the "Short version" quick start (with importmaps) is currently failing; with the following error somewhere in the logs.
At various points I see this repeated:
Missing theme file(s) in /Users/drnic/workspace/maglev-demo/my-awesome-site/app/theme
Missing theme file(s) in /Users/drnic/workspace/maglev-demo/my-awesome-site/app/theme
For the yarn install
there is this error:
yarn install v1.22.19
[1/4] 🔍 Resolving packages...
success Already up-to-date.
✨ Done in 0.18s.
Compiling...
Compilation failed:
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
node:internal/crypto/hash:71
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (/Users/drnic/.rvm/gems/ruby-3.1.2/gems/maglevcms-1.0.0/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/Users/drnic/.rvm/gems/ruby-3.1.2/gems/maglevcms-1.0.0/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/Users/drnic/.rvm/gems/ruby-3.1.2/gems/maglevcms-1.0.0/node_modules/webpack/lib/NormalModule.js:471:10)
at /Users/drnic/.rvm/gems/ruby-3.1.2/gems/maglevcms-1.0.0/node_modules/webpack/lib/NormalModule.js:503:5
at /Users/drnic/.rvm/gems/ruby-3.1.2/gems/maglevcms-1.0.0/node_modules/webpack/lib/NormalModule.js:358:12
at /Users/drnic/.rvm/gems/ruby-3.1.2/gems/maglevcms-1.0.0/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/drnic/.rvm/gems/ruby-3.1.2/gems/maglevcms-1.0.0/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/Users/drnic/.rvm/gems/ruby-3.1.2/gems/maglevcms-1.0.0/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
at /Users/drnic/.rvm/gems/ruby-3.1.2/gems/maglevcms-1.0.0/node_modules/loader-runner/lib/LoaderRunner.js:236:3
at context.callback (/Users/drnic/.rvm/gems/ruby-3.1.2/gems/maglevcms-1.0.0/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /Users/drnic/.rvm/gems/ruby-3.1.2/gems/maglevcms-1.0.0/node_modules/babel-loader/lib/index.js:59:71
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.7.0
Later, when you visit http://localhost:3000/maglev/editor/en/index the error is:
Webpacker::Manifest::MissingEntryError in Maglev::Editor#show
Webpacker can't find editor.js
This failure occurs for importmaps
, esbuild
, and webpacker
.
Full logs for importmaps (default) https://gist.github.com/drnic/dc8790d4141b2db615a9d9ba90a1a2ac
Perhaps unrelated but noted: even though it is importmaps by default, the logs include rake maglev:webpacker:compile
In the logs it appears I was using node v18.7.0
, but it also failed for latest node 18 v18.12.0
OOOh, it works for node v16!
Hi!
I am trying to install the latest version of maglev. Installing through
rails new my-awesome-site \
-m https://raw.githubusercontent.com/maglevhq/maglev-core/master/template.rb \
--database=postgresql \
--skip-action-cable
An error appears during installation
Apparently because of this I can't get into the editor http://localhost:3000/maglev/editor/en/index
It might be a problem with my yarn (?). But to be honest I don't understand where to dig to fix this error
Section generator produces url
to specify the URL for sample and default value of link
settings, but the editor didn't pick it up until we rename it to href
.
Create a new section with link
settings, e.g.:
bundle exec rails generate maglev:section section_01 \
--category=content \
--settings call_to_action:link block:list_item:item_link:link
Generates sample
and default
values in correct format: { text: "Link", href: "#" }
.
Generates sample
and default
values in incorrect format: { text: "Link", url: "#" }
.
--- a/app/theme/sections/content/section_01.yml [EXPECTATION]
+++ b/app/theme/sections/content/section_01.yml [ACTUAL]
@@ -1,59 +1,59 @@
# Name of the section displayed in the editor UI
name: "Section 01"
# Category of the section in the editor UI (headers, features, testimonials, ...etc)
category: content
# A section might have the same content all over the site, like a menu or a footer for instance.
# To enable this behavior, uncomment the following statement
# site_scoped: true
# Display or not the button to insert a new section after this one
# insert_button: false
# Insert this section at the top or the bottom of the page (default: nil)
# insert_at: top
# One single instance per page?
# singleton: true
# Definition of the settings:
# A setting type can be one of the following values: text, image, link, collection_item, checkbox, color and icon.
# Please visit: https://docs.maglev.dev/concepts/setting for more explanation.
settings:
- label: "Call to action"
id: call_to_action
type: link
with_text: true
- default: { text: "Link", href: "#" }
+ default: { text: "Link", url: "#" }
# Definition of the blocks.
# You can define as many types of blocks as you want.
blocks:
- name: "List item"
type: list_item
settings:
- label: "Item link"
id: item_link
type: link
with_text: true
- default: { text: "Link", href: "#" }
+ default: { text: "Link", url: "#" }
# By default, in the editor UI, blocks will be listed below the "Content" title.
# The title can be changed with the following property:
# blocks_label: "My list of items"
# By default, blocks are presented as a list in the editor UI.
# If you like to use blocks to build a menu with sub menu items,
# consider using the tree presentation
# blocks_presentation: "tree"
# In order to get a section with "meaning" content for the editors,
# you can set the default content of a new instance of this section.
# (it's also be useful when taking a screenshot of the section).
# sample:
# settings:
-# call_to_action: { text: "Link", href: "#" }
+# call_to_action: { text: "Link", url: "#" }
# blocks:
# - type: list_item
# settings:
-# item_link: { text: "Link", href: "#" }
+# item_link: { text: "Link", url: "#" }
Maglev version: 1.1.7
Rails version: 7.0.4.2
Ruby version: 3.2.0
Allow the developer of a theme to specify a list of custom attributes related to her/his theme such as the primary color or the font.
I've setup active_storage but uploads keep failing...
Started POST "/maglev/api/assets" for ::1 at 2023-12-07 21:35:31 -0500
Processing by Maglev::Api::AssetsController#create as JSON
Parameters: {"asset"=>{"file"=>#<ActionDispatch::Http::UploadedFile:0x000000010b8925e0 @tempfile=#<Tempfile:/var/folders/fd/04qkytls0xxc3nhjyccdw3vm0000gn/T/RackMultipart20231207-22731-6ci014.jpg>, @content_type="image/jpeg", @original_filename="fabian-centeno-uY60pJUHqOo-unsplash.jpg", @headers="Content-Disposition: form-data; name=\"asset[file]\"; filename=\"fabian-centeno-uY60pJUHqOo-unsplash.jpg\"\r\nContent-Type: image/jpeg\r\n">}}
Maglev::Site Load (0.5ms) SELECT "maglev_sites".* FROM "maglev_sites" ORDER BY "maglev_sites"."id" ASC LIMIT $1 [["LIMIT", 1]]
TRANSACTION (1.3ms) BEGIN
Maglev::Asset Create (1.4ms) INSERT INTO "maglev_assets" ("filename", "content_type", "width", "height", "byte_size", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id" [["filename", nil], ["content_type", nil], ["width", nil], ["height", nil], ["byte_size", nil], ["created_at", "2023-12-08 02:35:31.630188"], ["updated_at", "2023-12-08 02:35:31.630188"]]
ActiveStorage::Attachment Load (2.1ms) SELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_id" = $1 AND "active_storage_attachments"."record_type" = $2 AND "active_storage_attachments"."name" = $3 LIMIT $4 [["record_id", nil], ["record_type", "Maglev::Asset"], ["name", "file"], ["LIMIT", 1]]
ActiveStorage::Blob Create (1.6ms) INSERT INTO "active_storage_blobs" ("key", "filename", "content_type", "metadata", "service_name", "byte_size", "checksum", "created_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["key", "002ab95u4hdex998jpobmw5cpc4u"], ["filename", "fabian-centeno-uY60pJUHqOo-unsplash.jpg"], ["content_type", "image/jpeg"], ["metadata", "{\"identified\":true}"], ["service_name", "local"], ["byte_size", 1583948], ["checksum", "f1y2gVRUElO71YtYCE0nZw=="], ["created_at", "2023-12-08 02:35:31.637841"]]
ActiveStorage::Attachment Create (1.3ms) INSERT INTO "active_storage_attachments" ("name", "record_type", "record_id", "blob_id", "created_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "file"], ["record_type", "Maglev::Asset"], ["record_id", nil], ["blob_id", "89625400-95c5-42d7-9e8d-b91cb8fdf3b3"], ["created_at", "2023-12-08 02:35:31.640474"]]
TRANSACTION (0.4ms) ROLLBACK
Completed 500 Internal Server Error in 51ms (ActiveRecord: 20.4ms | Allocations: 38835)
`
ActiveRecord::NotNullViolation (PG::NotNullViolation: ERROR: null value in column "record_id" of relation "active_storage_attachments" violates not-null constraint
DETAIL: Failing row contains (4c6ed3a7-1022-467d-a048-1cc0e427e416, file, Maglev::Asset, null, 89625400-95c5-42d7-9e8d-b91cb8fdf3b3, 2023-12-08 02:35:31.640474).
):
A javascript error pops up before the Rails app API gets hit.
Alt text form fields of image
settings are not populated with their stored values after the editor reloaded.
Generate a new section with an image
setting
rails generate maglev:section section_01 \
--category=content \
--settings photo:image
Run the server
rails server
Open the editor: http://localhost:3000/maglev/editor
Add the section into a page
Fill in the Alt text form field
Save the page
Reload the browser
The Alt text form field is populated with the saved value.
The Alt text form field is empty.
Maglev version: 1.1.7
Rails version: 7.0.4.2
Ruby version: 3.2.0
Searching by path does not return expected results.
Steps:
Gem versions:
maglev-injectable (2.1.1) maglevcms (1.2.2) jbuilder (~> 2.11.2) kaminari (~> 1.2.1) maglev-injectable (~> 2.1.1) rails (>= 6, <= 7.1) vite_rails (>= 3, <= 4) maglevcms-hyperui-kit (1.1.0)
Maglev::Page Load (1.2ms) SELECT DISTINCT "maglev_pages".*, "maglev_pages"."title_translations" ->> 'en' FROM "maglev_pages" INNER JOIN "maglev_page_paths" ON "maglev_page_paths"."maglev_page_id" = "maglev_pages"."id" WHERE ("maglev_pages"."title_translations" ->> 'en' ILIKE '%chapters%' OR "maglev_page_paths"."value" ILIKE '%chapters%' AND "maglev_page_paths"."value" = 'en') ORDER BY "maglev_pages"."title_translations" ->> 'en' ASC
It seems like the search query should be:
maglev_page_paths"."locale" = 'en'
Seems the gem is a wee bit fussy with Rails versions as I needed to fork it for a Rails 7.1 project. I haven't ran into any issues with functionality so I propose you push up the gem spec requirements.
I'm trying to install maglev by running:
bundle exec rails g maglev:install
However, that throws the following error:
/Users/XXXX/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/vite_ruby-3.3.4/lib/vite_ruby/compatibility_check.rb:24:in raise_unless_satisfied': vite-plugin-ruby@^3.1.2 might not be compatible with vite_ruby-3.3.4 (ArgumentError)
Maybe an hour ago I've remembered that I had read something in last week's Ruby Weekly about a new implementation attempt of a mountable rails CMS engine.
The crazy thing is: I correctly remembered the name – "maglev" !
Thing is: There are a couple software projects with the exact same name. Even in open source ruby space. It took me some time to get here.
What about just an innocent unique short string (like "ogep" or something)?
Forgive if I am asking in the wrong place, I see in the roadmap you are working on a headless version that would support NextJS. Is there an expected completion time before we go investing in building a full stack Rails site?
bundle exec rails g maglev:section --category=new-category
would let the developers generate the section but it won't show up in the editor UI if the new-category
category has not been registered in the theme.yml file.
I ran the Maglev Avo demo and encountered the above error after creating some blog page in Avo then adding some section in the maglev admin interface. It is generated in:
maglevcms (1.1.7) app/services/concerns/maglev/get_page_sections/transform_collection_item_concern.rb:6:in `dig'
This happens with the editor interface itself (http://localhost:3000/maglev/editor/en/index), so there is no way to recover from the error. Restarting bin/dev does not help. I could also go back to the Avo admin interface and delete the blog page I had created, but the persists in maglev.
19:36:20 web.1 | maglevcms (1.1.7) app/services/concerns/maglev/get_page_sections/transform_collection_item_concern.rb:6:in `dig'
19:36:20 web.1 | maglevcms (1.1.7) app/services/concerns/maglev/get_page_sections/transform_collection_item_concern.rb:6:in `transform_collection_item_content_setting'
19:36:20 web.1 | maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:94:in `transform_content_setting'
19:36:20 web.1 | maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:83:in `block in transform_section_settings'
19:36:20 web.1 | maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:79:in `each'
19:36:20 web.1 | maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:79:in `transform_section_settings'
19:36:20 web.1 | maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:46:in `transform_section'
19:36:20 web.1 | maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:25:in `block in call'
19:36:20 web.1 | maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:24:in `map'
19:36:20 web.1 | maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:24:in `call'
19:36:20 web.1 | maglev-injectable (2.1.1) lib/injectable/instance_methods.rb:18:in `call'
19:36:20 web.1 | maglevcms (1.1.7) app/controllers/concerns/maglev/fetchers_concern.rb:38:in `fetch_maglev_page_sections'
19:36:20 web.1 | maglevcms (1.1.7) app/controllers/maglev/page_preview_controller.rb:31:in `fetch_maglev_page_sections'
19:36:20 web.1 | maglevcms (1.1.7) app/controllers/concerns/maglev/fetchers_concern.rb:21:in `fetch_maglev_page_content'
19:36:20 web.1 | maglevcms (1.1.7) app/controllers/concerns/maglev/rendering_concern.rb:16:in `render_maglev_page'
19:36:20 web.1 | maglevcms (1.1.7) app/controllers/maglev/page_preview_controller.rb:13:in `index'
19:36:20 web.1 | actionpack (7.0.4) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
19:36:20 web.1 | actionpack (7.0.4) lib/abstract_controller/base.rb:215:in `process_action'
19:36:20 web.1 | actionpack (7.0.4) lib/action_controller/metal/rendering.rb:53:in `process_action'
19:36:20 web.1 | actionpack (7.0.4) lib/abstract_controller/callbacks.rb:234:in `block in process_action'
19:36:20 web.1 | activesupport (7.0.4) lib/active_support/callbacks.rb:118:in `block in run_callbacks'
19:36:20 web.1 | actiontext (7.0.4) lib/action_text/rendering.rb:20:in `with_renderer'
19:36:20 web.1 | actiontext (7.0.4) lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'
19:36:20 web.1 | activesupport (7.0.4) lib/active_support/callbacks.rb:127:in `instance_exec'
19:36:20 web.1 | activesupport (7.0.4) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
19:36:20 web.1 | activesupport (7.0.4) lib/active_support/callbacks.rb:138:in `run_callbacks'
19:36:20 web.1 | actionpack (7.0.4) lib/abstract_controller/callbacks.rb:233:in `process_action'
19:36:20 web.1 | actionpack (7.0.4) lib/action_controller/metal/rescue.rb:22:in `process_action'
19:36:20 web.1 | actionpack (7.0.4) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
19:36:20 web.1 | activesupport (7.0.4) lib/active_support/notifications.rb:206:in `block in instrument'
19:36:20 web.1 | activesupport (7.0.4) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
19:36:20 web.1 | activesupport (7.0.4) lib/active_support/notifications.rb:206:in `instrument'
19:36:20 web.1 | actionpack (7.0.4) lib/action_controller/metal/instrumentation.rb:66:in `process_action'
19:36:20 web.1 | actionpack (7.0.4) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
19:36:20 web.1 | activerecord (7.0.4) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
19:36:20 web.1 | actionpack (7.0.4) lib/abstract_controller/base.rb:151:in `process'
19:36:20 web.1 | actionview (7.0.4) lib/action_view/rendering.rb:39:in `process'
19:36:20 web.1 | actionpack (7.0.4) lib/action_controller/metal.rb:188:in `dispatch'
19:36:20 web.1 | actionpack (7.0.4) lib/action_controller/metal.rb:251:in `dispatch'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/routing/route_set.rb:32:in `serve'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/routing/mapper.rb:48:in `serve'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/journey/router.rb:50:in `block in serve'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/journey/router.rb:32:in `each'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/journey/router.rb:32:in `serve'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/routing/route_set.rb:852:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/static.rb:23:in `call'
19:36:20 web.1 | rack (2.2.4) lib/rack/static.rb:161:in `call'
19:36:20 web.1 | rack (2.2.4) lib/rack/tempfile_reaper.rb:15:in `call'
19:36:20 web.1 | rack (2.2.4) lib/rack/etag.rb:27:in `call'
19:36:20 web.1 | rack (2.2.4) lib/rack/conditional_get.rb:27:in `call'
19:36:20 web.1 | rack (2.2.4) lib/rack/head.rb:12:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/http/content_security_policy.rb:36:in `call'
19:36:20 web.1 | rack (2.2.4) lib/rack/session/abstract/id.rb:266:in `context'
19:36:20 web.1 | rack (2.2.4) lib/rack/session/abstract/id.rb:260:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/cookies.rb:696:in `call'
19:36:20 web.1 | activerecord (7.0.4) lib/active_record/migration.rb:603:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
19:36:20 web.1 | activesupport (7.0.4) lib/active_support/callbacks.rb:99:in `run_callbacks'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
19:36:20 web.1 | web-console (4.2.0) lib/web_console/middleware.rb:132:in `call_app'
19:36:20 web.1 | web-console (4.2.0) lib/web_console/middleware.rb:28:in `block in call'
19:36:20 web.1 | web-console (4.2.0) lib/web_console/middleware.rb:17:in `catch'
19:36:20 web.1 | web-console (4.2.0) lib/web_console/middleware.rb:17:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
19:36:20 web.1 | railties (7.0.4) lib/rails/rack/logger.rb:40:in `call_app'
19:36:20 web.1 | railties (7.0.4) lib/rails/rack/logger.rb:25:in `block in call'
19:36:20 web.1 | activesupport (7.0.4) lib/active_support/tagged_logging.rb:99:in `block in tagged'
19:36:20 web.1 | activesupport (7.0.4) lib/active_support/tagged_logging.rb:37:in `tagged'
19:36:20 web.1 | activesupport (7.0.4) lib/active_support/tagged_logging.rb:99:in `tagged'
19:36:20 web.1 | railties (7.0.4) lib/rails/rack/logger.rb:25:in `call'
19:36:20 web.1 | sprockets-rails (3.4.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/request_id.rb:26:in `call'
19:36:20 web.1 | rack (2.2.4) lib/rack/method_override.rb:24:in `call'
19:36:20 web.1 | rack (2.2.4) lib/rack/runtime.rb:22:in `call'
19:36:20 web.1 | activesupport (7.0.4) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/server_timing.rb:61:in `block in call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/server_timing.rb:26:in `collect_events'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/server_timing.rb:60:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
19:36:20 web.1 | rack (2.2.4) lib/rack/static.rb:161:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/static.rb:23:in `call'
19:36:20 web.1 | rack (2.2.4) lib/rack/sendfile.rb:110:in `call'
19:36:20 web.1 | actionpack (7.0.4) lib/action_dispatch/middleware/host_authorization.rb:137:in `call'
19:36:20 web.1 | vite_ruby (3.2.13) lib/vite_ruby/dev_server_proxy.rb:22:in `perform_request'
19:36:20 web.1 | rack-proxy (0.7.4) lib/rack/proxy.rb:78:in `call'
19:36:20 web.1 | railties (7.0.4) lib/rails/engine.rb:530:in `call'
19:36:20 web.1 | puma (5.6.5) lib/puma/configuration.rb:252:in `call'
19:36:20 web.1 | puma (5.6.5) lib/puma/request.rb:77:in `block in handle_request'
19:36:20 web.1 | puma (5.6.5) lib/puma/thread_pool.rb:340:in `with_force_shutdown'
19:36:20 web.1 | puma (5.6.5) lib/puma/request.rb:76:in `handle_request'
19:36:20 web.1 | puma (5.6.5) lib/puma/server.rb:443:in `process_client'
19:36:20 web.1 | puma (5.6.5) lib/puma/thread_pool.rb:147:in `block in spawn_thread'
config/initializers/maglev.rb
states If you want add more locales to your site, use the SetSiteLocalesService (https://docs.maglev.dev/guides/i18n).
However, https://docs.maglev.dev/guides/i18n does not exist (404) and a doc search on SetSiteLocalesService yielded no results.
I found https://docs.maglev.dev/guides/setup-multiple-languages which does explain that to add a locale, one can run bundle exec rails maglev:change_site_locales
.
Following the directions at https://docs.maglev.dev/integrations/avo, I ran into a an error when I got to bin/rails g maglev:install
/Users/brandon/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/vite_ruby-3.3.2/lib/vite_ruby/compatibility_check.rb:24:in `raise_unless_satisfied': vite-plugin-ruby@^3.1.2 might not be compatible with vite_ruby-3.3.2 (ArgumentError)
You may disable this check if needed: https://vite-ruby.netlify.app/config/#skipcompatibilitycheck
You may upgrade both by running:
bundle exec vite upgrade
raise ArgumentError, <<~ERROR
^^^^^^^^^^^^^^^^^^^^^^^
Running bundle exec vite upgrade
did not solve anything. Even using the environment variable suggested on the Rails Vite page didn't resolve anything:
VITE_RUBY_SKIP_COMPATIBILITY_CHECK=1 bin/rails s
bin/vite upgrade
(also suggested by Vite-Ruby's documentation) didn't do anything because vite
doesn't exist in bin
. The error remained, and appeared any time I tried to run a command:
ArgumentError: vite-plugin-ruby@^3.1.2 might not be compatible with vite_ruby-3.3.2
I've never used Vite before, so I have no insight into what may be going wrong, and I'm not able to find any clues by Googling.
Hey Didier, I want to check if the gem can be adjusted to our needs:
We have a platform where users can create their own e-commerce site under a subdomain of our app.
Example: https://carpatitashomeschool.salduu.com/
There, users have an store front with their products and currently each product has its own page
Example: https://carpatitashomeschool.salduu.com/p/descubrimiento-de-america-para-ninos
Those pages are composed by a fixed erb view that renders a action_text field called "description"
I thought I could enhance the basic "description" and offer the ability to create a full featured landing page for the product using maglev.
Like in the product edit form offer them
[on/off] User the new page builder
That would launch the maglev editor for that specific product
So in the model it could be something like
Product has_one :maglev_page, optional: true
and in the view it could be
<% if product.maglev_page.present? %>
<%= render full_featured_maglev_page %>
<% else %>
<%= render partial: old_fixed_page_with_action_text_description %>
<% end %>
I also don't want anyone to create their page and override any of my pages / or other user pages, so "pages" don't need to have a path (*can't have), because the path is bound to the product_path
Do you think this is possible? I think it is a very common use case.
Getting an exception when trying to add a section that has collection_item
setting into a page.
Create model
rails generate model Product name:string thumbnail_url:string
rails db:migrate
Define collection in config/initializers/maglev.rb
Maglev.configure do |config|
config.collections = {
products: {
model: 'Product',
fields: {
label: :name,
image: :thumbnail_url
}
}
}
end
Generate a new section with collection_item
setting
rails generate maglev:section section_01 \
--category=content \
--settings product:collection_item
Run the server
rails server
Open the editor: http://localhost:3000/maglev/editor
Add the section into a page
The section added into the page.
Nothing happen in the editor, getting TypeError (String does not have #dig method):
in the log instead.
Started POST "/maglev/preview" for ::1 at 2023-02-03 11:45:36 +0700
Processing by Maglev::PagePreviewController#create as HTML
Parameters: {"pageSections"=>"[{\"id\":\"C8DDoZAQ\",\"type\":\"section_01\",\"settings\":[{\"id\":\"product\",\"value\":\"any\"}],\"blocks\":[]}]", "authenticity_token"=>"[FILTERED]", "path"=>"index", "rendering_mode"=>:editor, "page_preview"=>{"pageSections"=>"[{\"id\":\"C8DDoZAQ\",\"type\":\"section_01\",\"settings\":[{\"id\":\"product\",\"value\":\"any\"}],\"blocks\":[]}]"}}
Maglev::Site Load (0.3ms) SELECT "maglev_sites".* FROM "maglev_sites" ORDER BY "maglev_sites"."id" ASC LIMIT $1 [["LIMIT", 1]]
Maglev::Page Load (0.4ms) SELECT "maglev_pages".* FROM "maglev_pages" INNER JOIN "maglev_page_paths" "paths" ON "paths"."maglev_page_id" = "maglev_pages"."id" WHERE "paths"."locale" = $1 AND "paths"."value" = $2 ORDER BY "maglev_pages"."id" ASC LIMIT $3 [["locale", "en"], ["value", "index"], ["LIMIT", 1]]
Completed 500 Internal Server Error in 4ms (ActiveRecord: 0.6ms | Allocations: 3794)
TypeError (String does not have #dig method):
maglevcms (1.1.7) app/services/concerns/maglev/get_page_sections/transform_collection_item_concern.rb:6:in `dig'
maglevcms (1.1.7) app/services/concerns/maglev/get_page_sections/transform_collection_item_concern.rb:6:in `transform_collection_item_content_setting'
maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:94:in `transform_content_setting'
maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:83:in `block in transform_section_settings'
maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:79:in `each'
maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:79:in `transform_section_settings'
maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:46:in `transform_section'
maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:25:in `block in call'
maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:24:in `map'
maglevcms (1.1.7) app/services/maglev/get_page_sections.rb:24:in `call'
maglev-injectable (2.1.1) lib/injectable/instance_methods.rb:18:in `call'
maglevcms (1.1.7) app/controllers/concerns/maglev/fetchers_concern.rb:38:in `fetch_maglev_page_sections'
maglevcms (1.1.7) app/controllers/maglev/page_preview_controller.rb:33:in `fetch_maglev_page_sections'
maglevcms (1.1.7) app/controllers/concerns/maglev/fetchers_concern.rb:21:in `fetch_maglev_page_content'
maglevcms (1.1.7) app/controllers/concerns/maglev/rendering_concern.rb:16:in `render_maglev_page'
maglevcms (1.1.7) app/controllers/maglev/page_preview_controller.rb:17:in `create'
actionpack (7.0.4.2) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (7.0.4.2) lib/abstract_controller/base.rb:215:in `process_action'
actionpack (7.0.4.2) lib/action_controller/metal/rendering.rb:53:in `process_action'
actionpack (7.0.4.2) lib/abstract_controller/callbacks.rb:234:in `block in process_action'
activesupport (7.0.4.2) lib/active_support/callbacks.rb:118:in `block in run_callbacks'
actiontext (7.0.4.2) lib/action_text/rendering.rb:20:in `with_renderer'
actiontext (7.0.4.2) lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'
activesupport (7.0.4.2) lib/active_support/callbacks.rb:127:in `instance_exec'
activesupport (7.0.4.2) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
activesupport (7.0.4.2) lib/active_support/callbacks.rb:138:in `run_callbacks'
actionpack (7.0.4.2) lib/abstract_controller/callbacks.rb:233:in `process_action'
actionpack (7.0.4.2) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (7.0.4.2) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
activesupport (7.0.4.2) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.0.4.2) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (7.0.4.2) lib/active_support/notifications.rb:206:in `instrument'
actionpack (7.0.4.2) lib/action_controller/metal/instrumentation.rb:66:in `process_action'
actionpack (7.0.4.2) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
activerecord (7.0.4.2) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (7.0.4.2) lib/abstract_controller/base.rb:151:in `process'
actionview (7.0.4.2) lib/action_view/rendering.rb:39:in `process'
actionpack (7.0.4.2) lib/action_controller/metal.rb:188:in `dispatch'
actionpack (7.0.4.2) lib/action_controller/metal.rb:251:in `dispatch'
actionpack (7.0.4.2) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (7.0.4.2) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (7.0.4.2) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.4.2) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.4.2) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.4.2) lib/action_dispatch/routing/route_set.rb:852:in `call'
railties (7.0.4.2) lib/rails/engine.rb:530:in `call'
railties (7.0.4.2) lib/rails/railtie.rb:226:in `public_send'
railties (7.0.4.2) lib/rails/railtie.rb:226:in `method_missing'
actionpack (7.0.4.2) lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
actionpack (7.0.4.2) lib/action_dispatch/routing/mapper.rb:48:in `serve'
actionpack (7.0.4.2) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.4.2) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.4.2) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.4.2) lib/action_dispatch/routing/route_set.rb:852:in `call'
rack (2.2.6.2) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.6.2) lib/rack/etag.rb:27:in `call'
rack (2.2.6.2) lib/rack/conditional_get.rb:40:in `call'
rack (2.2.6.2) lib/rack/head.rb:12:in `call'
actionpack (7.0.4.2) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
actionpack (7.0.4.2) lib/action_dispatch/http/content_security_policy.rb:36:in `call'
rack (2.2.6.2) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.6.2) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (7.0.4.2) lib/action_dispatch/middleware/cookies.rb:704:in `call'
activerecord (7.0.4.2) lib/active_record/migration.rb:603:in `call'
actionpack (7.0.4.2) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (7.0.4.2) lib/active_support/callbacks.rb:99:in `run_callbacks'
actionpack (7.0.4.2) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (7.0.4.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.4.2) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
actionpack (7.0.4.2) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
web-console (4.2.0) lib/web_console/middleware.rb:132:in `call_app'
web-console (4.2.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (4.2.0) lib/web_console/middleware.rb:17:in `catch'
web-console (4.2.0) lib/web_console/middleware.rb:17:in `call'
actionpack (7.0.4.2) lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
railties (7.0.4.2) lib/rails/rack/logger.rb:40:in `call_app'
railties (7.0.4.2) lib/rails/rack/logger.rb:25:in `block in call'
activesupport (7.0.4.2) lib/active_support/tagged_logging.rb:99:in `block in tagged'
activesupport (7.0.4.2) lib/active_support/tagged_logging.rb:37:in `tagged'
activesupport (7.0.4.2) lib/active_support/tagged_logging.rb:99:in `tagged'
railties (7.0.4.2) lib/rails/rack/logger.rb:25:in `call'
sprockets-rails (3.4.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (7.0.4.2) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
actionpack (7.0.4.2) lib/action_dispatch/middleware/request_id.rb:26:in `call'
rack (2.2.6.2) lib/rack/method_override.rb:24:in `call'
rack (2.2.6.2) lib/rack/runtime.rb:22:in `call'
activesupport (7.0.4.2) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (7.0.4.2) lib/action_dispatch/middleware/server_timing.rb:61:in `block in call'
actionpack (7.0.4.2) lib/action_dispatch/middleware/server_timing.rb:26:in `collect_events'
actionpack (7.0.4.2) lib/action_dispatch/middleware/server_timing.rb:60:in `call'
actionpack (7.0.4.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
rack (2.2.6.2) lib/rack/static.rb:161:in `call'
actionpack (7.0.4.2) lib/action_dispatch/middleware/static.rb:23:in `call'
rack (2.2.6.2) lib/rack/sendfile.rb:110:in `call'
actionpack (7.0.4.2) lib/action_dispatch/middleware/host_authorization.rb:137:in `call'
vite_ruby (3.2.14) lib/vite_ruby/dev_server_proxy.rb:22:in `perform_request'
rack-proxy (0.7.6) lib/rack/proxy.rb:87:in `call'
railties (7.0.4.2) lib/rails/engine.rb:530:in `call'
puma (5.6.5) lib/puma/configuration.rb:252:in `call'
puma (5.6.5) lib/puma/request.rb:77:in `block in handle_request'
puma (5.6.5) lib/puma/thread_pool.rb:340:in `with_force_shutdown'
puma (5.6.5) lib/puma/request.rb:76:in `handle_request'
puma (5.6.5) lib/puma/server.rb:443:in `process_client'
puma (5.6.5) lib/puma/thread_pool.rb:147:in `block in spawn_thread'
Maglev version: 1.1.7
Rails version: 7.0.4.2
Ruby version: 3.2.0
Generate a new section with a link
setting
rails generate maglev:section section_01 \
--category=content \
--settings call_to_action:link
Add a static page into config/initializers/maglev.rb
Maglev.configure do |config|
config.static_pages = [
{
title: { en: 'Products' },
path: { en: '/products' }
}
]
end
Run the server
rails server
Open the editor: http://localhost:3000/maglev/editor
Add the section into a page
Configure the link to point to Products page
Save the page
Reload the browser
The link is seen as a link to a static page in the editor.
The link is seen as a link to URL only, the selected static page information is gone in the editor.
Maglev version: 1.1.7
Rails version: 7.0.4.2
Ruby version: 3.2.0
For now, in the settings part of section yml, we can add a default href for link
type.
- label: "Bouton"
id: button
type: link
default: '#'
We have to create a separate new setting if we want to insert a default text between the a
tags.
- label: "Bouton Text"
id: button_text
type: text
default: 'Je souhaite une assistance'
It would be a good idea to gather these two settings into one.
*Feel free to move if this is not the best place to report this.
I tried to play the video on the homepage, but it seems to be broken. Seems like bunny.net account/configuration expired?
I'm following the guide with:
rails new my-awesome-site \
-m https://raw.githubusercontent.com/maglevhq/maglev-core/master/template.rb \
--database=postgresql \
--skip-action-cable
However, this fails with vite-plugin-ruby@^3.2.0 might not be compatible with vite_ruby-3.5.0 (ArgumentError)
rake maglev:vite:install_dependencies
➤ YN0000: · Yarn 4.2.2
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + @vitejs/plugin-vue2@npm:2.3.1, @vue/test-utils@npm:1.3.6, autoprefixer@npm:10.4.16, axios@npm:1.6.2, and 482 more.
➤ YN0000: └ Completed in 0s 638ms
➤ YN0000: ┌ Post-resolution validation
➤ YN0002: │ maglev@workspace:. doesn't provide lodash (p3d004), requested by camelcase-object-deep.
➤ YN0002: │ maglev@workspace:. doesn't provide postcss (p11d83), requested by autoprefixer.
➤ YN0086: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements for details, where is the six-letter p-prefixed code.
➤ YN0028: │ The lockfile would have been modified by this install, which is explicitly forbidden.
➤ YN0000: └ Completed
➤ YN0000: · Failed with errors in 0s 670ms
I'm trying to add Maglev to a Rails 6.0 app, and expected it to work based on the README
Maglev is a page builder / CMS that you can plug in any Ruby on Rails 6+ application.
but most or all of the migrations specify 6.1. Is this necessary? Will I have problems if I change them to specify 6.0?
# This migration comes from maglev (originally 20210906102712)
class AddCanonicalToPages < ActiveRecord::Migration[6.0] # ⬅️ ⬅️ ⬅️ ⬅️ ⬅️ ⬅️ was 6.1
def change
add_column :maglev_page_paths, :canonical, :boolean, null: true, default: true
add_index :maglev_page_paths, %i[canonical maglev_page_id locale], unique: true, name: 'canonical_uniqueness'
end
end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.