Add new custom block "DetailsBlock" with expanding answers and demonstrate it in a BreadPage and in a new FAQ page.#422
Conversation
…ss, and create details_block.html template
…nner field. Demonstrate this in the StandardPage model, with 'questions' field. Update the standard_page.html
…e new FAQ page visible in the top menu.
lb-
left a comment
There was a problem hiding this comment.
A few changes, I think the way the fixtures have been changed needs some work.
| details_block = DetailsBlock() | ||
|
|
||
|
|
||
| # StreamBlocks for Details |
There was a problem hiding this comment.
This is probably not needed, you can use a single block easily with StreamField
There was a problem hiding this comment.
So you suggest not adding the DetailsBlock option to the "old" BaseStreamBlock , just to the "new" DetailsStreamBlock that I created?
| "organisation_url": "https://wagtail.org/" | ||
| "twitter_url": "", | ||
| "github_url": "", | ||
| "organisation_url": "" |
There was a problem hiding this comment.
I don't think this removal is intentional.
| } | ||
| }, | ||
| { | ||
| "model": "wagtailsearchpromotions.querydailyhits", |
There was a problem hiding this comment.
I don't think we need to add these to the fixtures
| <div class="details-content"> | ||
| {{ self.content }} | ||
| </div> | ||
| </details> No newline at end of file |
There was a problem hiding this comment.
Please add a line break at the end of this file.
|
@gzark1 can you close this PR if the newer one is preferred |
|
Closing in favour of #425. |
@lb- suggested adding a
DetailsBlockto showcase a custom block with its own HTML template. TheDetailsBlockincludes three fields:summary(CharField),content(RichTextField), andopen(BooleanField, defaulting to open). This block is ideal for creating an FAQ page with expanding answers and allows for the use of semantic and modern HTML.Changes Made:
DetailsBlockclass inheriting fromStructBlockwith the specified fields.DetailsBlockto the StreamField used by other pages for their content, providing them with the option to include a details block.details_block.html, for rendering theDetailsBlock.DetailsBlocksummary and content in the main CSS file.DetailsBlockin a bread page.DetailsBlockoption, showcased in a newFAQpage of theStandardPagetype.Created sample data for both the bread page and the FAQ page, stored in
bakerydemo/base/fixtures/bakerydemo.json.Added the
FAQpage to the navigation menu.