Class: Refinery::Pages::MenuPresenter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collection, context) ⇒ MenuPresenter

Returns a new instance of MenuPresenter.



34
35
36
37
# File 'app/presenters/refinery/pages/menu_presenter.rb', line 34

def initialize(collection, context)
  @collection = collection
  @context = context
end

Instance Attribute Details

#collectionObject

Returns the value of attribute collection.



31
32
33
# File 'app/presenters/refinery/pages/menu_presenter.rb', line 31

def collection
  @collection
end

#contextObject

Returns the value of attribute context.



31
32
33
# File 'app/presenters/refinery/pages/menu_presenter.rb', line 31

def context
  @context
end

Instance Method Details

#rootsObject



27
28
29
# File 'app/presenters/refinery/pages/menu_presenter.rb', line 27

def roots
  config.roots.presence || collection.roots
end

#to_htmlObject



39
40
41
# File 'app/presenters/refinery/pages/menu_presenter.rb', line 39

def to_html
  render_menu(roots) if roots.present?
end