Class: Decidim::MenuItem
- Inherits:
-
Object
- Object
- Decidim::MenuItem
- Defined in:
- lib/decidim/menu_item.rb
Overview
This class handles all logic regarding menu items
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Returns the value of attribute active.
-
#icon_name ⇒ Object
readonly
Returns the value of attribute icon_name.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#position ⇒ Object
Returns the value of attribute position.
-
#submenu ⇒ Object
readonly
Returns the value of attribute submenu.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(label, url, identifier, options = {}) ⇒ MenuItem
constructor
Builds a new menu item.
- #visible? ⇒ Boolean
Constructor Details
#initialize(label, url, identifier, options = {}) ⇒ MenuItem
Builds a new menu item
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/decidim/menu_item.rb', line 14 def initialize(label, url, identifier, = {}) @label = label @url = url @identifier = identifier @position = [:position] || Float::INFINITY @if = [:if] @active = [:active] @icon_name = [:icon_name] @submenu = [:submenu] end |
Instance Attribute Details
#active ⇒ Object (readonly)
Returns the value of attribute active.
26 27 28 |
# File 'lib/decidim/menu_item.rb', line 26 def active @active end |
#icon_name ⇒ Object (readonly)
Returns the value of attribute icon_name.
26 27 28 |
# File 'lib/decidim/menu_item.rb', line 26 def icon_name @icon_name end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
26 27 28 |
# File 'lib/decidim/menu_item.rb', line 26 def identifier @identifier end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
26 27 28 |
# File 'lib/decidim/menu_item.rb', line 26 def label @label end |
#position ⇒ Object
Returns the value of attribute position.
25 26 27 |
# File 'lib/decidim/menu_item.rb', line 25 def position @position end |
#submenu ⇒ Object (readonly)
Returns the value of attribute submenu.
26 27 28 |
# File 'lib/decidim/menu_item.rb', line 26 def @submenu end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
26 27 28 |
# File 'lib/decidim/menu_item.rb', line 26 def url @url end |
Instance Method Details
#visible? ⇒ Boolean
28 29 30 31 32 |
# File 'lib/decidim/menu_item.rb', line 28 def visible? return true if @if.nil? || @if false end |