Class: Blacklight::Document::ThumbnailComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Blacklight::Document::ThumbnailComponent
- Defined in:
- app/components/blacklight/document/thumbnail_component.rb
Overview
Render the thumbnail for the document
Instance Attribute Summary collapse
-
#presenter ⇒ Object
Returns the value of attribute presenter.
Instance Method Summary collapse
-
#initialize(counter:, presenter: nil, image_options: {}) ⇒ ThumbnailComponent
constructor
A new instance of ThumbnailComponent.
- #render? ⇒ Boolean
- #thumbnail_value ⇒ Object
Methods inherited from Component
reset_compiler!, sidecar_files, upstream_sidecar_files
Constructor Details
#initialize(counter:, presenter: nil, image_options: {}) ⇒ ThumbnailComponent
Returns a new instance of ThumbnailComponent.
12 13 14 15 16 |
# File 'app/components/blacklight/document/thumbnail_component.rb', line 12 def initialize(counter:, presenter: nil, image_options: {}) @presenter = presenter @counter = counter @image_options = { alt: '' }.merge() end |
Instance Attribute Details
#presenter ⇒ Object
Returns the value of attribute presenter.
18 19 20 |
# File 'app/components/blacklight/document/thumbnail_component.rb', line 18 def presenter @presenter end |
Instance Method Details
#render? ⇒ Boolean
24 25 26 |
# File 'app/components/blacklight/document/thumbnail_component.rb', line 24 def render? presenter.thumbnail && thumbnail_value end |
#thumbnail_value ⇒ Object
20 21 22 |
# File 'app/components/blacklight/document/thumbnail_component.rb', line 20 def thumbnail_value @thumbnail_value ||= presenter.thumbnail.render(@image_options) end |