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
-
#initialize(fields: [], show: false, view_type: nil) ⇒ DocumentMetadataComponent
constructor
A new instance of DocumentMetadataComponent.
- #render? ⇒ Boolean
Methods inherited from Component
Constructor Details
#initialize(fields: [], show: false, view_type: nil) ⇒ DocumentMetadataComponent
Returns a new instance of DocumentMetadataComponent.
11 12 13 14 15 |
# File 'app/components/blacklight/document_metadata_component.rb', line 11 def initialize(fields: [], show: false, view_type: nil) @fields = fields @show = show @view_type = view_type end |
Instance Attribute Details
#view_type ⇒ Object (readonly)
Returns the value of attribute view_type.
29 30 31 |
# File 'app/components/blacklight/document_metadata_component.rb', line 29 def view_type @view_type end |
Instance Method Details
#before_render ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/components/blacklight/document_metadata_component.rb', line 17 def before_render return unless fields @fields.each do |field| field(component: field.component, field: field, show: @show, view_type: @view_type) end end |
#render? ⇒ Boolean
25 26 27 |
# File 'app/components/blacklight/document_metadata_component.rb', line 25 def render? fields.present? end |