class DocumentIndexTableComponent < 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 show_url return document_path(search_result.id, is_citator_tab: true) if opts[:is_citator_tab].present? document_path(search_result.id, opts[:search_params]) end end