diff --git a/app/components/document_index_table_component.rb b/app/components/document_index_table_component.rb new file mode 100644 index 0000000..0e7dd2c --- /dev/null +++ b/app/components/document_index_table_component.rb @@ -0,0 +1,17 @@ +class DocumentIndexTableComponent < BaseComponent + with_collection_parameter :search_result + attr_reader :search_result, :opts + + def initialize(search_result:, current_user:) + @search_result = search_result + end + + delegate :reference_number, to: :search_result + delegate :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 +end diff --git a/app/components/document_index_table_component/document_index_table_component.html.erb b/app/components/document_index_table_component/document_index_table_component.html.erb new file mode 100644 index 0000000..8dd4d3e --- /dev/null +++ b/app/components/document_index_table_component/document_index_table_component.html.erb @@ -0,0 +1,6 @@ +