Class: Blacklight::Document::CitationComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Blacklight::Document::CitationComponent
- Defined in:
- app/components/blacklight/document/citation_component.rb
Overview
Render citations for the document
Constant Summary collapse
- DEFAULT_FORMATS =
{ 'blacklight.citation.mla': :export_as_mla_citation_txt, 'blacklight.citation.apa': :export_as_apa_citation_txt, 'blacklight.citation.chicago': :export_as_chicago_citation_txt }.freeze
Constants inherited from Component
Instance Method Summary collapse
-
#initialize(document:, formats: DEFAULT_FORMATS) ⇒ CitationComponent
constructor
A new instance of CitationComponent.
- #presenter ⇒ Object
- #title ⇒ String
Methods inherited from Component
Constructor Details
#initialize(document:, formats: DEFAULT_FORMATS) ⇒ CitationComponent
Returns a new instance of CitationComponent.
18 19 20 21 |
# File 'app/components/blacklight/document/citation_component.rb', line 18 def initialize(document:, formats: DEFAULT_FORMATS) @document = document @formats = formats.select { |_k, v| @document.respond_to?(v) } end |
Instance Method Details
#presenter ⇒ Object
28 29 30 |
# File 'app/components/blacklight/document/citation_component.rb', line 28 def presenter helpers.document_presenter(@document) end |
#title ⇒ String
24 25 26 |
# File 'app/components/blacklight/document/citation_component.rb', line 24 def title presenter.heading end |