Class: ActiveElement::Components::Tabs
- Inherits:
-
Object
- Object
- ActiveElement::Components::Tabs
- Defined in:
- lib/active_element/components/tabs.rb
Overview
Navigation tabs component.
Instance Method Summary collapse
-
#initialize(controller, class_name:) {|_self| ... } ⇒ Tabs
constructor
A new instance of Tabs.
- #locals ⇒ Object
- #tab(title:, path:, &block) ⇒ Object
- #template ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(controller, class_name:) {|_self| ... } ⇒ Tabs
Returns a new instance of Tabs.
7 8 9 10 11 12 |
# File 'lib/active_element/components/tabs.rb', line 7 def initialize(controller, class_name:) @controller = controller @class_name = class_name @tabs = [] yield self end |
Instance Method Details
#locals ⇒ Object
26 27 28 |
# File 'lib/active_element/components/tabs.rb', line 26 def locals { tabs: tabs, class_name: class_name } end |
#tab(title:, path:, &block) ⇒ Object
18 19 20 |
# File 'lib/active_element/components/tabs.rb', line 18 def tab(title:, path:, &block) Tab.new(controller, title: title, path: path, &block).tap { |tab| @tabs << tab } end |
#template ⇒ Object
22 23 24 |
# File 'lib/active_element/components/tabs.rb', line 22 def template 'active_element/components/tabs' end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/active_element/components/tabs.rb', line 14 def to_s '' end |