Skip to content

Commit

Permalink
fix: paginator component turbo_frame (#3183)
Browse files Browse the repository at this point in the history
* fix: paginator component turbo_frame

* :_top symbol instead "_top" string
  • Loading branch information
Paul-Bob authored Aug 23, 2024
1 parent 4a7798b commit 6107b68
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/components/avo/paginator_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ class Avo::PaginatorComponent < Avo::BaseComponent
prop :resource, _Nilable(Avo::BaseResource)
prop :parent_record, _Nilable(ActiveRecord::Base)
prop :pagy, _Nilable(Pagy)
prop :turbo_frame, _Nilable(String)
prop :turbo_frame, _Nilable(_Union(String, Symbol)) do |frame|
frame.present? ? CGI.escapeHTML(frame) : :_top
end
prop :index_params, _Nilable(Hash)
prop :discreet_pagination, _Nilable(_Boolean)

Expand Down
4 changes: 2 additions & 2 deletions app/components/avo/views/resource_index_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<% if view_type.to_sym == :table || view_type.to_sym == :map %>
<% if @records.present? %>
<div class="mt-4 w-full">
<%= render Avo::PaginatorComponent.new pagy: @pagy, turbo_frame: @turbo_frame || "none", index_params: @index_params, resource: @resource, parent_record: @parent_record, discreet_pagination: field&.discreet_pagination %>
<%= render Avo::PaginatorComponent.new pagy: @pagy, turbo_frame: @turbo_frame, index_params: @index_params, resource: @resource, parent_record: @parent_record, discreet_pagination: field&.discreet_pagination %>
</div>
<% end %>
<% end %>
Expand All @@ -88,7 +88,7 @@
<%= render Avo::Index::ResourceGridComponent.new(resources: @resources, resource: @resource, reflection: @reflection, parent_record: @parent_record, parent_resource: @parent_resource, actions: @actions) %>
</div>
<div class="mt-6">
<%= render Avo::PaginatorComponent.new pagy: @pagy, turbo_frame: @turbo_frame || "none", index_params: @index_params, resource: @resource, parent_record: @parent_record, discreet_pagination: field&.discreet_pagination %>
<%= render Avo::PaginatorComponent.new pagy: @pagy, turbo_frame: @turbo_frame, index_params: @index_params, resource: @resource, parent_record: @parent_record, discreet_pagination: field&.discreet_pagination %>
</div>
<% end %>
<% end %>
Expand Down

0 comments on commit 6107b68

Please sign in to comment.