Module: CitationTopicsHelper

Defined in:
app/helpers/citation_topics_helper.rb

Instance Method Summary collapse

Instance Method Details

#citation_topic_tag(citation_topic) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/citation_topics_helper.rb', line 3

def citation_topic_tag(citation_topic)
    

  return nil if citation_topic.nil?
  citation = citation_topic.citation
  citation_string = (
    (citation.source.type == 'Source::Bibtex' && citation.source.try(:author_year)) ? 
    citation.source.author_year : 
    (:span, 'author, year not yet provided for source', class: :subtle) 
  )

  str = [citation_topic.topic.name, ': ', object_tag(citation.citation_object.metamorphosize).html_safe, ' in ', citation_string].join
  str = str + ": #{citation.pages}." if !citation.pages.blank?
  str.html_safe

end