avo icon indicating copy to clipboard operation
avo copied to clipboard

Allow proc on filter `self.name` and `self.button_label`

Open Paul-Bob opened this issue 5 months ago • 2 comments

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 avatar Sep 13 '24 12:09 Paul-Bob