Sha256: 37be814d29fa06117d2fb2dc39176de9fb9e5569e511b4cf722ffdb31a6ac8fc
Contents?: true
Size: 992 Bytes
Versions: 3
Compression:
Stored size: 992 Bytes
Contents
# mixin to provide URL for IIIF Content Search service module NewspaperWorks module IiifManifestPresenterBehavior extend ActiveSupport::Concern def search_service Rails.application.routes.url_helpers.solr_document_iiif_search_url(id, host: request.base_url) end # based on Hyrax::WorkShowPresenter#manifest_metadata # expects that individual presenters define #iiif_metadata_fields def manifest_metadata fields = iiif_metadata_fields || [] metadata = [] fields.each do |field| label = Hyrax::Renderers::AttributeRenderer.new(field, nil).label value = send(field) next if value.blank? value = Array.wrap(value) if value.is_a?(String) metadata << { 'label' => label, 'value' => Array.wrap(value.map { |f| Loofah.fragment(f.to_s).scrub!(:whitewash).to_s }) } end metadata end end end
Version data entries
3 entries across 3 versions & 1 rubygems