Sha256: 577422fa4c30cad16ab3fe19b82948bb049bbecd0376c14feb3f412e245faced
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true module Blacklight module Document # Render the thumbnail for the document class ThumbnailComponent < ::ViewComponent::Base 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(presenter: nil, document: nil, counter:, image_options: {}) @presenter = presenter @document = presenter&.document || document @counter = counter @image_options = { alt: '' }.merge(image_options) end def render? presenter.thumbnail.exists? end def use_thumbnail_tag_behavior? !presenter.thumbnail.instance_of?(Blacklight::ThumbnailPresenter) end def warn_about_deprecated_behavior Deprecation.warn(Blacklight::Document::ThumbnailComponent, 'Detected as custom thumbnail presenter; make sure it has a #render method that returns just the thumbnail image tag') end def presenter @presenter ||= helpers.document_presenter(@document) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems