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 Filtering Entries On List Fields #1578
Support Filtering Entries On List Fields #1578
Conversation
Deploy preview for netlify-cms-www ready! Built with commit cc5ff01 |
Deploy preview for cms-demo ready! Built with commit cc5ff01 |
data: { | ||
testField: 42, | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, thank you for adding tests!
I'm thinking we should add an extra entry to each of these entries
arrays so that it's possible for more than one value to be returned and actual filtering takes place in the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I'll add that as soon as I get a chance
Ok @erquhart, I have added additional entries to the tests that won't watch the filters |
Awesome, thanks! |
Can I get someone to merge this in? Please and thank you. |
Was hoping to get another review on this (we try to require to maintainer reviews), but I'll go ahead and merge Thanks again! |
- Summary
When setting up a collection for a specific group of files on my site I discovered the
filter
property for collections did not work for fields that are lists. This change will allow filtering on lists when the filter value is one of the values in the list.- Test plan
I modified the
dev-test/index.html
anddev-test/config.yml
files to test this change. My modified files can be found here: https://gist.github.com/jbutz/79a6d2161102187b1fce59f47dd61d58I added a new collection titled
FAQ - FILTERED
that has a filter value based on a new field. I added the new field to two of the FAQ documents inindex.html
and I gave one of those documents the value that will match the filter. Below is a screenshot of the result.- Description for the changelog
Add support for filtering collections on list fields
- A picture of a cute animal (not mandatory but encouraged)
Say hello to Eddy