Class: Blacklight::Gallery::SlideshowComponent

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

Instance Method Summary collapse

Instance Method Details

#countObject



6
7
8
# File 'app/components/blacklight/gallery/slideshow_component.rb', line 6

def count
  @document.response&.total
end

#presenterObject



14
15
16
# File 'app/components/blacklight/gallery/slideshow_component.rb', line 14

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

#render_document_class(*args) ⇒ Object



10
11
12
# File 'app/components/blacklight/gallery/slideshow_component.rb', line 10

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

#slideshow_image_urlObject



31
32
33
# File 'app/components/blacklight/gallery/slideshow_component.rb', line 31

def slideshow_image_url
  @document.first(view_config.slideshow_field) if @document.has? view_config.slideshow_field
end

#slideshow_tag(image_options = { alt: '' }) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/components/blacklight/gallery/slideshow_component.rb', line 18

def slideshow_tag(image_options = { alt: '' })
  if view_config.slideshow_method
    method_name = view_config.slideshow_method
    @view_context.send(method_name, @document, image_options)
  elsif view_config.slideshow_field
    return if slideshow_image_url.blank?
    image = image_tag slideshow_image_url, image_options
    helpers.link_to_document(@document, image)
  elsif presenter.thumbnail.exists?
    presenter.thumbnail.thumbnail_tag(image_options)
  end
end

#view_configObject



35
36
37
# File 'app/components/blacklight/gallery/slideshow_component.rb', line 35

def view_config
  presenter.thumbnail.view_config
end