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

Dynamic filters: finetune dropdown list #3206

Open
pjmuller opened this issue Sep 2, 2024 · 3 comments
Open

Dynamic filters: finetune dropdown list #3206

pjmuller opened this issue Sep 2, 2024 · 3 comments

Comments

@pjmuller
Copy link

pjmuller commented Sep 2, 2024

Feature

We have a TON of dynamic filters (as we create one per belongs_to nested attribute, imagine the order resource)

Now it is a very long list (50+ filters)
would be great to ORGANIZE it more

One idea is to let as inject some html attributes, and then via some custom written JS & CSS (loaded in app/views/avo/partials/_pre_head.html.erb ) make it more user friendly to add

  • dividers
  • nested menu
class Avo::Resources::Order < Avo::BaseResource
  def fields
    field :status, as: :select, ...
    field :customer, as: :belongs_to
  end

  # html hacky way, 80/20 all the way
  def filters
    dynamic_filter :status
    dynamic_filter :divider, type: :text, label: "----", html: { classes: "disabled section" }
    dynamic_filter :customer_group, label: "Customer ➡️", type: :text, html: { data: {filter_group_heading: "customer" }}
    dynamic_filter :customer_firstname, as: :text, html: {data: {filter_group_child: "customer" }}
  end

  # first class way, much cleaner but requires more effort of AVO
  def filters
    dynamic_filter :status
    divider # like we have in https://docs.avohq.io/3.0/actions.html#divider
    filter_group "Customer ➡️" do
       dynamic_filter :customer_firstname, as: :text
       # ...
    end
  end

end

PS: this is related to: #3181

Current workarounds

Write even more hacky CSS/JS that will work on existing rendered DOM

@pjmuller
Copy link
Author

pjmuller commented Sep 5, 2024

@Paul-Bob ping: could you give an estimate how much time either approach would take? We might want to sponsor it

  • approach 1: please budget time for both the html attribute, as well as some example JS code (? using hotwire) to remap it to a nested menu
  • approach 2: full DSL path

@adrianthedev
Copy link
Collaborator

Hey @pjmuller how about having an in-place quick search for the initial iteration?
The dropdowns might get fiddly to build and you might need/want customizations to them.

CleanShot.2024-09-09.at.09.52.14.mp4

@pjmuller
Copy link
Author

pjmuller commented Sep 16, 2024

Hi @adrianthedev , yes makes sense.
Though in the short term we'll try to limit the options ourselves so this feature is more LOW prio.
Still thanks for thinking along with us ❤️

If you wish you can close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants