Create a new section
This guide helps you to create a maglev section and integrates it in the editor UI.
Generate the section files
The maglev gem offers a Rails generator to quickly generate the files required by a maglev section.
The following command will generate a sample section with a few settings and blocks.
Syntax
Example
Here is an example of a section with one single type of block
Code the section
Once the different files of the section have been generated, it's time to complete the definition and template files.
Start by visiting the admin url once you've started your Rails server and click to the title of your newly generated section. You will see a screen like this one.
There are 3 different buttons on this screen:
Open editor: it opens the Editor UI
Open in a new tab: it opens the section in a new tab without the maglev admin layout. Very useful when coding the template of the section.
Take screenshot: once your section looks good (please visit the next sub chapter before) , it's time to take a screenshot of it for the editor UI. It will be displayed in the list of sections available for the editors.
Provide a sample content
Providing a sample content for a section is helpful in 3 main cases:
when writing the template of the section with "real" content.
when generating a screenshot of the section with "real" content".
when an editor picks the section in the editor UI. She won't see a blank section.
This can be achieved by declaring the sample attribute in the definition file of the section.
Example:
Last updated