Class: Arclight::CollectionContextComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Arclight::CollectionContextComponent
- Defined in:
- app/components/arclight/collection_context_component.rb
Overview
Render various actions for a collection (e.g. requesting, download links, etc)
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
Instance Method Summary collapse
- #collection_info ⇒ Object
- #document_download ⇒ Object
-
#initialize(presenter:, download_component:) ⇒ CollectionContextComponent
constructor
A new instance of CollectionContextComponent.
- #title ⇒ Object
Constructor Details
#initialize(presenter:, download_component:) ⇒ CollectionContextComponent
Returns a new instance of CollectionContextComponent.
6 7 8 9 10 11 |
# File 'app/components/arclight/collection_context_component.rb', line 6 def initialize(presenter:, download_component:) super @collection = presenter.document.collection @download_component = download_component end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
13 14 15 |
# File 'app/components/arclight/collection_context_component.rb', line 13 def collection @collection end |
Instance Method Details
#collection_info ⇒ Object
23 24 25 |
# File 'app/components/arclight/collection_context_component.rb', line 23 def collection_info render Arclight::CollectionInfoComponent.new(collection: collection) end |
#document_download ⇒ Object
19 20 21 |
# File 'app/components/arclight/collection_context_component.rb', line 19 def document_download render @download_component.new(downloads: collection.downloads) || Arclight::DocumentDownloadComponent.new(downloads: collection.downloads) end |
#title ⇒ Object
15 16 17 |
# File 'app/components/arclight/collection_context_component.rb', line 15 def title collection.normalized_title end |