feat(netlify-cms-widget-list): allow 'summary' field (#3616)

This commit is contained in:
Derek Nguyen
2020-05-11 22:30:29 +09:00
committed by GitHub
parent c9a2fec2da
commit 7cc4c89539
5 changed files with 228 additions and 10 deletions

View File

@ -163,6 +163,7 @@ To use variable types in the list widget, update your field configuration as fol
- `types`: a nested list of object widgets. All widgets must be of type `object`. Every object widget may define different set of fields.
- `typeKey`: the name of the field that will be added to every item in list representing the name of the object widget that item belongs to. Ignored if `types` is not defined. Default is `type`.
- `summary`: allows customization of a collapsed list item object in a similar way to a [collection summary](/docs/configuration-options/?#summary)
### Example Configuration
@ -177,6 +178,7 @@ either a "carousel" or a "spotlight". Each type has a unique name and set of fie
- label: 'Carousel'
name: 'carousel'
widget: object
summary: '{{fields.header}}'
fields:
- { label: Header, name: header, widget: string, default: 'Image Gallery' }
- { label: Template, name: template, widget: string, default: 'carousel.html' }

View File

@ -12,6 +12,7 @@ The list widget allows you to create a repeatable item in the UI which saves as
- `default`: if `fields` is specified, declare defaults on the child widgets; if not, you may specify a list of strings to populate the text field
- `allow_add`: if added and labeled `false`, button to add additional widgets disappears
- `collapsed`: if added and labeled `false`, the list widget's content does not collapse by default
- `summary`: allows customization of a collapsed list item object in a similar way to a [collection summary](/docs/configuration-options/?#summary)
- `field`: a single widget field to be repeated
- `fields`: a nested list of multiple widget fields to be included in each repeatable iteration
- **Example** (`field`/`fields` not specified):
@ -34,6 +35,7 @@ The list widget allows you to create a repeatable item in the UI which saves as
- label: "Gallery"
name: "galleryImages"
widget: "list"
summary: '{{fields.image}}'
field: {label: Image, name: image, widget: image}
```
- **Example** (with `fields`):
@ -41,6 +43,7 @@ The list widget allows you to create a repeatable item in the UI which saves as
- label: "Testimonials"
name: "testimonials"
widget: "list"
summary: '{{fields.quote}} - {{fields.author.name}}'
fields:
- {label: Quote, name: quote, widget: string, default: "Everything is awesome!"}
- label: Author