Sha256: 6700c84a12200c509fb999600d43936b6d523b82f88f5ad8ddd1044a5c555d39

Contents?: true

Size: 811 Bytes

Versions: 17

Compression:

Stored size: 811 Bytes

Contents

# frozen_string_literal: true

module Blacklight
  class MetadataFieldLayoutComponent < Blacklight::Component
    with_collection_parameter :field
    renders_one :label
    renders_many :values, (lambda do |value: nil, &block|
      if @value_tag.nil?
        block&.call || value
      elsif block
        content_tag @value_tag, class: "#{@value_class} blacklight-#{@key}", &block
      else
        content_tag @value_tag, value, class: "#{@value_class} blacklight-#{@key}"
      end
    end)

    # @param field [Blacklight::FieldPresenter]
    def initialize(field:, value_tag: 'dd', label_class: 'col-md-3', value_class: 'col-md-9')
      @field = field
      @key = @field.key.parameterize
      @label_class = label_class
      @value_tag = value_tag
      @value_class = value_class
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

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