diff --git a/app/components/doctrine_index_component.rb b/app/components/doctrine_index_component.rb
new file mode 100644
index 0000000..60bfc60
--- /dev/null
+++ b/app/components/doctrine_index_component.rb
@@ -0,0 +1,46 @@
+class DoctrineIndexComponent < BaseComponent
+ with_collection_parameter :doctrine
+ attr_reader :doctrine, :opts
+
+ def initialize(doctrine:, current_user:, opts: {})
+ @doctrine = doctrine
+ @opts = opts
+ end
+
+ delegate :id, to: :doctrine
+ delegate :subject_ids, to: :doctrine
+ delegate :content, to: :doctrine
+ delegate :annotations, to: :doctrine
+ delegate :subjects, to: :doctrine
+ delegate :doctrine_jurisprudences, to: :doctrine
+
+ def annotation_form_url
+ doctrine_annotations_path(doctrine_id: id)
+ end
+
+ def subject_names
+ "(No Subjects Provided)"
+ end
+
+ def jurisprudence
+ return nil if doctrine_jurisprudences.blank?
+
+ doctrine_jurisprudences.first.jurisprudence
+ end
+
+ def document_title(annotation)
+ return annotation.document.short_title if annotation.document.short_title.present?
+
+ annotation.document.title
+ end
+
+ def date_or_year(annotation)
+ return annotation.document.docdate.to_date.strftime("%B %d, %Y") if annotation.document.docdate.present?
+
+ annotation.document.year
+ end
+
+ def render?
+ doctrine.present? && doctrine.persisted?
+ end
+end
diff --git a/app/components/doctrine_index_component/doctrine_index_component.html.erb b/app/components/doctrine_index_component/doctrine_index_component.html.erb
new file mode 100644
index 0000000..203832a
--- /dev/null
+++ b/app/components/doctrine_index_component/doctrine_index_component.html.erb
@@ -0,0 +1,45 @@
+
+ <% if opts[:subject_ids].reject(&:blank?).present? %>
+
<%= subjects.where(id: opts[:subject_ids].map(&:to_i)).map(&:lineage_name).join("") %>
+ <% else %>
+
(No Subjects Provided)
+ <% end %>
+
+
+
<%= raw content.html_safe %>
+
+
+ <% document_title = jurisprudence.short_title || jurisprudence.title %>
+ <% date_or_year = jurisprudence.docdate.present? ? jurisprudence.docdate.to_date.strftime("%B %d, %Y") : jurisprudence.year %>
+
<%= [document_title, jurisprudence.reference_number, date_or_year].join(", ") %>
+
+ <% annotations.each do |annotation| %>
+
+ <% annotated_documents_title = [] %>
+ <% annotation.documents.each do |annotated_document| %>
+ <% ad_title = annotated_document.short_title || annotated_document.title %>
+ <% ad_date_or_year = annotated_document.docdate.present? ? annotated_document.docdate.strftime("%B %d, %Y") : annotated_document.year %>
+ <% annotated_documents_title << [" citing #{ad_title}", annotated_document.reference_number, ad_date_or_year].join(", ") %>
+ <% end %>
+
+ <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %>
+ <%= raw [document_title(annotation), annotation.document.reference_number, date_or_year(annotation), annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ') %>
+
+
+ <% if annotation.editor_notes.present? %>
+
+
+ Editors Note:
+
+
+
+ <%= raw annotation.editor_notes %>
+
+
+ <% end %>
+ <% end %>
+
+
+
+
+
diff --git a/app/views/doctrines/search.html.erb b/app/views/doctrines/search.html.erb
index 2ca4a61..54f2a62 100644
--- a/app/views/doctrines/search.html.erb
+++ b/app/views/doctrines/search.html.erb
@@ -3,9 +3,9 @@
- <%= render(DoctrineIndexTableComponent.new(current_user: current_user, search_results: @doctrines)) %>
+ <%= render(DoctrineIndexTableComponent.new(current_user: current_user, search_results: @doctrines, opts: { is_index_table: params[:is_index_table].to_s.eql?("true") })) %>
<% else %>
- <%= render(DocumentDoctrineIndexComponent.with_collection(@doctrines, current_user: current_user, opts: { is_doctrines_index: true, subject_ids: params[:subject_ids] })) %>
+ <%= render(DoctrineIndexComponent.with_collection(@doctrines, current_user: current_user, opts: { subject_ids: params[:subject_ids] })) %>
<% end %>