Class: Blacklight::DocumentMetadataComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Blacklight::DocumentMetadataComponent
- Defined in:
- app/components/blacklight/document_metadata_component.rb
Constant Summary
Constants inherited from Component
Instance Attribute Summary collapse
-
#view_type ⇒ Object
readonly
Returns the value of attribute view_type.
Instance Method Summary collapse
-
#before_render ⇒ Object
rubocop:enable Metrics/ParameterLists.
-
#initialize(fields: [], tag: 'dl', classes: %w[document-metadata dl-invert row],, show: false, view_type: nil, field_layout: nil, **component_args) ⇒ DocumentMetadataComponent
constructor
rubocop:disable Metrics/ParameterLists.
- #render? ⇒ Boolean
Methods inherited from Component
Constructor Details
#initialize(fields: [], tag: 'dl', classes: %w[document-metadata dl-invert row],, show: false, view_type: nil, field_layout: nil, **component_args) ⇒ DocumentMetadataComponent
rubocop:disable Metrics/ParameterLists
12 13 14 15 16 17 18 19 20 |
# File 'app/components/blacklight/document_metadata_component.rb', line 12 def initialize(fields: [], tag: 'dl', classes: %w[document-metadata dl-invert row], show: false, view_type: nil, field_layout: nil, **component_args) @fields = fields @tag = tag @classes = classes @show = show @view_type = view_type @field_layout = field_layout @component_args = component_args end |
Instance Attribute Details
#view_type ⇒ Object (readonly)
Returns the value of attribute view_type.
35 36 37 |
# File 'app/components/blacklight/document_metadata_component.rb', line 35 def view_type @view_type end |
Instance Method Details
#before_render ⇒ Object
rubocop:enable Metrics/ParameterLists
23 24 25 26 27 28 29 |
# File 'app/components/blacklight/document_metadata_component.rb', line 23 def before_render return unless fields @fields.each do |field| with_field(component: field.component, field: field, show: @show, view_type: @view_type, layout: @field_layout) end end |
#render? ⇒ Boolean
31 32 33 |
# File 'app/components/blacklight/document_metadata_component.rb', line 31 def render? fields.present? end |