class ReportsSearchResultsComponent < BaseComponent with_collection_parameter :search_result attr_reader :search_result, :opts def initialize(search_result:, current_user:, opts: {}) @search_result = search_result @opts = opts end delegate :id, to: :search_result delegate :headnote, to: :search_result delegate :subject_ids, to: :search_result delegate :content, to: :search_result delegate :annotations, to: :search_result delegate :subjects, to: :search_result delegate :doctrine_jurisprudences, to: :search_result def annotation_form_url doctrine_annotations_path(doctrine_id: id) end def subject_names "(No Subjects Provided)" end def jurisprudence return nil if doctrine_jurisprudences.blank? doctrine_jurisprudences.first.jurisprudence 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 render? opts[:is_render].present? end end