Sha256: ef08b195b0755e3fe739add375d340b6fbd8fa92a5ff640bb618047720738b15

Contents?: true

Size: 741 Bytes

Versions: 1

Compression:

Stored size: 741 Bytes

Contents

# frozen_string_literal: true

module IiifPrint
  module WorkShowPresenterDecorator
    delegate :file_set_ids, to: :solr_document

    # OVERRIDE Hyrax 2.9.6 to remove check for representative_presenter.image? and allow
    # a fallback to check for images on the child works
    # @return [Boolean] render a IIIF viewer
    def iiif_viewer?
      parent_work_has_files? || child_work_has_files?
    end

    alias universal_viewer? iiif_viewer?

    private

    def parent_work_has_files?
      Hyrax.config.iiif_image_server? &&
        representative_id.present? &&
        representative_presenter.present? &&
        members_include_viewable_image?
    end

    def child_work_has_files?
      file_set_ids.present?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iiif_print-1.0.0 app/presenters/iiif_print/work_show_presenter_decorator.rb