class DocumentIndexTableBodyComponent < 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 def reference_number search_result["reference_number"] end def title search_result["title"] end def date_or_year return search_result["docdate"].to_date.strftime("%m/%d/%Y") if search_result["docdate"].present? search_result["year"] end def form_url doctrine_annotations_path(doctrine_id: opts[:doctrine_id]) end def render? search_result.present? end end