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

Support summary string transformations for object and list widgets #255

Closed
AntoineBx opened this issue Nov 13, 2024 · 4 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@AntoineBx
Copy link

Hello kyoshino!
Whether it is ternary filter or | upper, it return nothing for me
maybe i'm missing something tho

fields:
              - label: general
                name: section
                widget: object
                i18n: duplicate
                collapsed: true
                required: true
                summary: " container: {{fields.containerize | ternary('yes','no')}} "
                fields:
                  - label: container?
                    name: containerize
                    widget: boolean
                    default: true
                    i18n: duplicate
                    required: false

and noob question: why cannot we use basic javascript in those double brackets? like so {{fields.containerize? 'yes':'no'}} "

thanks

@kyoshino
Copy link
Member

Will check.

@kyoshino
Copy link
Member

kyoshino commented Nov 13, 2024

Oh, summary string transformations are not supported in an object summary. It’s for a collection summary. Sveltia CMS supports transformations in entry slugs as well (that’s decaporg/decap-cms#4783) so I think I can quickly add the support for object and list summaries.

@kyoshino kyoshino added the enhancement New feature or request label Nov 13, 2024
@kyoshino kyoshino changed the title My summary filters don't seem to work Support transformations in summary of object and list widgets Nov 13, 2024
@kyoshino
Copy link
Member

and noob question: why cannot we use basic javascript in those double brackets? like so {{fields.containerize? 'yes':'no'}} "

This makes sense for the ternary operator, but transformation pipes can be chained like body | upper | truncate(20, '...') so I think we should keep the current syntax 😉

@kyoshino kyoshino self-assigned this Nov 13, 2024
@kyoshino kyoshino changed the title Support transformations in summary of object and list widgets Support summary string transformations for object and list widgets Nov 13, 2024
@kyoshino
Copy link
Member

kyoshino commented Nov 22, 2024

Shipped v0.47.0 with the transformations support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants