Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem does this solve?
Creating more than one composable content section on a single record / view.
Say you want a composable content in a sidebar and another in the main area of the page.
This isn't currently possible without hacks or abusing the sectioning component
Current state
For reference, currently the composable config in the model looks like this:
And the output of the composable content JSON is similar:
Introducing groups
This change proposes a change to both the crud config and the output:
This change in structure will unfortunately mean it's a breaking change.
The code will assume all composable content will always have groups, so even if you aren't utilising groups, make sure you define a default group, eg. "main" or "default"
This will make the UI and implementation consistent and won't rely on hacks checking on whether groups exist or not
Once more than one group is detected, the UI of the composable content screen will update to show tabs to switch between content groups.
If you are only utilising a single group the UI will not change at all.
In your views you can now use
composable_json(:main)
andcomposable_data(:sidebar)
to access your groups.These flags also flow through to the existing
composable_sections(:main)
andcomposable_sections_with_drafts(:main)