Sha256: 00521d1f72ed98e06b0c241c253744a57f811522a1f2470d310b39a20c0bef56
Contents?: true
Size: 1.22 KB
Versions: 9
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true module Blacklight module Gallery class SlideshowPreviewComponent < Blacklight::DocumentComponent with_collection_parameter :document def initialize(document:, document_counter: nil, **args) super(document: document, document_counter: document_counter, **args) @document_counter = document_counter || @counter end def before_render populate_thumbnail_slot if thumbnail.blank? super end # populate the thumbnail slot with a value if one wasn't explicitly provided def populate_thumbnail_slot thumbnail_content = presenter.thumbnail.render({ alt: presenter.heading }) if presenter.thumbnail.exists? unless thumbnail_content.present? thumbnail_content = content_tag( :div, t(:missing_image, scope: %i[blacklight_gallery catalog grid_slideshow]), class: 'thumbnail thumbnail-placeholder' ) end thumbnail(thumbnail_content) end def presenter @presenter ||= @view_context.document_presenter(@document) end def render_document_class(*args) @view_context.render_document_class(*args) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems