Sha256: b28400f73f0504e2d836e9e9cbfe75448766bc551662d983693c697074b20b3c

Contents?: true

Size: 1.05 KB

Versions: 17

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Blacklight
  class DocumentMetadataComponent < Blacklight::Component
    renders_many :fields, (lambda do |component: nil, **kwargs|
      component.new(**kwargs)
    end)
    with_collection_parameter :fields

    # @param fields [Enumerable<Blacklight::FieldPresenter>] Document field presenters
    # rubocop:disable Metrics/ParameterLists
    def initialize(fields: [], tag: 'dl', classes: %w[document-metadata dl-invert row], show: false, view_type: nil, field_layout: nil, **component_args)
      @fields = fields
      @tag = tag
      @classes = classes
      @show = show
      @view_type = view_type
      @field_layout = field_layout
      @component_args = component_args
    end
    # rubocop:enable Metrics/ParameterLists

    def before_render
      return unless fields

      @fields.each do |field|
        with_field(component: field.component, field: field, show: @show, view_type: @view_type, layout: @field_layout)
      end
    end

    def render?
      fields.present?
    end

    attr_reader :view_type
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
blacklight-8.6.1 app/components/blacklight/document_metadata_component.rb
blacklight-8.6.0 app/components/blacklight/document_metadata_component.rb
blacklight-8.5.1 app/components/blacklight/document_metadata_component.rb
blacklight-8.5.0 app/components/blacklight/document_metadata_component.rb
blacklight-8.4.0 app/components/blacklight/document_metadata_component.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/app/components/blacklight/document_metadata_component.rb
blacklight-8.3.0 app/components/blacklight/document_metadata_component.rb
blacklight-8.2.2 app/components/blacklight/document_metadata_component.rb
blacklight-8.2.1 app/components/blacklight/document_metadata_component.rb
blacklight-8.2.0 app/components/blacklight/document_metadata_component.rb
blacklight-8.1.0 app/components/blacklight/document_metadata_component.rb
blacklight-8.0.1 app/components/blacklight/document_metadata_component.rb
blacklight-8.0.0 app/components/blacklight/document_metadata_component.rb
blacklight-8.0.0.beta8 app/components/blacklight/document_metadata_component.rb
blacklight-8.0.0.beta7 app/components/blacklight/document_metadata_component.rb
blacklight-8.0.0.beta6 app/components/blacklight/document_metadata_component.rb
blacklight-8.0.0.beta5 app/components/blacklight/document_metadata_component.rb