app/components/avo/actions_component.rb in avo-3.8.1 vs app/components/avo/actions_component.rb in avo-3.8.2

- old
+ new

@@ -2,11 +2,11 @@ class Avo::ActionsComponent < ViewComponent::Base include Avo::ApplicationHelper attr_reader :label, :size, :as_row_control - def initialize(actions: [], resource: nil, view: nil, exclude: [], include: [], style: :outline, color: :primary, label: nil, size: :md, as_row_control: false, icon: "heroicons/outline/arrow-down-circle") + def initialize(actions: [], resource: nil, view: nil, exclude: [], include: [], style: :outline, color: :primary, label: nil, size: :md, as_row_control: false, icon: nil) @actions = actions || [] @resource = resource @view = view @exclude = Array(exclude) @include = include @@ -84,17 +84,23 @@ def icon(action) svg action.icon, class: "h-5 shrink-0 mr-1 inline pointer-events-none" end def render_item(action) - if action.is_a?(Avo::DividerComponent) - render Avo::DividerComponent.new - else + case action + when Avo::Divider + render_divider(action) + when Avo::BaseAction render_action_link(action) end end private + + def render_divider(action) + label = action.label.is_a?(Hash) ? action.label[:label] : nil + render Avo::DividerComponent.new(label) + end def render_action_link(action) link_to action_path(action), data: action_data_attributes(action), title: action.action_name,