class DocumentsController < ApplicationController include JurisprudenceSearch include DoctrineSearch load_and_authorize_resource :document, class: "Cdao::Jurisprudence", only: %i[index search] load_and_authorize_resource :document, class: "Cdao::Document", only: %i[show] def index @search_params = search_params search = jurisprudence_search(@search_params) @jurisprudences = search.results respond_to do |format| format.html end end def show if @document.library.document_type.eql?(Cdao::Library.first.document_type) @jurisprudence = Cdao::Jurisprudence.find(@document.doc_id) where = { enabled: true, state: "published" } @cited_in_documents = @jurisprudence.class.citing_docs_of(@jurisprudence, where) @paginated_cited_in_documents = Kaminari.paginate_array(@cited_in_documents, total_count: @cited_in_documents.count).page(params[:page]).per(20) end # @cross_ref_documents = @document.class.cited_docs_of(document, where) end def search index respond_to do |format| format.html { render :search } end end private def search_params params.permit(:reference_number, :title, :short_title, :ponente, :year_start, :year_end, :citation_finder, :subject_ids, :q, :page, :per_page) end end