Browse Source

Fix pagination for `cited_documents`

pull/77/head
alexdbondoc17 4 years ago
parent
commit
6aff545626
  1. 1
      app/controllers/documents_controller.rb
  2. 2
      app/views/documents/show.html.erb

1
app/controllers/documents_controller.rb

@ -20,6 +20,7 @@ class DocumentsController < ApplicationController
where = { enabled: true, state: "published" } where = { enabled: true, state: "published" }
@cited_in_documents = @document.class.citing_docs_of(@document, where) @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) # @cross_ref_documents = @document.class.cited_docs_of(document, where)
end end

2
app/views/documents/show.html.erb

@ -82,7 +82,7 @@
<div class="tab-pane fade cited-table-body <%= params[:is_citator_tab].to_s.eql?("true") ? 'active show' : '' %>" id="citatonTabContent" role="tabpanel"> <div class="tab-pane fade cited-table-body <%= params[:is_citator_tab].to_s.eql?("true") ? 'active show' : '' %>" id="citatonTabContent" role="tabpanel">
<div class="d-flex align-items-baseline"> <div class="d-flex align-items-baseline">
<div class="col-md-6 mt-3 ps-3"> <h4> Cited In </h4> </div> <div class="col-md-6 mt-3 ps-3"> <h4> Cited In </h4> </div>
<div class="col-md-6"> <%= render PaginationComponent.new(data: @cited_in_documents, opts: { is_cited_in_doc: true}) %> </div> <div class="col-md-6"> <%= render PaginationComponent.new(data: @paginated_cited_in_documents, opts: { is_cited_in_doc: true}) %> </div>
</div> </div>
<table class="table table-hover mb-0 table-width"> <table class="table table-hover mb-0 table-width">
<thead style="position: sticky;top: 0"> <thead style="position: sticky;top: 0">

Loading…
Cancel
Save