Skip to content

Commit

Permalink
Get access for turbo_frame inside of panel_component
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielgiroe1 committed Jan 24, 2024
1 parent dde3170 commit db97279
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/components/avo/panel_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Avo::PanelComponent < ViewComponent::Base
attr_reader :title # deprecating title in favor of name
attr_reader :name
attr_reader :classes
attr_reader :turbo_frame

delegate :white_panel_classes, to: :helpers

Expand All @@ -15,7 +16,7 @@ class Avo::PanelComponent < ViewComponent::Base
renders_one :footer_tools
renders_one :footer

def initialize(name: nil, description: nil, body_classes: nil, data: {}, display_breadcrumbs: false, index: nil, classes: nil, **args)
def initialize(name: nil, description: nil, body_classes: nil,turbo_frame: nil, data: {}, display_breadcrumbs: false, index: nil, classes: nil, **args)
# deprecating title in favor of name
@title = args[:title]
@name = name || title
Expand All @@ -25,6 +26,7 @@ def initialize(name: nil, description: nil, body_classes: nil, data: {}, display
@data = data
@display_breadcrumbs = display_breadcrumbs
@index = index
@turbo_frame = turbo_frame
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/views/resource_index_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
**@resource.stimulus_data_attributes
} do %>
<%= render_cards_component %>
<%= render Avo::PanelComponent.new(name: title, description: description, data: { component: 'resources-index' }, display_breadcrumbs: @reflection.blank?) do |c| %>
<%= render Avo::PanelComponent.new(name: title, description: description, data: { component: 'resources-index' }, display_breadcrumbs: @reflection.blank?, turbo_frame: @turbo_frame) do |c| %>
<% c.with_tools do %>
<% @resource.render_index_controls(item: singular_resource_name.downcase).each do |control| %>
<%= render_control control %>
Expand Down

0 comments on commit db97279

Please sign in to comment.