Sha256: 586c7a20d372c2c4b57c96fca983cf3b4c787895a610e88710ce0886c3d3c472
Contents?: true
Size: 803 Bytes
Versions: 19
Compression:
Stored size: 803 Bytes
Contents
# frozen_string_literal: true module Blacklight class DocumentMetadataComponent < ::ViewComponent::Base renders_many :fields, (lambda do |component: nil, **kwargs| (component || Blacklight::MetadataFieldComponent).new(**kwargs) end) with_collection_parameter :fields # @param fields [Enumerable<Blacklight::FieldPresenter>] Document field presenters def initialize(fields: [], show: false) @fields = fields @show = show end def before_render return unless fields @fields.each do |field| field(component: field_component(field), field: field, show: @show) end end def render? fields.present? end def field_component(field) field&.component || Blacklight::MetadataFieldComponent end end end
Version data entries
19 entries across 19 versions & 1 rubygems