From 6aff545626e8500bbd07d395aea7c00925de6ed4 Mon Sep 17 00:00:00 2001 From: alexdbondoc17 Date: Mon, 28 Feb 2022 07:23:13 +0000 Subject: [PATCH] Fix pagination for `cited_documents` --- app/controllers/documents_controller.rb | 1 + app/views/documents/show.html.erb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 71a9b66..52e0926 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -20,6 +20,7 @@ class DocumentsController < ApplicationController where = { enabled: true, state: "published" } @cited_in_documents = @document.class.citing_docs_of(@document, where) + @paginated_cited_in_documents = Kaminari.paginate_array(@cited_in_documents, total_count: @cited_in_documents.count).page(params[:page]).per(20) # @cross_ref_documents = @document.class.cited_docs_of(document, where) end diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb index 3eeac0b..a2e2db4 100644 --- a/app/views/documents/show.html.erb +++ b/app/views/documents/show.html.erb @@ -82,7 +82,7 @@
" id="citatonTabContent" role="tabpanel">

Cited In

-
<%= render PaginationComponent.new(data: @cited_in_documents, opts: { is_cited_in_doc: true}) %>
+
<%= render PaginationComponent.new(data: @paginated_cited_in_documents, opts: { is_cited_in_doc: true}) %>