Class: Geoblacklight::HeaderIconsComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Geoblacklight::HeaderIconsComponent
- Defined in:
- app/components/geoblacklight/header_icons_component.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Instance Method Summary collapse
- #badge_class(field) ⇒ Object
-
#initialize(document:, fields: [Geoblacklight.configuration.fields.resource_class, Geoblacklight.configuration.fields.access_rights]) ⇒ HeaderIconsComponent
constructor
A new instance of HeaderIconsComponent.
- #render_badge(field) ⇒ Object
Constructor Details
#initialize(document:, fields: [Geoblacklight.configuration.fields.resource_class, Geoblacklight.configuration.fields.access_rights]) ⇒ HeaderIconsComponent
Returns a new instance of HeaderIconsComponent.
7 8 9 10 11 12 13 |
# File 'app/components/geoblacklight/header_icons_component.rb', line 7 def initialize(document:, fields: [Geoblacklight.configuration.fields.resource_class, Geoblacklight.configuration.fields.access_rights]) @document = document @fields = fields super() end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
5 6 7 |
# File 'app/components/geoblacklight/header_icons_component.rb', line 5 def document @document end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
5 6 7 |
# File 'app/components/geoblacklight/header_icons_component.rb', line 5 def fields @fields end |
Instance Method Details
#badge_class(field) ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/components/geoblacklight/header_icons_component.rb', line 19 def badge_class(field) if field == Geoblacklight.configuration.fields.resource_class Geoblacklight::ResourceHeaderBadgeComponent else Geoblacklight::HeaderBadgeComponent end end |
#render_badge(field) ⇒ Object
15 16 17 |
# File 'app/components/geoblacklight/header_icons_component.rb', line 15 def render_badge(field) render badge_class(field).new(document: @document, field:) end |