avo icon indicating copy to clipboard operation
avo copied to clipboard

Add sidebar to has many fields panels

Open Paul-Bob opened this issue 1 year ago • 6 comments

Feature

Add the possibility to add a sidebar to a has_many field panel.

Current workarounds

    panel do
      field :posts, as: :has_many
      sidebar panel_wrapper: false do
        tool Avo::ResourceTools::SidebarTool, render_panel: true
      end
    end

This is creating a panel around the has_many and the sidebar, leading to white_panel_classes on the has_many panel background and also the buttons are not above the sidebar. Ideally we should be able to insert the sidebar inside the has_many field

Screenshots or screen recordings

image

Paul-Bob avatar Jan 09 '24 13:01 Paul-Bob

Maybe we can add a sidebar to the Index view ...

An alternative DSL would be something like this.

field :posts, as: :has_many, sidebar: -> do
  tool Avo::ResourceTools::SidebarTool
end

adrianthedev avatar Jan 09 '24 13:01 adrianthedev

I was thinking the same but it have a minor issue, forcing to only 1 sidebar on that panel.

Maybe something like:

field :posts, as: :has_many, panel: -> do
  field # this render the field :posts, as: :has_many
  sidebar panel_wrapper: false do
    tool Avo::ResourceTools::SidebarTool, render_panel: true
  end
end

Not great, the idea is to allow multiple sidebars

Paul-Bob avatar Jan 09 '24 16:01 Paul-Bob

Or maybe

field :posts, as: :has_many, sidebars: -> do
  sidebar do
    tool Avo::ResourceTools::SidebarTool
  end
end

Paul-Bob avatar Jan 10 '24 10:01 Paul-Bob

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

github-actions[bot] avatar Jan 28 '24 01:01 github-actions[bot]

We currently use the following format:

main_panel do
    field :subrecords, as: :has_many
    sidebar do
        field :sidebar_field, as: :text
    end
end

The problem is the has_many field is in a wrapper. Is there any way to turn off the wrapper as a temporary workaround until this feature is released?

iyerushalmi avatar Feb 21 '24 00:02 iyerushalmi

No, there isn't a woraround for that yet.

Would you be open to send in a PR for this @iyerushalmi?

adrianthedev avatar Feb 21 '24 06:02 adrianthedev