# frozen_string_literal: true class DocumentReflex < ApplicationReflex include DocumentSearch def render_case_lists_search_results(search_params, doctrine_id, jurisprudence_id) search = document_search(search_params.merge(sort_by: %i[reference_number_texts title_texts short_title_texts])) @documents = search.results opts = { doctrine_id: doctrine_id, jurisprudence_id: jurisprudence_id, current_page: search_params[:page], q: search_params[:q], citation_finder: search_params[:citation_finder] } morph "#caseListsCollapse", render(partial: "/shared/case_lists_search_results", locals: { documents: @documents, opts: opts }) end def render_years(results) morph "tbody#yearsIndex", render(DocumentsYearsComponent.new(current_user: current_user, years: results)) end def render_modal_document_search_table(search_params) search = document_search(search_params) @documents = search.results morph "tbody#modalDocumentSearchTable", render(partial: "document_search_results_table", locals: { search_results: @documents, opts: { is_citing_document: true } }) end def render_doctrine_form_case_lists(search_params) search = document_search(search_params.merge(sort_by: %i[reference_number_texts title_texts short_title_texts])) @documents = search.results opts = { current_page: search_params[:page], q: search_params[:q], citation_finder: search_params[:citation_finder] } morph "#caseListsCollapse", render(partial: "/shared/doctrine_form_case_lists", locals: { documents: @documents, opts: opts }) end end