Module: AttributionsHelper

Defined in:
app/helpers/attributions_helper.rb

Instance Method Summary (collapse)

Instance Method Details



16
17
18
19
20
21
22
23
# File 'app/helpers/attributions_helper.rb', line 16

def attribution_copyright_tag(attribution)
  a = attribution.copyright_year
  b = attribution.attribution_copyright_holders
  return nil unless a or b.any?
  s = '©'
  s << [a, Utilities::Strings.authorship_sentence(b.collect{|c| c.name})].join(' ')
  s.html_safe
end

- (Object) attribution_creators_tag(attribution)



25
26
27
28
29
# File 'app/helpers/attributions_helper.rb', line 25

def attribution_creators_tag(attribution)
  a = attribution.attribution_creators
  return nil unless a.any?
  ('Created by ' + Utilities::Strings.authorship_sentence(a.collect{|b| b.name})).html_safe
end

- (Object) attribution_editors_tag(attribution)



31
32
33
34
35
# File 'app/helpers/attributions_helper.rb', line 31

def attribution_editors_tag(attribution)
  a = attribution.attribution_editors
  return nil unless a.any?
  ('Edited by ' + Utilities::Strings.authorship_sentence(a.collect{|b| b.name})).html_safe
end

- (String (html)?) attribution_list_tag(object)

Returns a ul/li of tags for the object

Returns:

  • (String (html), nil)

    a ul/li of tags for the object



45
46
47
48
49
# File 'app/helpers/attributions_helper.rb', line 45

def attribution_list_tag(object)
  return nil unless object.has_attribution? && object.attribution
  (:h3, 'Attribution') +
    attribution_tag(object.attribution)
end

- (Object) attribution_owners_tag(attribution)



37
38
39
40
41
# File 'app/helpers/attributions_helper.rb', line 37

def attribution_owners_tag(attribution)
  a = attribution.attribution_owners
  return nil unless a.any?
  ('Owned by ' + Utilities::Strings.authorship_sentence(a.collect{|b| b.name})).html_safe
end

- (Object) attribution_tag(attribution)



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/attributions_helper.rb', line 3

def attribution_tag(attribution)
  return nil if attribution.nil?
  a = [
    attribution_copyright_tag(attribution),
    attribution_creators_tag(attribution),
    attribution_editors_tag(attribution),
    attribution_owners_tag(attribution),
    attribution.license,
  ]

  a.compact.join('. ').html_safe
end