From 6107b6867e85a369dbbae6b5ae9e1f7677c62cf5 Mon Sep 17 00:00:00 2001 From: Paul Bob <69730720+Paul-Bob@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:50:50 +0300 Subject: [PATCH] fix: paginator component turbo_frame (#3183) * fix: paginator component turbo_frame * :_top symbol instead "_top" string --- app/components/avo/paginator_component.rb | 4 +++- app/components/avo/views/resource_index_component.html.erb | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/components/avo/paginator_component.rb b/app/components/avo/paginator_component.rb index 324d8ec85d..1f93db8035 100644 --- a/app/components/avo/paginator_component.rb +++ b/app/components/avo/paginator_component.rb @@ -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) diff --git a/app/components/avo/views/resource_index_component.html.erb b/app/components/avo/views/resource_index_component.html.erb index 612d8c54f6..89135d7ad8 100644 --- a/app/components/avo/views/resource_index_component.html.erb +++ b/app/components/avo/views/resource_index_component.html.erb @@ -79,7 +79,7 @@ <% if view_type.to_sym == :table || view_type.to_sym == :map %> <% if @records.present? %>
- <%= 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 %>
<% end %> <% end %> @@ -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) %>
- <%= 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 %>
<% end %> <% end %>