Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use ActiveRecord Enum labels in current filters status#7790

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
harunkumars wants to merge10 commits intoactiveadmin:master
base:master
Choose a base branch
Loading
fromharunkumars:3157-use-enum-labels-in-current-filters-search-status

Conversation

@harunkumars
Copy link

Fixes Issue#3157 - Display Enum labels for Active Filters in Current Search Status

ActiveAdmin::Filters::ActiveFilter#values controls the displayed value for active filters.
This currently does not have any special handling for Enums.

For e.g. with an enum definition likeenum status: [:inactive, :active], when filtering for :inactive status, the Current Search Status widget shows "Status is0"

This PR, uses ActiveRecord::Enum.defined_enums to translate the display value for the filter to the associated label for enums. The Current Search Status widget will now show "Status isInactive"

If a custom collection is provided when registering the ActiveAdmin resource e.g.filter :status, as: :select, collection: [[:not_active, 0], [:active, 1]] which specifies dropdown labels that are different from the enum labels, then the dropdown label from the custom collection is used. The Current Search Status widget will now show "Status isNot Active"

Sample before and after screenshots attached:
Before Fix:
before_fix_for_3157

After Fix:
after_fix_for_3157

mvz, Fs00, tonyfactory, and wrozka reacted with heart emoji
@javierjuliojavierjulio changed the title3157 use enum labels in current filters search statusUse ActiveRecord Enum labels in current filters statusMar 12, 2023
@javierjuliojavierjulioforce-pushed the3157-use-enum-labels-in-current-filters-search-status branch from17eada7 to18135b2CompareMarch 13, 2023 01:26
@codecov
Copy link

codecovbot commentedMar 13, 2023
edited
Loading

Codecov Report

Patch coverage:100.00% and no project coverage change.

Comparison is base(25c74c7) 98.92% compared to head(0221992) 98.93%.

Additional details and impacted files
@@           Coverage Diff           @@##           master    #7790   +/-   ##=======================================  Coverage   98.92%   98.93%           =======================================  Files         197      197             Lines        4950     4963   +13     =======================================+ Hits         4897     4910   +13  Misses         53       53
Impacted FilesCoverage Δ
lib/active_admin/filters/active_filter.rb100.00% <100.00%> (ø)

... and2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell ushow you rate us. Have a feature suggestion?Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment?Let us know in this issue.

@javierjuliojavierjulioforce-pushed the3157-use-enum-labels-in-current-filters-search-status branch 3 times, most recently fromff3c597 to0221992CompareMarch 19, 2023 01:39
@Aesthetikx
Copy link
Contributor

Great work on this@harunkumars, thank you!

harunkumars reacted with heart emoji

@codespore
Copy link

Any updates on this PR?

@harunkumarsharunkumarsforce-pushed the3157-use-enum-labels-in-current-filters-search-status branch from0221992 to396d75bCompareJune 27, 2025 04:13
@harunkumars
Copy link
Author

Just had toFix use of deprecated enum syntax. Ready for review.

Same example from before with current version of ActiveAdmin
Screenshot 2025-06-27 at 11 33 15 AM

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@harunkumars@Aesthetikx@codespore

[8]ページ先頭

©2009-2025 Movatter.jp