diff --git a/app/models/citation.rb b/app/models/citation.rb index 0f7e3a19..dec78f1c 100644 --- a/app/models/citation.rb +++ b/app/models/citation.rb @@ -365,6 +365,26 @@ def ld_json } end + def author_and_year(options = {}) + return pub_year_with_punctuation.to_s if authors.empty? + + if options[:long] + author_and_pub_year_string(author_string) + else + author_and_pub_year_string(short_author_string) + end + end + + def volume_and_page + if volume.blank? + doi_citation_part(doi) + elsif page_numbers.blank? + "#{volume}." + else + "#{volume}:#{page_numbers}." + end + end + private def bibtex_type @@ -383,16 +403,6 @@ def endnote_publication_data end end - def volume_and_page - if volume.blank? - doi_citation_part(doi) - elsif page_numbers.blank? - "#{volume}." - else - "#{volume}:#{page_numbers}." - end - end - def doi_citation_part(doi) if doi.blank? '' @@ -479,16 +489,6 @@ def pub_year_with_punctuation pub_year ? "#{pub_year}." : '' end - def author_and_year(options = {}) - return pub_year_with_punctuation.to_s if authors.empty? - - if options[:long] - author_and_pub_year_string(author_string) - else - author_and_pub_year_string(short_author_string) - end - end - def author_and_pub_year_string(author_string) "#{author_string} #{pub_year_with_punctuation}".rstrip end diff --git a/app/models/treatment.rb b/app/models/treatment.rb index 02fdfe19..7597b294 100644 --- a/app/models/treatment.rb +++ b/app/models/treatment.rb @@ -31,4 +31,8 @@ def has_citations? end false end + + def display_name + self.parent ? "#{self.parent.description} > #{self.name} #{self.description}" : "#{self.name} #{self.description}" + end end diff --git a/app/views/citations/_citation.html.erb b/app/views/citations/_citation.html.erb index 750af118..0180a608 100644 --- a/app/views/citations/_citation.html.erb +++ b/app/views/citations/_citation.html.erb @@ -15,7 +15,7 @@ <% end %> <% cache(citation, action: 'index') do %>
-

<%=citation.formatted(long: true) %> +

<%=citation.author_and_year(long: true) %><%= citation.title %>. <%= citation.publication %> <%= citation.volume_and_page %>, <% if citation.doi.present? %> DOI: <%= link_to citation.doi, normalize_doi(citation.doi) %> <% end %>