Skip to content

Allow filtering with a time/date picker#3231

Merged
tvdeyen merged 4 commits intoAlchemyCMS:mainfrom
mamhoff:date-search
Apr 2, 2025
Merged

Allow filtering with a time/date picker#3231
tvdeyen merged 4 commits intoAlchemyCMS:mainfrom
mamhoff:date-search

Conversation

@mamhoff
Copy link
Copy Markdown
Contributor

@mamhoff mamhoff commented Apr 2, 2025

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

grafik

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

@mamhoff mamhoff requested a review from a team as a code owner April 2, 2025 09:09
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
Copy link
Copy Markdown

codecov bot commented Apr 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.80%. Comparing base (6c8538f) to head (999a6ab).
Report is 5 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.
@mamhoff mamhoff changed the title Date search Allow filtering with a time/date picker Apr 2, 2025
mamhoff added 2 commits April 2, 2025 11:33
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
```
@tvdeyen tvdeyen added this to the 8.0 milestone Apr 2, 2025
Copy link
Copy Markdown
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@tvdeyen tvdeyen enabled auto-merge April 2, 2025 09:40
@tvdeyen tvdeyen merged commit 75b25eb into AlchemyCMS:main Apr 2, 2025
39 checks passed
@alchemycms-bot alchemycms-bot bot mentioned this pull request Feb 4, 2026
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.

2 participants