module Spyro::ActionViewExtension::TabsHelper
Public Instance Methods
tab(name, options = {})
click to toggle source
# File lib/spyro/helpers/action_view_extension.rb, line 151 def tab name, options = {}, &block @tabs[name] = options.merge :content => capture(&block) end
tabs() { || ... }
click to toggle source
# File lib/spyro/helpers/action_view_extension.rb, line 148 def tabs @tabs = {} def tab name, options = {}, &block @tabs[name] = options.merge :content => capture(&block) end yield capture_haml do haml_tag :ul, :class => "nav nav-tabs nav-justified", role: "tablist" do @tabs.keys.each_with_index do |name, index| haml_tag :li, :class => (index == 0 ? "active" : "") do haml_concat link_to(name, "##{name}", "data-toggle" => "tab") end end end haml_tag :div, :class => "tab-content" do @tabs.each_with_index do |(name, values), index| haml_tag :div, :id => name, :class => ["tab-pane", (index == 0 ? "active" : "")] do haml_concat values[:content] end end end end end