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 Filtering Entries On List Fields #1578

Merged
merged 10 commits into from Oct 24, 2018

Conversation

jbutz
Copy link
Contributor

@jbutz jbutz commented Aug 3, 2018

- 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 and dev-test/config.yml files to test this change. My modified files can be found here: https://gist.github.com/jbutz/79a6d2161102187b1fce59f47dd61d58

I 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 in index.html and I gave one of those documents the value that will match the filter. Below is a screenshot of the result.

test-plan-screenshot

- 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

animal

@verythorough
Copy link
Contributor

verythorough commented Aug 3, 2018

Deploy preview for netlify-cms-www ready!

Built with commit cc5ff01

https://deploy-preview-1578--netlify-cms-www.netlify.com

@verythorough
Copy link
Contributor

verythorough commented Aug 9, 2018

Deploy preview for cms-demo ready!

Built with commit cc5ff01

https://deploy-preview-1578--cms-demo.netlify.com

Copy link
Contributor

@erquhart erquhart left a comment

Thanks @jbutz! Just added a request on the tests, but otherwise this looks great!

data: {
testField: 42,
},
},
Copy link
Contributor

@erquhart erquhart Aug 27, 2018

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.

Copy link
Contributor Author

@jbutz jbutz Aug 29, 2018

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

@jbutz
Copy link
Contributor Author

jbutz commented Aug 29, 2018

Ok @erquhart, I have added additional entries to the tests that won't watch the filters

@erquhart
Copy link
Contributor

erquhart commented Aug 30, 2018

Awesome, thanks!

@jbutz
Copy link
Contributor Author

jbutz commented Sep 25, 2018

Can I get someone to merge this in? Please and thank you.

@erquhart
Copy link
Contributor

erquhart commented Oct 24, 2018

Was hoping to get another review on this (we try to require to maintainer reviews), but I'll go ahead and merge 👍

Thanks again!

@erquhart erquhart merged commit cdcd511 into netlify:master Oct 24, 2018
2 checks passed
Copy link

@Hell081 Hell081 left a comment

L oh

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

Successfully merging this pull request may close these issues.

None yet

5 participants