Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow proc on filter self.name and self.button_label #3244

Closed
Paul-Bob opened this issue Sep 13, 2024 · 2 comments · Fixed by #3382 or avo-hq/docs.avohq.io#304
Closed

Allow proc on filter self.name and self.button_label #3244

Paul-Bob opened this issue Sep 13, 2024 · 2 comments · Fixed by #3382 or avo-hq/docs.avohq.io#304
Labels
Enhancement Not necessarily a feature, but something has improved Good first issue Good for newcomers Help wanted We could use some help with this

Comments

@Paul-Bob
Copy link
Contributor

Feature

Allow callable name and button_label on filters to ensure that localization is applied on each request.

class Avo::Filters::Club < Avo::Filters::TextFilter
  self.name = -> { I18n.t("avo.filter_translations.club.name") }
  self.button_label = -> { I18n.t("avo.filter_translations.club.button_label") }

  def apply(request, query, value)
    query.joins(:club).where("clubs.name ILIKE ?", "%#{value}%")
  end
end
@Paul-Bob Paul-Bob added the Enhancement Not necessarily a feature, but something has improved label Sep 13, 2024
Copy link
Contributor

This issue has been marked as stale because there was no activity for the past 15 days.

@github-actions github-actions bot added the Stale label Sep 29, 2024
@Paul-Bob Paul-Bob removed the Stale label Sep 29, 2024
@adrianthedev adrianthedev added the Help wanted We could use some help with this label Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Not necessarily a feature, but something has improved Good first issue Good for newcomers Help wanted We could use some help with this
Projects
Status: Done
2 participants