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
Constant Summary
Constants inherited from Component
Instance Method Summary collapse
-
#initialize(counter:, presenter: nil, document: nil, image_options: {}) ⇒ ThumbnailComponent
constructor
A new instance of ThumbnailComponent.
- #presenter ⇒ Object
- #render? ⇒ Boolean
Methods inherited from Component
Constructor Details
#initialize(counter:, presenter: nil, document: nil, image_options: {}) ⇒ ThumbnailComponent
Returns a new instance of ThumbnailComponent.
12 13 14 15 16 17 |
# File 'app/components/blacklight/document/thumbnail_component.rb', line 12 def initialize(counter:, presenter: nil, document: nil, image_options: {}) @presenter = presenter @document = presenter&.document || document @counter = counter @image_options = { alt: '' }.merge() end |
Instance Method Details
#presenter ⇒ Object
23 24 25 |
# File 'app/components/blacklight/document/thumbnail_component.rb', line 23 def presenter @presenter ||= helpers.document_presenter(@document) end |
#render? ⇒ Boolean
19 20 21 |
# File 'app/components/blacklight/document/thumbnail_component.rb', line 19 def render? presenter.thumbnail.exists? end |