You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds Active Admin 4 support while keeping Active Admin 3 behaviour unchanged. On v4 the gem crashed at boot, because it prepended ActiveAdmin::Filters::ViewHelper and ActiveAdmin::Filters::ActiveSidebar, and Active Admin 4 removed both.
Decisions the diff does not make obvious:
The v3 prepends now run only on v3. On v4 the gem prepends ActiveAdmin::FormHelper#active_admin_filters_form_for and wraps the if: of active_search_sidebar_section, so Current Filters still shows when only defaults apply.
The v4 filters section keeps Active Admin's own h3.filters-form-title and adds no second title. With active_admin_theme v4, the panel title is the only visible heading, because the theme hides .panel .filters-form-title.
The Active Admin 4 layout renders only the :error, :alert and :notice flash keys. On v4 the with: and require_any_filter warnings go to :alert; on v3 they still go to :warning. An arriving :alert wins.
New data-filter-extensions-form and data-filter-extensions-title hooks.
The gem ships no JS or CSS, so hosts load nothing new. The gemspec now allows < 5.0.0.a, so this is a minor release. The version is not bumped here.
Verified: full suite green on AA 3.5.2 (Rails 8.0) and AA 4.0.0.beta23 (Rails 8.0 and 8.1). CI adds 4.0.0.beta23 to the matrix.
Active Admin 4 removed Filters::ViewHelper and Filters::ActiveSidebar, so
those prepends now run only on v3. On v4 the gem hooks FormHelper and the
active_search section's condition, and sends warnings to :alert, the only
warning-like key the v4 layout renders.
Co-Authored-By: Clanker
Active Admin 4 hands Ransack its authorization adapter, so a model's
ransackable_attributes can depend on the admin. Both of this gem's Ransack
calls dropped it, which could leave a permitted filter unapplied or fail
key derivation for a defaulted filter.
Co-Authored-By: Clanker
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The fallback can show an empty Current Filters section after a blank submission with defaults, and the flash-key test can pass even when the stock AA4 layout hides the warning.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Avoid showing default filters after a blank submission
On v4, a blank submission such as /admin/string_posts?commit=Filter deliberately suppresses optional defaults and has no q, but filter_default_values still contains the configured default. This fallback therefore shows an empty Current Filters section on an unfiltered page. Check the effective filtering_params instead, and add a regression case for a blank submission on a resource with defaults.
Test version-specific warning flash keys independently
spec/integration/with_spec.rb:51
The AA4 test app renders every flash key, and this assertion derives its expected key from the same helper that writes the warning. Returning :warning on AA4 would therefore still pass, although the stock layout would hide the warning. Assert the literal :alert key on v4 and :warning on v3 independently of warning_flash_key.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
On Active Admin 4, blank filter submissions incorrectly display the Current Filters panel, while the sidebar tests follow a redirect that prevents them from exercising the defaults-only behavior.
it "keeps the Current Filters panel off where the resource turned it off" do
visit "/admin/quiet_default_posts"
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
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.
Adds Active Admin 4 support while keeping Active Admin 3 behaviour unchanged. On v4 the gem crashed at boot, because it prepended
ActiveAdmin::Filters::ViewHelperandActiveAdmin::Filters::ActiveSidebar, and Active Admin 4 removed both.Decisions the diff does not make obvious:
ActiveAdmin::FormHelper#active_admin_filters_form_forand wraps theif:ofactive_search_sidebar_section, so Current Filters still shows when only defaults apply.h3.filters-form-titleand adds no second title. With active_admin_theme v4, the panel title is the only visible heading, because the theme hides.panel .filters-form-title.:error,:alertand:noticeflash keys. On v4 thewith:andrequire_any_filterwarnings go to:alert; on v3 they still go to:warning. An arriving:alertwins.data-filter-extensions-formanddata-filter-extensions-titlehooks.< 5.0.0.a, so this is a minor release. The version is not bumped here.Verified: full suite green on AA 3.5.2 (Rails 8.0) and AA 4.0.0.beta23 (Rails 8.0 and 8.1). CI adds 4.0.0.beta23 to the matrix.