class DoctrineIndexComponent < BaseComponent attr_reader :search_results, :opts include AnnotationSearch include DoctrineSearch def initialize(search_results:, current_user:, opts: {}) @search_results = search_results @opts = opts end def annotation_form_url doctrine_annotations_path(doctrine_id: id) end def subject_names "(No Subjects Provided)" end def document_title(annotation) return annotation.document.short_title if annotation.document.short_title.present? annotation.document.title end def date_or_year(annotation) return annotation.document.docdate.to_date.strftime("%B %d, %Y") if annotation.document.docdate.present? annotation.document.year end def doctrine_show_url return document_doctrine_path(jurisprudence.id, id, is_index_table: false, subject_ids: opts[:subject_ids].reject(&:blank?)) if jurisprudence.present? doctrine_path(id, is_index_table: false, subject_ids: opts[:subject_ids].reject(&:blank?)) end def clean_phil_rep(annotation) return if annotation.phil_rep.blank? annotation.phil_rep.gsub(/(PhilRep|Phil)\.?,?/i, "Phil") end def search_annotations(search_params) search = annotation_search(search_params) search.results end def content_diplay_text(annotation) return annotation.content.gsub("