Class: Blacklight::MetadataFieldLayoutComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Blacklight::MetadataFieldLayoutComponent
- Includes:
- ContentAreasShim
- Defined in:
- app/components/blacklight/metadata_field_layout_component.rb
Instance Method Summary collapse
-
#initialize(field:, value_tag: 'dd', label_class: 'col-md-3', value_class: 'col-md-9') ⇒ MetadataFieldLayoutComponent
constructor
A new instance of MetadataFieldLayoutComponent.
- #value(*args, **kwargs, &block) ⇒ Object
- #with(slot_name, *args, **kwargs, &block) ⇒ Object
Methods inherited from Component
reset_compiler!, sidecar_files, upstream_sidecar_files
Constructor Details
#initialize(field:, value_tag: 'dd', label_class: 'col-md-3', value_class: 'col-md-9') ⇒ MetadataFieldLayoutComponent
Returns a new instance of MetadataFieldLayoutComponent.
20 21 22 23 24 25 26 |
# File 'app/components/blacklight/metadata_field_layout_component.rb', line 20 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 |
Instance Method Details
#value(*args, **kwargs, &block) ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/components/blacklight/metadata_field_layout_component.rb', line 28 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 |
#with(slot_name, *args, **kwargs, &block) ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/components/blacklight/metadata_field_layout_component.rb', line 36 def with(slot_name, *args, **kwargs, &block) if slot_name == :value super(:values, *args, **kwargs, &block) else super end end |