Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
ruby: ['3.3', '3.4', '4.0']
rails: ['8.0.0', '8.1.0']
activeadmin: ['3.2.0', '3.5.0']
activeadmin: ['3.2.0', '3.5.0', '4.0.0.beta23']
env:
RAILS: ${{ matrix.rails }}
AA: ${{ matrix.activeadmin }}
Expand Down
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Changelog

## Unreleased

### Breaking

- The plugin is plain JavaScript; jQuery is no longer used. `$.fn.date_range_ext_preset`
is removed. Use `ActiveAdminDateRangePreset.init(selector, options)` and
`ActiveAdminDateRangePreset.defaults`. Options keep their names, so
`$('.my_pairs').date_range_ext_preset({ show_time: true })` becomes:

```javascript
document.addEventListener('DOMContentLoaded', function () {
ActiveAdminDateRangePreset.init('.my_pairs', { show_time: true });
});
```

and `$.fn.date_range_ext_preset.defaults.show_time = true` becomes
`ActiveAdminDateRangePreset.defaults.show_time = true`.
- `gteq_input` and `lteq_input` take CSS selectors or elements, not jQuery selectors.
- The stylesheet is plain CSS: `active_admin_date_range_preset.scss` is now
`active_admin_date_range_preset.css`, in the gem and the npm package. A bare
`@import "active_admin_date_range_preset";` still works.
- Filling an input fires bubbling `input` and `change` events.
- `add_range` titles are plain text; HTML in a title is shown as written.

### Added

- Active Admin 4 support: the module is pinned into `ActiveAdmin.importmap`.
- `date` inputs get `YYYY-MM-DD` and `datetime-local` inputs get `YYYY-MM-DDTHH:MM`,
plus seconds when the input's `step` allows them.
- Dark mode for the menu under the `.dark` class.
- `data-date-range-preset-toggle`, `data-date-range-preset-menu` and
`data-date-range-preset="<key>"` hooks.
- A `.datetime_preset_pair` wrapper that holds both inputs, such as a range filter,
fills its own first and last input.
- Opening the menu focuses the first preset. Arrow keys move between presets,
Enter or Space picks one and Escape closes the menu.
17 changes: 14 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@ gemspec
default_rails_version = '8.0.0'
default_activeadmin_version = '3.5.0'

activeadmin_version = ENV['AA'] || default_activeadmin_version

gem 'rails', "~> #{ENV['RAILS'] || default_rails_version}"
gem 'activeadmin', "~> #{ENV['AA'] || default_activeadmin_version}"
gem 'sprockets-rails'
gem 'sass-rails'
gem 'activeadmin', "~> #{activeadmin_version}"

# Active Admin 4 has no Sprockets: its layout renders an import map and a
# Tailwind-built stylesheet.
if Gem::Version.new(activeadmin_version) >= Gem::Version.new('4.0.0.beta1')
gem 'propshaft'
gem 'importmap-rails'
gem 'tailwindcss-ruby', '~> 4.0'
else
gem 'sprockets-rails'
gem 'sass-rails'
end

group :test do
gem 'simplecov', require: false
Expand Down
Loading
Loading