Improved: Add new custom block "DetailsBlock" with expanding answers and demonstrate it in a BreadPage and in a new FAQ page#425
Conversation
…emo.json, keeping only necessary changes
|
Looking much better @gzark1 Do you mind reviewing the CI error, might need to make some more tweaks to the fixtures it seems. |
|
Thank you @cnk for addressing the merge conflicts. Please feel free to provide any further guidance or suggestions, and I'll promptly address them. |
thibaudcolas
left a comment
There was a problem hiding this comment.
I think this is great – but I would say this ought to be in the body field, so we can demonstrate Wagtail’s support for flexible page content.
| summary = CharBlock(required=True) | ||
| content = RichTextBlock(required=True) | ||
| open = BooleanBlock( | ||
| required=False, default=True, label="Open", help_text="Open by default" |
There was a problem hiding this comment.
I’m not too clear why we are using a <details> element in HTML if it’s to have those blocks opened by default. Could we default to "False" instead?
I’d also suggest removing the label if it just repeats the field identifier, and writing a more descriptive help text or removing it (stating the default value isn’t too helpful).
|
|
||
|
|
||
| # StreamBlocks for Details | ||
| class DetailsStreamBlock(StreamBlock): |
There was a problem hiding this comment.
I’m really surprised we’re not adding this to BaseStreamBlock – this feels like a clear missed opportunity to demonstrate Wagtail’s flexibility, by allowing series of "details" content to be placed at arbitrary points?
|
@gzark1 are you able to rebase and review the comments above? |


This PR is an improvement of #422. I deleted the DetailsBlock option from
BaseStreamBlock, in order not to complicate things. I utilizedDetailsStreamBlockin bothBreadPage(and demonstrated it in "Anadama" bread) andStandardPage(demonstrated it in "FAQ"). I stored the data i created inbakerydemo/base/fixtures/bakerydemo.json, keeping only the necessary changes.