Class: BootstrapHelpers::TabsBuilder
- Inherits:
-
Object
- Object
- BootstrapHelpers::TabsBuilder
- Defined in:
- lib/bootstrap-helpers.rb
Overview
Tabs =
Instance Attribute Summary collapse
-
#pane_contents ⇒ Object
readonly
Returns the value of attribute pane_contents.
-
#pane_handles ⇒ Object
readonly
Returns the value of attribute pane_handles.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(parent) ⇒ TabsBuilder
constructor
A new instance of TabsBuilder.
- #pane(title, pane_id = nil, &block) ⇒ Object
Constructor Details
#initialize(parent) ⇒ TabsBuilder
Returns a new instance of TabsBuilder.
233 234 235 236 237 238 |
# File 'lib/bootstrap-helpers.rb', line 233 def initialize parent @first = true @parent = parent @pane_handles = [] @pane_contents = [] end |
Instance Attribute Details
#pane_contents ⇒ Object (readonly)
Returns the value of attribute pane_contents.
230 231 232 |
# File 'lib/bootstrap-helpers.rb', line 230 def pane_contents @pane_contents end |
#pane_handles ⇒ Object (readonly)
Returns the value of attribute pane_handles.
230 231 232 |
# File 'lib/bootstrap-helpers.rb', line 230 def pane_handles @pane_handles end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
230 231 232 |
# File 'lib/bootstrap-helpers.rb', line 230 def parent @parent end |
Instance Method Details
#pane(title, pane_id = nil, &block) ⇒ Object
240 241 242 243 244 245 246 247 248 249 |
# File 'lib/bootstrap-helpers.rb', line 240 def pane(title, pane_id = nil, &block) pane_id ||= "#{title.parameterize}_tab" css_class, @first = 'active', false if @first link = content_tag(:a, title, :'data-toggle' => 'tab', :href => "##{pane_id}") @pane_handles << content_tag(:li, link, :class => css_class) @pane_contents << (content_tag :div, :class => "tab-pane #{css_class}", :id => "#{pane_id}" do capture(&block) end) nil end |