# frozen_string_literal: true class DoctrinesReflex < ApplicationReflex include DoctrineSearch include DocumentSearch def render_document_doctrines_index(search_params) search = doctrine_search(search_params) morph "#doctrinesIndexView", render(partial: "/shared/document_doctrines_index", locals: { doctrines: search.results, current_user: current_user, opts: { document_id: search_params[:jurisprudence_id], current_page: search_params[:page] } }) end def render_annotation_modal_form(document_id, doctrine_id) jurisprudence = Cdao::Jurisprudence.find(document_id) document = Cdao::Document.where(reference_number: jurisprudence.reference_number).first morph "#doctrineModal", render(partial: "/shared/annotation_modal_form", locals: { document: document, doctrine_id: doctrine_id, jurisprudence: jurisprudence }) end def render_annotation_form(document_id, doctrine_id) jurisprudence = Cdao::Jurisprudence.find(document_id) document = Cdao::Document.where(reference_number: jurisprudence.reference_number).first morph "#doctrineForm", render(partial: "/shared/annotation_form", locals: { annotation: Annotation.new, document: document, doctrine_id: doctrine_id, jurisprudence: jurisprudence }) end def render_doctrine_form_annotations_view(annotations) morph "#doctrineAnnotationsView", render(partial: "/shared/doctrine_form_annotations_view", locals: { annotations: annotations }) end def render_citing_documents_search_results(search_params) search = document_search(search_params.merge(sort_by: %w[reference_number_texts title_texts short_title_texts])) @documents = search.results opts = { current_page: search_params[:page], q: search_params[:q] } morph "#citingDocumentsSearchResults", render(partial: "/shared/doctrine_form_citing_documents_search_results", locals: { documents: @documents, opts: opts }) end def render_default_citing_documents morph "#citingDocumentsSearchResults", render(partial: "/shared/doctrine_form_citing_documents_search_results", locals: { documents: [], opts: {} }) end def render_default_case_lists morph "#caseListsCollapse", render(partial: "/shared/doctrine_form_default_case_lists", locals: { documents: @documents, opts: {} }) end end