class CitationIndexTableComponent < 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 :clean_reference_number, to: :search_result delegate :title, to: :search_result delegate :short_title, to: :search_result def date_or_year return search_result.docdate.strftime("%m/%d/%Y") if search_result.docdate.present? search_result.year end def doctrine_annotations_path(doctrine_id) doctrine_annotations_path(doctrine_id: doctrine_id) end def citator_path return document_path(search_result.document.id, is_citator_tab: true) if search_result.document.present? document_path(search_result.id, is_citator_tab: true) end end