Class: Decidim::MenuPresenter
- Inherits:
-
Object
- Object
- Decidim::MenuPresenter
- Defined in:
- app/presenters/decidim/menu_presenter.rb
Overview
A presenter to render menus
Direct Known Subclasses
BreadcrumbRootMenuPresenter, FooterMenuPresenter, InlineMenuPresenter
Instance Method Summary collapse
- #active_item ⇒ Object
- #evaluated_menu ⇒ Object
-
#initialize(name, view, options = {}) ⇒ MenuPresenter
constructor
Initializes a menu for presentation.
- #render ⇒ Object
Constructor Details
#initialize(name, view, options = {}) ⇒ MenuPresenter
Initializes a menu for presentation
13 14 15 16 17 |
# File 'app/presenters/decidim/menu_presenter.rb', line 13 def initialize(name, view, = {}) @name = name @view = view @options = end |
Instance Method Details
#active_item ⇒ Object
30 31 32 |
# File 'app/presenters/decidim/menu_presenter.rb', line 30 def active_item presented_items.find(&:active?) end |
#evaluated_menu ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/presenters/decidim/menu_presenter.rb', line 22 def @evaluated_menu ||= begin = Menu.new(@name) .build_for(@view) end end |
#render ⇒ Object
34 35 36 37 38 |
# File 'app/presenters/decidim/menu_presenter.rb', line 34 def render content_tag :nav, class: "main-nav", "aria-label": @options.fetch(:label, nil) do end end |