Skip to content

Instantly share code, notes, and snippets.

@davecranwell
Last active August 29, 2015 14:16
Show Gist options
  • Save davecranwell/7f0dd9cdc27036f31948 to your computer and use it in GitHub Desktop.
Save davecranwell/7f0dd9cdc27036f31948 to your computer and use it in GitHub Desktop.
Normal edit handlers:
--------------------
Am I an immediate child of a content_panel (or promote_panel etc)?
- Yes
- Am I a MultiFieldPanel or InlinePanel?
- Yes
- Output MultiFieldPanel/InlinePanel label as pink bar
- No (I'm a FieldPanel)
- Reuse field's own label as the pink title bar above,
- Hide label beside field
- No (I'm inside a MultiFieldPanel or InlinePanel)
- Am I a MultiFieldPanel or InlinePanel? (i.e has someone nested an InlinePanel/MultifieldPanel within an InlinePanel/MultifieldPanel?)
- Yes
- Output MultiFieldPanel/InlinePanel label as a new heading but NOT as a pink bar (those are only for immediate children of a content panel)
- No (I'm a FieldPanel)
- No heading required
- Show label beside fields
- Show field labels beside fields
Streamfield blocks:
------------------
The individual styling of certain types of blocks makes some labels more desirable to hide than others and should probably be left to the implementation, not to wagtail itself. For example a quote block containing quote and attribution is probably sufficiently easy to use (given the placeholders in each field) that no labels need to be displayed beside each field.
An image field likewise - the image icon alone is enough to explanat what the field is for.
The real question with streamfield blocks, is whether to output a heading and what should contribute that heading.
The question for each block to ask, at every level is:
How many child blocks do I contain? (regardless whether that child is a fieldblock, structblock or listblock)
- One
- Does that child have a heading? (e.g CharBlocks don't)
- Yes
- Don't output any heading next to the child, but use that child's label as my own heading
- No
- Output my own label as heading
- Many
- Output my own label as a heading
- None (i'm a fieldblock and can't get any more granular)
- Pass: headings aren't up to me
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment