Class: Nav::TabPanelsComponent

Inherits:
TabsComponent
  • Object
show all
Defined in:
app/components/spark/nav/tab_panels_component.rb

Instance Method Summary collapse

Instance Method Details

#active_item_textObject



18
19
20
# File 'app/components/spark/nav/tab_panels_component.rb', line 18

def active_item_text
  panels.first.text
end

#renderObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/components/spark/nav/tab_panels_component.rb', line 4

def render
  panels.each_with_index { |panel, index|
    items << panel.new_tab(active: index == 0)
  }

  (:div, class: "nav-tab-panels") do
    concat super
    panels.each_with_index { |panel, index| 
      panel.active = index == 0
      concat (:div, panel.yield, panel.tag_attrs)
    }
  end
end