diff --git a/app/components/citation_index_table_component.rb b/app/components/citation_index_table_component.rb
new file mode 100644
index 0000000..5bd50aa
--- /dev/null
+++ b/app/components/citation_index_table_component.rb
@@ -0,0 +1,23 @@
+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
+end
diff --git a/app/components/citation_index_table_component/citation_index_table_component.html.erb b/app/components/citation_index_table_component/citation_index_table_component.html.erb
new file mode 100644
index 0000000..6323a95
--- /dev/null
+++ b/app/components/citation_index_table_component/citation_index_table_component.html.erb
@@ -0,0 +1,5 @@
+
+ | <%= clean_reference_number %> |
+ <%= short_title || title %> |
+ <%= date_or_year %> |
+
diff --git a/app/components/document_index_table_component.rb b/app/components/document_index_table_component.rb
index 8138862..fd379fd 100644
--- a/app/components/document_index_table_component.rb
+++ b/app/components/document_index_table_component.rb
@@ -7,6 +7,7 @@ class DocumentIndexTableComponent < BaseComponent
@opts = opts
end
+ delegate :id, to: :search_result
delegate :clean_reference_number, to: :search_result
delegate :title, to: :search_result
delegate :short_title, to: :search_result
@@ -20,9 +21,4 @@ class DocumentIndexTableComponent < BaseComponent
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
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
index 88bc448..3a7b013 100644
--- 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
@@ -1,4 +1,4 @@
-
+
| <%= clean_reference_number %> |
<%= short_title || title %> |
<%= date_or_year %> |
diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb
index a6467c5..3eeac0b 100644
--- a/app/views/documents/show.html.erb
+++ b/app/views/documents/show.html.erb
@@ -11,9 +11,7 @@
- <% if params[:is_document_view].blank? && params[:is_citator_tab].blank? %>
-
Back
- <% end %>
+
Back
Date :
@@ -40,7 +38,7 @@
Title :
- <%= @document.short_title %>
+ <%= @document.short_title || @document.title %>
@@ -94,7 +92,7 @@
- <%= render(DocumentIndexTableComponent.with_collection(@cited_in_documents, current_user: current_user, opts: { search_params: params.reject { |k, v| %i[action controller id].include?(k.to_sym) }, is_document_view: false, is_citator_tab: true })) %>
+ <%= render(CitationIndexTableComponent.with_collection(@cited_in_documents, current_user: current_user)) %>