Class: ActiveElement::Components::Tabs

Inherits:
Object
  • Object
show all
Defined in:
lib/active_element/components/tabs.rb

Overview

Navigation tabs component.

Instance Method Summary collapse

Constructor Details

#initialize(controller, class_name:) {|_self| ... } ⇒ Tabs

Returns a new instance of Tabs.

Yields:

  • (_self)

Yield Parameters:



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

#localsObject



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

#templateObject



22
23
24
# File 'lib/active_element/components/tabs.rb', line 22

def template
  'active_element/components/tabs'
end

#to_sObject



14
15
16
# File 'lib/active_element/components/tabs.rb', line 14

def to_s
  ''
end