Module: Trestle::TabHelper

Defined in:
app/helpers/trestle/tab_helper.rb

Instance Method Summary collapse

Instance Method Details

#tab(name, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/trestle/tab_helper.rb', line 7

def tab(name, options={})
  tabs[name] = tab = Tab.new(name, options)

  (:div, id: tab.id(("modal" if dialog_request?)), class: ["tab-pane", ('active' if name == tabs.keys.first)], role: "tabpanel") do
    if block_given?
      yield
    elsif options[:partial]
      render partial: options[:partial]
    else
      render partial: name.to_s
    end
  end
end

#tabsObject



3
4
5
# File 'app/helpers/trestle/tab_helper.rb', line 3

def tabs
  @_trestle_tabs ||= {}
end