Class: Spina::Pages::Breadcrumb

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TagHelper, ActionView::Helpers::UrlHelper, ActiveSupport::Configurable
Defined in:
app/presenters/spina/pages/breadcrumb.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page, context, include_homepage = true) ⇒ Breadcrumb

Returns a new instance of Breadcrumb.



25
26
27
28
29
30
31
32
33
# File 'app/presenters/spina/pages/breadcrumb.rb', line 25

def initialize(page, context, include_homepage = true)
  @current_page = page
  @include_homepage = include_homepage
  @context = context
  @breadcrumb_items = Array.new()
  @homepage = Page.find_by(name: :homepage)

  build_breadcrumb(page) unless @homepage.id == @current_page.id
end

Instance Attribute Details

Returns the value of attribute breadcrumb_items.



22
23
24
# File 'app/presenters/spina/pages/breadcrumb.rb', line 22

def breadcrumb_items
  @breadcrumb_items
end

#contextObject

Returns the value of attribute context.



22
23
24
# File 'app/presenters/spina/pages/breadcrumb.rb', line 22

def context
  @context
end

#current_pageObject

Returns the value of attribute current_page.



22
23
24
# File 'app/presenters/spina/pages/breadcrumb.rb', line 22

def current_page
  @current_page
end

#homepageObject

Returns the value of attribute homepage.



22
23
24
# File 'app/presenters/spina/pages/breadcrumb.rb', line 22

def homepage
  @homepage
end

#include_homepageObject

Returns the value of attribute include_homepage.



22
23
24
# File 'app/presenters/spina/pages/breadcrumb.rb', line 22

def include_homepage
  @include_homepage
end

Instance Method Details

#to_htmlObject



35
36
37
# File 'app/presenters/spina/pages/breadcrumb.rb', line 35

def to_html
  render_breadcrumb_wrapper(@breadcrumb_items)
end