avo icon indicating copy to clipboard operation
avo copied to clipboard

`add_filters_for_all_fields` dynamic filters helper

Open adrianthedev opened this issue 11 months ago • 3 comments

Feature

Naming is TBD

We'd like to have a way to add all the possible dynamic filters for all index fields.

Current workarounds

Screenshots or screen recordings

Additional context

adrianthedev avatar Dec 20 '24 21:12 adrianthedev

# == Schema Information
#
# Table name: courses
#
#  id          :bigint           not null, primary key
#  name        :string
#  created_at  :datetime         not null
#  updated_at  :datetime         not null
#  skills      :text             default([]), is an Array
#  country     :string
#  city        :string
#  starting_at :time
#
class Course < ApplicationRecord
  # ...
end

class Avo::Resources::Course < Avo::BaseResource
  def fields
    field :name
    field :city, hide_on: :index
  end

  def filters
    add_filters_for_all_fields
  end
end

Output: The course index page should have 1 filter, for name

Paul-Bob avatar Dec 21 '24 10:12 Paul-Bob

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

github-actions[bot] avatar Jan 06 '25 02:01 github-actions[bot]

Just a random thought: the filterable option should become true by default in Avo4. At least for me, every time I've used Avo in an application, I've turned filterable to true on all fields.

Paul-Bob avatar Jun 10 '25 13:06 Paul-Bob