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

Search with filters #227

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

LEstradioto
Copy link

This is maybe a start to search filtering (if needed to)
Works on sqlite, should be no problem for others
Would appreciate feedbacks 🙏

filters-start.mp4

Making this as draft as Idk where the project stands on this filtering idea
And it might need adjustments

Future improvements:

  • When Boolean fields, checkbox instead of a input
  • When Date, Datetime, use datetime inputs (flatpickr)
  • When Json or active_record store, needs a filter solution
  • Associations cant be searched with an attribute, like User.name, but filter using id works, like, filter posts by User using Equals to user_id

@excid3
Copy link
Owner

excid3 commented Oct 31, 2024

Great start to this @LEstradioto!

I don't think we necessarily need to support filtering JSON columns or associated models with attributes yet, but it would be good to have those improvements for boolean and date/datetime columns.

@LEstradioto
Copy link
Author

LEstradioto commented Nov 1, 2024

Thanks for feedback. Added support for boolean and date/datetime

Flatpickr needed some adjustments and Ive removed this dropdown controller, since this PR adds pure css dropdown, and later we could add to mobile menu too

Next TODO is: Filters do not maintain state when user filters and then sorts. I will fix later on

filter-state.2.mp4

@LEstradioto
Copy link
Author

ok its done 😄

@LEstradioto LEstradioto marked this pull request as ready for review November 1, 2024 22:15
@ACPK
Copy link

ACPK commented Nov 1, 2024

What do you think about changing the filter button’s color or adding a visual indicator to show when filtering is active?

@LEstradioto
Copy link
Author

great idea! I'll add that

@excid3
Copy link
Owner

excid3 commented Nov 5, 2024

Screenshot 2024-11-05 at 11 25 24 AM

I think we need a disconnect() to teardown the form before turbo cache.

@excid3
Copy link
Owner

excid3 commented Nov 5, 2024

Actually data-turbo-temporary might be all we need.

@brunoprietog
Copy link

Can we avoid using Flatpickr? 🙏🙏 It's not accessible at all. I wonder if a native input is enough. Otherwise, I'd suggest using Duet Date Picker.

@excid3
Copy link
Owner

excid3 commented Nov 7, 2024

@brunoprietog yeah! I think date and datetime-local inputs should be fine?

Rails also has the date time select fields but they're kind of a pain to use.

@brunoprietog
Copy link

I think date and datetime-local inputs should be fine?

Yes!

@LEstradioto
Copy link
Author

Even though flatpickr auto-deactivates on mobile, would be way better to apply native + pure css solution, if any...
is it odd that all pickers lib gets deprecated in the long run? 😭

@LEstradioto
Copy link
Author

LEstradioto commented Nov 8, 2024

Update:

  • no flatpickr on filters
  • teardown on disconnect (data-turbo-temporary was no good in this case)

Should I remove flatpickr completely from madmin ? @excid3 if so, in another PR or add to this?

@excid3
Copy link
Owner

excid3 commented Nov 8, 2024

@LEstradioto I'll do it separately

I'm surprised data-turbo-temporary didn't work. I may take a look and see if I can get it going.

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.

4 participants