Add pagination to the list of filtered cards

This commit is contained in:
Jorge Manrubia
2025-10-02 15:54:02 +02:00
parent bc90129af2
commit b986927e25
2 changed files with 12 additions and 1 deletions
+9
View File
@@ -35,6 +35,15 @@ module PaginationHelper
end
end
def with_automatic_pagination(name, page, **properties)
pagination_list name, paginate_on_scroll: true, **properties do
concat(pagination_frame_tag(name, page) do
yield
concat link_to_next_page(name, page, activate_when_observed: true)
end)
end
end
def day_timeline_pagination_frame_tag(day_timeline, &)
turbo_frame_tag day_timeline_pagination_frame_id_for(day_timeline.day), data: { timeline_target: "frame" }, role: "presentation", refresh: :morph, &
end
+3 -1
View File
@@ -27,6 +27,8 @@
<%= turbo_frame_tag :cards_container do %>
<section class="cards cards--grid">
<%= render partial: "cards/display/preview", collection: @page.records, as: :card, locals: { draggable: true }, cached: ->(card) { cacheable_preview_parts_for(card) } %>
<%= with_automatic_pagination :cards_paginated_container, @page do %>
<%= render partial: "cards/display/preview", collection: @page.records, as: :card, locals: { draggable: true }, cached: ->(card) { cacheable_preview_parts_for(card) } %>
<% end %>
</section>
<% end %>