Class: Panda::Core::NavigationRegistry::SectionContext
- Inherits:
-
Object
- Object
- Panda::Core::NavigationRegistry::SectionContext
- Defined in:
- lib/panda/core/navigation_registry.rb
Overview
Collects items added inside a section block.
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
-
#initialize ⇒ SectionContext
constructor
A new instance of SectionContext.
-
#item(label, path: nil, url: nil, target: nil, visible: nil, permission: nil, method: nil, button_options: {}, path_helper: nil, badge: nil, badge_color: nil) ⇒ Object
Register an item within this section.
Constructor Details
#initialize ⇒ SectionContext
Returns a new instance of SectionContext.
94 95 96 |
# File 'lib/panda/core/navigation_registry.rb', line 94 def initialize @items = [] end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
92 93 94 |
# File 'lib/panda/core/navigation_registry.rb', line 92 def items @items end |
Instance Method Details
#item(label, path: nil, url: nil, target: nil, visible: nil, permission: nil, method: nil, button_options: {}, path_helper: nil, badge: nil, badge_color: nil) ⇒ Object
Register an item within this section. rubocop:disable Metrics/ParameterLists
110 111 112 113 114 115 116 117 118 |
# File 'lib/panda/core/navigation_registry.rb', line 110 def item(label, path: nil, url: nil, target: nil, visible: nil, permission: nil, method: nil, button_options: {}, path_helper: nil, badge: nil, badge_color: nil) effective_visible = visible || () @items << { label: label, path: path, url: url, target: target, visible: effective_visible, method: method, button_options: , path_helper: path_helper, badge: badge, badge_color: badge_color } end |