Sha256: 9d17d23cc6acad245753ac0f376deb7f9f4941bb8699a37f57673be548881751

Contents?: true

Size: 816 Bytes

Versions: 21

Compression:

Stored size: 816 Bytes

Contents

# frozen_string_literal: true

module Blacklight
  module Document
    # Render the thumbnail for the document
    class ThumbnailComponent < Blacklight::Component
      with_collection_parameter :presenter

      # @param [Blacklight::DocumentPresenter] presenter
      # @param [Integer] counter
      # @param [Hash] image_options options for the thumbnail presenter's image tag
      def initialize(counter:, presenter: nil, document: nil, image_options: {})
        @presenter = presenter
        @document = presenter&.document || document
        @counter = counter
        @image_options = { alt: '' }.merge(image_options)
      end

      def render?
        presenter.thumbnail.exists?
      end

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

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
blacklight-8.6.1 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.6.0 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.5.1 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.5.0 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.4.0 app/components/blacklight/document/thumbnail_component.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/app/components/blacklight/document/thumbnail_component.rb
blacklight-8.3.0 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.2.2 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.2.1 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.2.0 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.1.0 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.0.1 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.0.0 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.0.0.beta8 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.0.0.beta7 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.0.0.beta6 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.0.0.beta5 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.0.0.beta4 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.0.0.beta3 app/components/blacklight/document/thumbnail_component.rb
blacklight-8.0.0.beta2 app/components/blacklight/document/thumbnail_component.rb