Skip to content
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

List Widget with single child object displays "List[map]........" string in CMS UI #1275

Closed
ghost opened this issue Apr 17, 2018 · 4 comments

Comments

@ghost
Copy link

ghost commented Apr 17, 2018

- Do you want to request a feature or report a bug?
Bug
- What is the current behavior?
List widget with a single object as its array element outputs "List[map]........" string in the ui like shown here https://nupic.co/image/6T638
- If the current behavior is a bug, please provide the steps to reproduce.
Please use this configuration to reproduce the bug

- name: "footer"
  label: "Footer Links"
  file: "_data/footer.yml"
  fields: 
   - name: "footer"
     label: "Footer Links"
     widget: list
     disableAdd: true
     fields:
      - name: "links-col-1"
        label: "Footer Links Column 1"
        widget: list
        fields:
         - {label: "Title", name: "name", widget: "string" }
         - {label: "URL", name: "href", widget: "string" }  
      - name: "links-col-2"
        label: "Footer Links Column 2"
        widget: list
        fields:
         - {label: "Title", name: "name", widget: "string" }
         - {label: "URL", name: "href", widget: "string" }      

Here is the data structure that gets created from the above code

{ "footer": [ { "links-col-1": [ { "href": "/activeico.html", "name": "Active ICO" }, { "href": "/upcomingico.html", "name": "Upcoming ICO" }, { "href": "/endedico.html", "name": "Ended ICO" } ], "links-col-2": [ { "href": "/whitelist.html", "name": "Whitelist" }, { "href": "/preico.html", "name": "Pre ICO" }, { "href": "Advertising", "name": "/publishico.html" } ] } ] }
- What is the expected behavior?

- Please mention your versions where applicable.

Netlify CMS version: 1.5
Browser version:

Node.JS version:
Operating System:

- Please link or paste your config.yml below if applicable.

@erquhart
Copy link
Contributor

The core issue here is that we need a smarter approach to providing display titles for list widget items. We currently look for fields with a handful names, or else fallback to stringifying the first field, which results in the above. At a minimum, we should provide a generic fallback, perhaps based on the list widget label itself, if none of the list widget fields are strings.

@alexcroitoru95
Copy link

Any updates on this issue?

@alberto56
Copy link

alberto56 commented Apr 30, 2021

approach to providing display titles for list widget items

In my experience having "title" as a first field always displays that value:

fields:
  - label: "Title"
    name: "title"
    widget: "string"

The value of that field appears in the backed as per the enclosed screenshot.
Screen Shot 2021-04-30 at 8 51 02 AM

That being said it would be cool to have something like this (this is just an idea; don't try it, it does not work!):

# This does not work, it's just an idea
widget_item_title: "{{ lang }} blog post {{ title }} ({{ date}})"
fields:
  - label: "Title"
    name: "title"
    widget: "string"
    ....

So we could have, for example: "English blog post How to use Nelify (2021-04-28)" as a title.

@martinjagodic
Copy link
Member

For anyone looking into this: see @alberto56's advice, or use the summary on the field. Closing as not planned.

@martinjagodic martinjagodic closed this as not planned Won't fix, can't repro, duplicate, stale Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants