-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably not needed, you can use a single block easily with StreamField
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this removal is intentional.
} | ||
}, | ||
{ | ||
"model": "wagtailsearchpromotions.querydailyhits", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to add these to the fixtures
<div class="details-content"> | ||
{{ self.content }} | ||
</div> | ||
</details> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
DetailsBlock
to showcase a custom block with its own HTML template. TheDetailsBlock
includes 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:
DetailsBlock
class inheriting fromStructBlock
with the specified fields.DetailsBlock
to 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
.DetailsBlock
summary and content in the main CSS file.DetailsBlock
in a bread page.DetailsBlock
option, showcased in a newFAQ
page of theStandardPage
type.Created sample data for both the bread page and the FAQ page, stored in
bakerydemo/base/fixtures/bakerydemo.json
.Added the
FAQ
page to the navigation menu.