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

define actions within index_controls and let them be grouped in a actions_list #3135

Closed
pjmuller opened this issue Aug 14, 2024 · 4 comments · Fixed by #3144
Closed

define actions within index_controls and let them be grouped in a actions_list #3135

pjmuller opened this issue Aug 14, 2024 · 4 comments · Fixed by #3144
Assignees
Labels
Bug Something isn't working

Comments

@pjmuller
Copy link

pjmuller commented Aug 14, 2024

Feature

In Avo 3.11 we don't need to define actions anymore in def actions and can directly use them in def index_controls

However the following code shows the actions as SEPARATE button and not grouped in the list

class FoobarResource  < Avo::BaseResource
  def index_controls
     action Avo::Actions::BlaBla, arguments: {id: 1}
     action Avo::Actions::Haha, arguments: {id: 2}
     actions_list label: "lists"
  end
end

doesn't group them, they appear as top level entries

Screenshot 2024-08-14 at 12 33 16

Current workarounds

the old flow does group them

class FoobarResource  < Avo::BaseResource
  def actions
     action Avo::Actions::BlaBla, arguments: {id: 1}
     action Avo::Actions::Haha, arguments: {id: 2}
  end

  def index_controls
     actions_list label: "lists"
  end
end

⚠️ however since 3.11, the arguments gets LOST in this way (while they are remembered if defined within index_controls -> first code snippet of this issue)

@adrianthedev adrianthedev added the Bug Something isn't working label Aug 14, 2024
@Paul-Bob
Copy link
Contributor

doesn't group them, they appear as top level entries

class FoobarResource  < Avo::BaseResource
  def index_controls
     action Avo::Actions::BlaBla, arguments: {id: 1}
     action Avo::Actions::Haha, arguments: {id: 2}
     actions_list label: "lists" # list with all actions from `def actions`
  end

  def actions
    # empty
  end
end

actions_list picks the list from all the actions defined inside def actions so they appear as top-level entries as expected

the old flow does group them
⚠️ however since 3.11, the arguments gets LOST in this way

We'll investigate it

@pjmuller
Copy link
Author

pjmuller commented Aug 16, 2024

@Paul-Bob

  1. is there a plan to make a different kind actions_list directive within index_controls to create dropdowns "on the fly" without having to define anything in def actions
  2. yes please, investigate why arguments are getting lost as it's essential for proper invoking of our actions (though if you fix bullet point 1, then I don't need to define anything anymore in def actions and it's automatically solved) -> yet other users might face this regression...

@Paul-Bob
Copy link
Contributor

Paul-Bob commented Aug 16, 2024

is there a plan to make a different kind actions_list directive within index_controls to create dropdowns "on the fly" without having to define anything in def actions

Yes @pjmuller, check this issue #2784

Ideally something like this:

list do
  link_to "google", "https://google.com", ...options
  action ...options
end

@Paul-Bob Paul-Bob self-assigned this Aug 16, 2024
@Paul-Bob Paul-Bob mentioned this issue Aug 16, 2024
4 tasks
@Paul-Bob
Copy link
Contributor

Thanks for reporting this one @pjmuller. It's fixed on Avo 3.11.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants