Module: Card::Set::All::Bootstrap::Tabs::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod021-card-mod-bootstrap/all/bootstrap/tabs.rb,
card/tmpsets/set/mod022-card-mod-bootstrap/all/bootstrap/tabs.rb

Instance Method Summary collapse

Instance Method Details

#tabs(tab_hash, active_name = nil, args = {}, &block) ⇒ HTML

beginning (default is the first)

Parameters:

  • tab_hash (Hash)

    keys are the tab names Each value can be either a String or a Hash. If a Hash can contain the following keys: :title - the label to appear in the clickable tab nav. if title is not specified, the key is used :content - body of tab pane :button_attr - attributes for button link in tab nav.

    If using lazy loading (see :load below), the following options also apply :path - explicit path to use for tab pane :view - card view from which to auto-construct path (if missing, uses key)

    If the value is a String, it is treated as the tab content for static tabs and the view for lazy tabs

  • active_name (String) (defaults to: nil)

    label of the tab that should be active at the

  • args (Hash) (defaults to: {})

    options

  • block (Block)

    content of the active tab (for lazy-loading)

Options Hash (args):

  • :tab_type (String) — default: 'tabs'

    use pills or tabs

  • :panel_attr (Hash)

    html args used for the panel div

  • :pane_attr (Hash)

    html args used for the pane div

  • :load. (Hash)

    :lazy for lazy-loading tabs

Returns:

  • (HTML)

    bootstrap tabs element with all content preloaded



36
37
38
39
40
41
42
43
44
45
46
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/all/bootstrap/tabs.rb', line 36

def tabs tab_hash, active_name=nil, args={}, &block
  klass = args[:load] == :lazy ? Card::LazyTab : Card::Tab
  args.reverse_merge!(
    panel_attr: {},
    pane_attr: {},
    tab_type: "tabs",
    block: block,
    tab_objects: Card::Tab.tab_objects(self, tab_hash, active_name, klass)
  )
  haml :tab_panel, args
end