Sha256: 8626ace254ece8f8a67ca0790674ac79464c3c2c13dcef6d6031d69e9aa41158

Contents?: true

Size: 486 Bytes

Versions: 7

Compression:

Stored size: 486 Bytes

Contents

module Trestle
  module TabHelper
    def tabs
      @_trestle_tabs ||= {}
    end

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

      content_tag(:div, id: "tab-#{name}", 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
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
trestle-0.8.7 app/helpers/trestle/tab_helper.rb
trestle-0.8.6 app/helpers/trestle/tab_helper.rb
trestle-0.8.5 app/helpers/trestle/tab_helper.rb
trestle-0.8.4 app/helpers/trestle/tab_helper.rb
trestle-0.8.3 app/helpers/trestle/tab_helper.rb
trestle-0.8.2 app/helpers/trestle/tab_helper.rb
trestle-0.8.0 app/helpers/trestle/tab_helper.rb