Skip to content

Feature Suggestion: Add filter hints to filter tooltip popover - #3069

Open
redbassett wants to merge 1 commit into
thoughtbot:mainfrom
redbassett:add-filter-hints
Open

redbassett wants to merge 1 commit into
thoughtbot:mainfrom
redbassett:add-filter-hints

Conversation

@redbassett

Copy link
Copy Markdown

Using administrate on a client project recently, I was asked if it was possible to add clarifying text to describe what filters within the search for a dashboard did. I have brought the solution I implemented within that project to the core administrate codebase in this PR as a feature suggestion if this is useful for other users of administrate.

Developers using administrate can add a filter_hint string translation, similar to the field_hint translation used for form hints, and the value of the translation will be displayed in the filter tooltip popover shown when filters are present in a dashboard:

en:
  administrate:
    filter_hints:
      customer:
        inactive: "Only show customers who haven't logged in in the past week"

By default the styling of the popover handles this additional text without any major issues, however long strings can stretch this popover significantly. I have included bare minimum styling to pad the hint text away from the filter key/value text for readability but I haven't addressed long hint strings with this styling as I didn't want to change the existing popover styles too much. Such styling can be added if this is considered to be a likely issue.

This PR includes the view logic to find filter hints, adds a filter hint to the example app to demonstrate the functionality, adds documentation within the relevant section on filters, and adds test coverage modeled on field_hint tests.

- Adds view logic to retrieve filter hints, if defined
- Adds styling to seperate hint text from filter example
- Adds example filter hint to example app
- Adds defining filter hints to documentation
- Adds test coverage

This branch has not been deployed

No deployments
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.

1 participant