Class: Geoblacklight::HeaderBadgeComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/geoblacklight/header_badge_component.rb

Direct Known Subclasses

ResourceHeaderBadgeComponent

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document:, field:) ⇒ HeaderBadgeComponent

Returns a new instance of HeaderBadgeComponent.



7
8
9
10
11
# File 'app/components/geoblacklight/header_badge_component.rb', line 7

def initialize(document:, field:)
  @document = document
  @field = field
  super()
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



5
6
7
# File 'app/components/geoblacklight/header_badge_component.rb', line 5

def document
  @document
end

#fieldObject (readonly)

Returns the value of attribute field.



5
6
7
# File 'app/components/geoblacklight/header_badge_component.rb', line 5

def field
  @field
end

Instance Method Details

#icon(field) ⇒ Object



17
18
19
# File 'app/components/geoblacklight/header_badge_component.rb', line 17

def icon(field)
  helpers.geoblacklight_icon(label)
end

#labelObject



13
14
15
# File 'app/components/geoblacklight/header_badge_component.rb', line 13

def label
  @document[field]
end