Netlify-cms: Add summary option to list widget

Created on 7 May 2020  路  3Comments  路  Source: netlify/netlify-cms

Is your feature request related to a problem? Please describe.

When defining a file collection you generally target a file to be populated of elements (i.e. allow_add: true) or to read from (i.e. allow_add: false). Say you define the following people file collection inside a editables files collection:

collections:
  - label: Editable Lookups
    name: editables
    files:
      - label: People
        name: people
        file: data/people.json
        fields:
          - label: People
            label_singular: person
            allow_add: true
            name: people
            widget: list
            fields:
              - label: Last
                name: last
                widget: string
              - label: First
                name: first
                widget: string

You then add few persons and your people.json file get populated something like this:

{
  "people": [
    {
      "last": "Smith",
      "first": "Bob"
    },
    {
      "last": "Smith",
      "first": "Fred"
    },
    {
      "last": "Smith",
      "first": "Mary"
    }
  ]
}

In the UI visualizing people elements you can't distinguish between people with the same lastname.

summary-feature

Describe the solution you'd like

Add a summary option to list widget:

# ....
          - label: People
            label_singular: person
            allow_add: true
            summary: '{{last}}, {{first}}' # <- summary option
            name: people
            widget: list
            fields:
              - label: Last
                name: last
                widget: string
              - label: First
                name: first
                widget: string

Describe alternatives you've considered

I don't know alternatives

Additional context

This new features will be a game saver in the contest of folder to file collection relationships (e.g. ncw-file-relation by @d4rekanguok ).

extensionwidgets feature

Most helpful comment

I have a PR up that's relevant to this #3616!

All 3 comments

I have a PR up that's relevant to this #3616!

@d4rekanguok you are always a step ahead! Is the PR going to be approved and merged soon?

The direction is already approved, but there's a bit of work left! The PR actually only adds summary to the 'typed' list and not the regular one, when I have some time next week I'll continue to work on it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chriskirknielsen picture chriskirknielsen  路  3Comments

TomPichaud picture TomPichaud  路  3Comments

mikecrittenden picture mikecrittenden  路  3Comments

emckay picture emckay  路  3Comments

ghost picture ghost  路  3Comments