Sha256: 284fc14d27a54e7f130af95322667407ed18989b69cf047bfb280661e0a5f49d
Contents?: true
Size: 1.17 KB
Versions: 15
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true module Blacklight class MetadataFieldLayoutComponent < Blacklight::Component include Blacklight::ContentAreasShim with_collection_parameter :field renders_one :label renders_many :values, (lambda do |value: nil, &block| if block content_tag :dd, class: "#{@value_class} blacklight-#{@key}", &block else content_tag :dd, value, class: "#{@value_class} blacklight-#{@key}" end end) # @param field [Blacklight::FieldPresenter] def initialize(field:, label_class: 'col-md-3', value_class: 'col-md-9') @field = field @key = @field.key.parameterize @label_class = label_class @value_class = value_class end def value(*args, **kwargs, &block) return set_slot(:values, nil, *args, **kwargs, &block) if block_given? Deprecation.warn(Blacklight::MetadataFieldLayoutComponent, 'The `value` content area is deprecated; render from the values slot instead') values.first end def with(slot_name, *args, **kwargs, &block) if slot_name == :value super(:values, *args, **kwargs, &block) else super end end end end
Version data entries
15 entries across 15 versions & 1 rubygems