Allow filtering with a time/date picker#3231
Merged
tvdeyen merged 4 commits intoAlchemyCMS:mainfrom Apr 2, 2025
Merged
Conversation
Rather than using "01.04.2024", in which it is not clear which is month and which is day, we use "2024-04-01", in which is is somewhat more clear. This also aligns with the default time translation in `alchemy_i18n`.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3231 +/- ##
==========================================
+ Coverage 96.78% 96.80% +0.01%
==========================================
Files 265 267 +2
Lines 6720 6759 +39
==========================================
+ Hits 6504 6543 +39
Misses 216 216 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This filter takes a default (or none), and displays a Datepicker field. It can be used to filter by dates, as the next commit will show.
This can be used with the new filtering DSL: ```rb class Admin::MyResourceController < Alchemy::ResourcesController add_alchemy_filter :starts_at_gteq, :datepicker, input_type: :date, default: Date.current end ```
This can be quite useful for admins!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this pull request for?
This adds a new filter type: Filtering with a datepicker. The datepicker can either display as a date, as a time and date, or a time, and will create the appropriate parameters. Out of the box, you get things like "updated_at_lteq" from Ransack, for things like "starts after x PM" you'd have to write a ransackable scope.
Notable changes (remove if none)
Feature addition only.
Screenshots
Checklist