Module: AttributionsHelper
- Defined in:
- app/helpers/attributions_helper.rb
Instance Method Summary collapse
- #attribution_copyright_tag(attribution) ⇒ Object
- #attribution_creators_tag(attribution) ⇒ Object
- #attribution_editors_tag(attribution) ⇒ Object
-
#attribution_list_tag(object) ⇒ String (html)?
A ul/li of tags for the object.
- #attribution_owners_tag(attribution) ⇒ Object
- #attribution_tag(attribution) ⇒ Object
Instance Method Details
#attribution_copyright_tag(attribution) ⇒ Object
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.(b.collect{|c| c.name})].join(' ') s.html_safe end |
#attribution_creators_tag(attribution) ⇒ Object
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.(a.collect{|b| b.name})).html_safe end |
#attribution_editors_tag(attribution) ⇒ Object
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.(a.collect{|b| b.name})).html_safe end |
#attribution_list_tag(object) ⇒ String (html)?
Returns 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 content_tag(:h3, 'Attribution') + attribution_tag(object.attribution) end |
#attribution_owners_tag(attribution) ⇒ Object
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.(a.collect{|b| b.name})).html_safe end |
#attribution_tag(attribution) ⇒ Object
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 |