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

Make collection filters discoverable #2750

Open
jared-thoughtbot opened this issue Jan 9, 2025 · 2 comments · May be fixed by #2758
Open

Make collection filters discoverable #2750

jared-thoughtbot opened this issue Jan 9, 2025 · 2 comments · May be fixed by #2758
Labels
dashboards how administrate presents fields and displays data search finding things through our models sorting ordering things on dashboards

Comments

@jared-thoughtbot
Copy link

Current state

You can add collection filters to a dashboard and then search using them using the search bar on the index page.

image

Problem

These collection filters are not discoverable. You have to know about them already to know how to use them.

Potential solution

Add a tooltip next to the search box when collection filters are provided. Probably with an option to disable the tooltip in case some people do not want it.

We could dynamically populate the content based on the collection filters. Eg.

image

I appreciate we might not want to introduce tooltip code and assets just for this one thing. I don't know if there are other issues / future features on the roadmap that could also benefit from tooltips?

Alternatives

  • Using the input placeholder or somehow inlining the filter options - but these don't scale very well if you have a few filters
  • Linking to a new page which lists the filter options
  • Something else?
@kevinkimball
Copy link

kevinkimball commented Jan 10, 2025

Big +1 to this feature request. This is one of the biggest things I feel is missing, and not straightforward to implement yourself.

Additional features that would make this even better:

  1. Filter bar with buttons/ dropdowns. Implementation-wise this could be something similar to Field?
  2. Option to provide dropdown options for filters similar to Field::Select.with_options(collection: [...])
  3. Option to provide query for autocomplete for filters

@nickcharlton
Copy link
Member

I think this is an excellent idea.

As I started reading, I was thinking about the placeholder being a good solution, but when you've got several it's not so nice. But I wonder if we can randomly show a different filter in there, or something!

Tooltips are a bit easier to achieve now, so I think writing our own here would be the right approach to take. We could then use this to provide tooltips in other areas of the project where it makes sense.

A good place to start, if someone wanted to pick this up, would be to see if we've got the right sort of data accessible in the view to populate a tooltip, and then start exploring a tooltip implementation we could ship as part of Administrate (it shouldn't involve any dependencies, use modern standards and as little JS as we can get away with.)

@kevinkimball, thanks! Those are good ideas too. Could you create different issues to track those? Especially so if you could do a mockup like @jared-thoughtbot did.

@nickcharlton nickcharlton added dashboards how administrate presents fields and displays data search finding things through our models sorting ordering things on dashboards labels Jan 10, 2025
jared-thoughtbot added a commit that referenced this issue Jan 17, 2025
You can add collection filters to a dashboard and then use them in the
search bar on the index page. eg. `email:[email protected]`

However, these collection filters are not discoverable. You have to know
about them already to know how to use them.

This change introduces a tooltip which lists the available collection
filters, allowing all users to discover what is available.

Closes #2750
@jared-thoughtbot jared-thoughtbot linked a pull request Jan 17, 2025 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboards how administrate presents fields and displays data search finding things through our models sorting ordering things on dashboards
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants