Class: Spotlight::BreadcrumbsComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/spotlight/breadcrumbs_component.rb

Overview

Component to render breadcrumbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(breadcrumbs: []) ⇒ BreadcrumbsComponent

Returns a new instance of BreadcrumbsComponent.



8
9
10
11
# File 'app/components/spotlight/breadcrumbs_component.rb', line 8

def initialize(breadcrumbs: [])
  @breadcrumbs = breadcrumbs
  super
end

Instance Attribute Details

Returns the value of attribute breadcrumbs.



6
7
8
# File 'app/components/spotlight/breadcrumbs_component.rb', line 6

def breadcrumbs
  @breadcrumbs
end

Instance Method Details

#path(path) ⇒ Object



17
18
19
# File 'app/components/spotlight/breadcrumbs_component.rb', line 17

def path(path)
  helpers.url_for(path)
end

#render?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/components/spotlight/breadcrumbs_component.rb', line 13

def render?
  !helpers.resource_masthead? && breadcrumbs.present?
end