Module: TabsHelper
- Defined in:
- app/helpers/tabs_helper.rb
Instance Method Summary collapse
Instance Method Details
#tabs_content(tabs) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/helpers/tabs_helper.rb', line 17 def tabs_content tabs any_active_tab = any_active_tabs tabs contentsHTML = '' tabs.each_with_index do |tab, index| active_tab_class = tab_class tab, index, any_active_tab contentsHTML += content_tag :li, class: "#{active_tab_class} tab-pane", id: "tab-#{tab.id}" do tab.content end end raw contentsHTML end |
#tabs_labels(tabs) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/helpers/tabs_helper.rb', line 2 def tabs_labels tabs any_active_tab = any_active_tabs tabs labelsHTML = '' tabs.each_with_index do |tab, index| active_tab_class = tab_class tab, index, any_active_tab labelsHTML += content_tag :li, class: active_tab_class do link_to "#tab-#{tab.id}", data: {toggle: 'tab'} do tab.label end end end raw labelsHTML end |