diff --git a/app/components/doctrine_index_component.rb b/app/components/doctrine_index_component.rb index b466d8f..b8b9908 100644 --- a/app/components/doctrine_index_component.rb +++ b/app/components/doctrine_index_component.rb @@ -47,6 +47,12 @@ class DoctrineIndexComponent < BaseComponent doctrine_path(id, is_index_table: false, subject_ids: opts[:subject_ids].reject(&:blank?)) end + def clean_phil_rep(annotation) + return if annotation.phil_rep.blank? + + annotation.phil_rep.gsub(/(PhilRep|Phil)\.?,?/i, "Phil") + end + def render? doctrine.present? && doctrine.persisted? 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 index a6a0794..fcf0e04 100644 --- a/app/components/doctrine_index_component/doctrine_index_component.html.erb +++ b/app/components/doctrine_index_component/doctrine_index_component.html.erb @@ -18,7 +18,7 @@ <% end %> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> - <%= raw annotation.content.present? ? annotation.content : [document_title(annotation), annotation.document.reference_number, date_or_year(annotation), annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ') %> + <%= raw annotation.content.present? ? annotation.content : [document_title(annotation), annotation.document.reference_number, date_or_year(annotation), clean_phil_rep(annotation), annotated_documents_title].reject(&:blank?).join(', ') %>
<% if annotation.editor_notes.present? %> diff --git a/app/components/document_doctrine_index_component.rb b/app/components/document_doctrine_index_component.rb index 879a29a..e075d40 100644 --- a/app/components/document_doctrine_index_component.rb +++ b/app/components/document_doctrine_index_component.rb @@ -41,6 +41,12 @@ class DocumentDoctrineIndexComponent < BaseComponent annotation.document.year end + def clean_phil_rep(annotation) + return if annotation.phil_rep.blank? + + annotation.phil_rep.gsub(/(PhilRep|Phil)\.?,?/i, "Phil") + end + def render? doctrine.present? && doctrine.persisted? end diff --git a/app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb b/app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb index ba7e5a7..6888568 100644 --- a/app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb +++ b/app/components/document_doctrine_index_component/document_doctrine_index_component.html.erb @@ -35,7 +35,7 @@ <% end %> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> - <%= raw annotation.content.present? ? annotation.content : [document_title(annotation), annotation.document.reference_number, date_or_year(annotation), annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ') %> + <%= raw annotation.content.present? ? annotation.content : [document_title(annotation), annotation.document.reference_number, date_or_year(annotation), clean_phil_rep(annotation), annotated_documents_title].reject(&:blank?).join(', ') %> <% if annotation.editor_notes.present? %> diff --git a/app/components/document_doctrine_show_component.rb b/app/components/document_doctrine_show_component.rb index 9808d52..82099e2 100644 --- a/app/components/document_doctrine_show_component.rb +++ b/app/components/document_doctrine_show_component.rb @@ -35,4 +35,10 @@ class DocumentDoctrineShowComponent < BaseComponent annotation.document.year end + + def clean_phil_rep(annotation) + return if annotation.phil_rep.blank? + + annotation.phil_rep.gsub(/(PhilRep|Phil)\.?,?/i, "Phil") + end end \ No newline at end of file diff --git a/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb b/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb index 0a8c293..c9657f8 100644 --- a/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb +++ b/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb @@ -94,7 +94,7 @@ <% 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 %> - <% citing_document_title = [document_title, annotation.document.reference_number, date_or_year, annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ').html_safe %> + <% citing_document_title = [document_title, annotation.document.reference_number, date_or_year, clean_phil_rep(annotation), annotated_documents_title].reject(&:blank?).join(', ').html_safe %>