Class: ActiveElement::Components::Navbar
- Inherits:
-
Object
- Object
- ActiveElement::Components::Navbar
- Includes:
- Translations
- Defined in:
- lib/active_element/components/navbar.rb
Overview
A navigation bar providing links to areas within the application.
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
- #active_path_class(current_navbar_item:) ⇒ Object
-
#initialize(controller, items: nil, fixed: true) ⇒ Navbar
constructor
A new instance of Navbar.
- #locals ⇒ Object
- #template ⇒ Object
Methods included from Translations
Constructor Details
#initialize(controller, items: nil, fixed: true) ⇒ Navbar
Returns a new instance of Navbar.
11 12 13 14 15 |
# File 'lib/active_element/components/navbar.rb', line 11 def initialize(controller, items: nil, fixed: true) @controller = controller @items = items @fixed = fixed end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
9 10 11 |
# File 'lib/active_element/components/navbar.rb', line 9 def controller @controller end |
Instance Method Details
#active_path_class(current_navbar_item:) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/active_element/components/navbar.rb', line 29 def active_path_class(current_navbar_item:) if ActiveMenuLink.new( rails_component: RailsComponent.new(Rails), navbar_items: items, current_path: controller.request.path, current_navbar_item: , controller_path: controller.controller_path, action_name: controller.action_name ).active? 'active' end end |
#locals ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/active_element/components/navbar.rb', line 21 def locals { component: self, items: items, fixed: fixed } end |
#template ⇒ Object
17 18 19 |
# File 'lib/active_element/components/navbar.rb', line 17 def template 'active_element/components/navbar' end |