Module: EmailerHelper

Includes:
ApplicationHelper, Umlaut::Helper
Included in:
ExportEmailHelper
Defined in:
app/helpers/emailer_helper.rb

Instance Method Summary collapse

Methods included from Umlaut::Helper

#date_format, #render_locale_dropdown, #render_locale_link, #render_locale_selector, #render_umlaut_permalink, #render_umlaut_permalink_content, #render_umlaut_permalink_toggle, #resolver_link

Methods included from Umlaut::HtmlHeadHelper

#render_meta_refresh, #render_opensearch_link, #render_umlaut_head_content, #umlaut_title_text

Methods included from Umlaut::FooterHelper

#link_to_direct_sfx, #link_to_test_resolve, #link_to_toggle_debug_info, #render_service_credits

Methods included from Umlaut::UrlGeneration

#path_to_image, #path_to_javascript, #path_to_stylesheet, #url_for

Instance Method Details

#brief_citation(request, options = {}) ⇒ Object

returns a plain text short citation



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/helpers/emailer_helper.rb', line 7

def brief_citation(request, options = {})
  options[:include_labels] ||= false
  rv =""
  cite = request.referent.to_citation
  title = truncate(cite[:title].strip, :length => 70,  :separator => ' ')

  rv << (cite[:title_label].strip + ": ")if options[:include_labels] && cite[:title_label]
  rv << title
  rv << "\n"
  if cite[:author]
    rv << "#{t 'umlaut.citation.author_label'}:" if options[:include_labels]
    rv << cite[:author].strip
    rv << "\n"
  end
  if cite[:container_title]
    rv << (cite[:container_label].strip + ": ") if options[:include_labels] && cite[:container_label].present?
    rv << cite[:container_title].strip
    rv << "\n"
  end
  pub = []
  pub << date_format(cite[:date]) unless cite[:date].blank?
  pub << "#{t 'umlaut.citation.volume_abbr' }: " + cite[:volume].strip unless cite[:volume].blank?
  pub << "#{t 'umlaut.citation.issue_abbr'}: " + cite[:issue].strip unless cite[:issue].blank?
  pub << "#{t 'umlaut.citation.page_abbr'} " + cite[:page].strip unless cite[:page].blank?
  if pub.length > 0
    rv << "#{t 'umlaut.citation.published'}: " if options[:include_labels]
    rv << pub.join('  ')
  end
  return rv
end

#citation_identifiers(request, options = {}) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
# File 'app/helpers/emailer_helper.rb', line 38

def citation_identifiers(request, options = {})
  citation = request.referent.to_citation
  str = ""

  str << "#{t 'umlaut.citation.issn'}: #{citation[:issn]}\n" if citation[:issn]
  str << "#{t 'umlaut.citation.isbn'}: #{citation[:isbn]}\n" if citation[:isbn]
  citation[:identifiers].each do |identifier|
    str << "#{identifier}\n"
  end

  return str
end