Class: Bootstrap3Helper::Tabs
- Defined in:
- lib/bootstrap3_helper/tabs.rb,
lib/bootstrap3_helper/tabs/menu.rb,
lib/bootstrap3_helper/tabs/content.rb,
lib/bootstrap3_helper/tabs/dropdown.rb
Overview
On menu items - you can pass in either symbol or string for the link. If you pass in a block, it will use the block for the title of the li. If no block is present, then it will titleize the symbol or string.
Tabs::Menu will respond to item
and dropdown
Each method will yield the corresponding component, either a Tabs::Menu or a Tabs::Dropdown.
Used to rapidly generated Bootstrap Tabs Components.
Defined Under Namespace
Classes: Content, Dropdown, Menu
Instance Method Summary collapse
-
#content(args = {}, &block) ⇒ Tabs::Content
Allows you to access the Tabs::Content object.
-
#initialize(template, args = {}, &block) ⇒ Tabs
constructor
Creates a new Tabs object.
-
#menu(args = {}, &block) ⇒ Tabs::Menu
Allows you access the Tabs::Menu object.
-
#to_s ⇒ String
Used to render out the HTML of the Tabs Object.
Methods inherited from Component
#concat, #content_tag, #parse_arguments, #uuid
Constructor Details
#initialize(template, args = {}, &block) ⇒ Tabs
Creates a new Tabs object.
52 53 54 55 56 57 58 59 |
# File 'lib/bootstrap3_helper/tabs.rb', line 52 def initialize(template, args = {}, &block) super(template) @type = args.fetch(:type, :tabs) @id = args.fetch(:id, nil) @class = args.fetch(:class, '') @content = block || proc { '' } end |
Instance Method Details
#content(args = {}, &block) ⇒ Tabs::Content
Allows you to access the Tabs::Content object
75 76 77 |
# File 'lib/bootstrap3_helper/tabs.rb', line 75 def content(args = {}, &block) Tabs::Content.new(@template, args, &block) end |
#menu(args = {}, &block) ⇒ Tabs::Menu
Allows you access the Tabs::Menu object.
66 67 68 |
# File 'lib/bootstrap3_helper/tabs.rb', line 66 def (args = {}, &block) Tabs::Menu.new(@template, args.merge(type: @type), &block) end |
#to_s ⇒ String
Used to render out the HTML of the Tabs Object
83 84 85 86 87 |
# File 'lib/bootstrap3_helper/tabs.rb', line 83 def to_s content_tag :div, id: @id, class: @class do @content.call(self) end end |