Class: Arclight::CollectionContextComponent

Inherits:
ViewComponent::Base
  • Object
show all
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

Instance Method Summary collapse

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

#collectionObject (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_infoObject



23
24
25
# File 'app/components/arclight/collection_context_component.rb', line 23

def collection_info
  render Arclight::CollectionInfoComponent.new(collection: collection)
end

#document_downloadObject



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

#titleObject



15
16
17
# File 'app/components/arclight/collection_context_component.rb', line 15

def title
  collection.normalized_title
end