Class: Blacklight::Gallery::SlideshowPreviewComponent

Inherits:
DocumentComponent
  • Object
show all
Defined in:
app/components/blacklight/gallery/slideshow_preview_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(document:, document_counter: nil, **args) ⇒ SlideshowPreviewComponent

Returns a new instance of SlideshowPreviewComponent.



8
9
10
11
# File 'app/components/blacklight/gallery/slideshow_preview_component.rb', line 8

def initialize(document:, document_counter: nil, **args)
  super(document: document, document_counter: document_counter, **args)
  @document_counter = document_counter || @counter
end

Instance Method Details

#presenterObject



19
20
21
# File 'app/components/blacklight/gallery/slideshow_preview_component.rb', line 19

def presenter
  @presenter ||= @view_context.document_presenter(@document)
end

#render_document_class(*args) ⇒ Object



23
24
25
# File 'app/components/blacklight/gallery/slideshow_preview_component.rb', line 23

def render_document_class(*args)
  @view_context.render_document_class(*args)
end

#thumbnailObject



13
14
15
16
17
# File 'app/components/blacklight/gallery/slideshow_preview_component.rb', line 13

def thumbnail
  @thumbnail ||
    (presenter.thumbnail.exists? && presenter.thumbnail.render({ alt: presenter.heading })) ||
    (:div, t('.missing_image', scope: [:blacklight_gallery]), class: 'thumbnail thumbnail-placeholder')
end