Class: Blacklight::MetadataFieldLayoutComponent
Constant Summary
Constants inherited
from Component
Component::EXCLUDE_VARIABLES
Instance Method Summary
collapse
Methods inherited from Component
compiler, config, #inspect
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
|