hugomods / decap-cms

[Experimental] Hugo Decap CMS Module
https://hugomods.com
MIT License
7 stars 1 forks source link

Show summary without expanding #130

Closed pleasantone closed 10 months ago

pleasantone commented 10 months ago

https://github.com/hugomods/decap-cms/blob/0525a84495e71b6303be8b4d73257d783d51d718/hugo.toml#L43

razonyang commented 10 months ago

Hmm, I didn't see any problem, do you test summary = "{{fields.author}}"?

pleasantone commented 10 months ago

I tried both fields.author and fields.authors, neither affects the summary, so my apologies.

All I get is the following when collapsed...

Screenshot 2024-02-01 at 5 37 46 PM

and the following when expanded:

Screenshot 2024-02-01 at 5 38 51 PM

I was hoping to get a clean text summary when collapsed, but I'm missing something. Something that looked like:

Authors:
> 2 authors: ich, paul
razonyang commented 10 months ago

I see, it would be much more intuitive without needing to expand field, but I didn't find a solution before, may need dive into their docs and source code.

Let's keep it open.

razonyang commented 10 months ago

I believe we can't configure it by far, and the list field is complex (not just string), I don't think it's easy to make changes on Decap CMS:

https://github.com/decaporg/decap-cms/blob/a5f4d9ea08e71df9ab7c4c16ef0503de1d1bb6ee/packages/decap-cms-widget-list/src/ListControl.js#L710

But we can replace it with a new custom widget.

razonyang commented 10 months ago

Done, replace list widget with strings for those fields.

pleasantone commented 10 months ago

I haven’t looked carefully at your new code yet, but are you aware of how the list widget works? If there are no fields defined? You might have just duplicated that.

razonyang commented 10 months ago

Now it looks like as follows, those field's values are comma-space-separated (,) text by default. It's much more intuitive and easy to modify than list widget.

image

but are you aware of how the list widget works

Accoding to the code link above, the list widget only shows the number of children and the label on the header, the children's values won't be shown unless expanding.

heading={`${items.size} ${listLabel}`}