Class: TwitterBootstrap::ButtonGroupWithTabsBuilder
- Inherits:
-
ButtonGroupBuilder
- Object
- ButtonGroupBuilder
- TwitterBootstrap::ButtonGroupWithTabsBuilder
- Defined in:
- lib/twitter_bootstrap_helpers/button_group_builder.rb
Instance Method Summary collapse
- #build(block) ⇒ Object
- #button(label, target, options = {}, &block) ⇒ Object
-
#initialize(view_context) ⇒ ButtonGroupWithTabsBuilder
constructor
A new instance of ButtonGroupWithTabsBuilder.
Methods inherited from ButtonGroupBuilder
Constructor Details
#initialize(view_context) ⇒ ButtonGroupWithTabsBuilder
Returns a new instance of ButtonGroupWithTabsBuilder.
44 45 46 47 |
# File 'lib/twitter_bootstrap_helpers/button_group_builder.rb', line 44 def initialize(view_context) super(:radio, view_context) @tabs = "" end |
Instance Method Details
#build(block) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/twitter_bootstrap_helpers/button_group_builder.rb', line 49 def build(block) block.call(self) = @view_context.content_tag(:div, @buttons.html_safe, class: 'btn-group', data: {toggle: 'buttons-radio'}) tabs = @view_context.content_tag(:div, @tabs.html_safe, class: 'tab-content') @view_context.content_tag(:div, << tabs, class: 'tabbable') end |
#button(label, target, options = {}, &block) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/twitter_bootstrap_helpers/button_group_builder.rb', line 58 def (label, target, = {}, &block) super(label, .merge!(target: target)) tab_class = ['tab-pane'] tab_class << 'active' if [:active] tab_class = tab_class.join(' ') @tabs << @view_context.content_tag(:div, @view_context.capture(&block), id: target, class: tab_class) "" end |