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:, 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
Constructor Details
#initialize(field:, label_class: 'col-md-3', value_class: 'col-md-9') ⇒ MetadataFieldLayoutComponent
Returns a new instance of MetadataFieldLayoutComponent.
18 19 20 21 22 23 |
# File 'app/components/blacklight/metadata_field_layout_component.rb', line 18 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 |
Instance Method Details
#value(*args, **kwargs, &block) ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/components/blacklight/metadata_field_layout_component.rb', line 25 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
33 34 35 36 37 38 39 |
# File 'app/components/blacklight/metadata_field_layout_component.rb', line 33 def with(slot_name, *args, **kwargs, &block) if slot_name == :value super(:values, *args, **kwargs, &block) else super end end |