Module: BootstrapLeather::TabsHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/bootstrap_leather/tabs_helper.rb

Overview

Tabs, like the tabs of a folder

Instance Method Summary collapse

Instance Method Details

#add_tab(label, id, args = {}, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/bootstrap_leather/tabs_helper.rb', line 6

def add_tab(label, id, args = {}, &block)
  active = false
  if @tabs.nil?
    @tabs = []
    active = true
  end
  before_link = args[:before_link] ? args[:before_link] : ''
  @tabs << {
    id: id, label: label, active: active, before_link: before_link,
    content: capture(&block)
  }
end

#render_tabs(orientation = 'top') ⇒ Object



19
20
21
22
23
24
25
26
# File 'app/helpers/bootstrap_leather/tabs_helper.rb', line 19

def render_tabs(orientation = 'top')
  tabs = @tabs
  @tabs = nil
  render(
    partial: 'bootstrap_leather/tabs/tabs',
    locals: { tabs: tabs, orientation: orientation }
  )
end