-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Summary
Currently, Entries are forced to use their parent's layout. This can be overridden by defining entry?
to false
, but this is undocumented and unintuitive.
Motivation
Often, we want to opt-out of Entry templates, as it isn't appropriate for the site in question. We already have the mechanism available to do this, we'd just like to expose this choice to the end user.
Detailed design
To opt-out of Entry templates, define the following in your Set Entry model:
# app/slices/foo_set/foo.rb
class Foo < Page
def use_parent_layout?
false
end
end
When true
:
- Disable layout selection on individual entries
- Enable
Edit entry template
andPlaceholder
slice capability
When false
:
- Enable layout selection on individual entries
- Disable
Edit entry template
andPlaceholder
slice capability
Generators
The new generated entry model would like something like this:
# app/slices/foo_set/foo.rb
class Foo < Page
# Set this to `false` to enable arbitrary layouts on individual entries.
def use_parent_layout?
true
end
def template
"foo_set/views/show"
end
# Uncomment the as_json method if the page defines fields that are
# shown in the admin UI. Pass a hash to merge() that contains each
# field.
#
# def as_json(options = {})
# super.merge(published: published.to_s)
# end
end
Metadata
Metadata
Assignees
Labels
No labels