Class: TwitterBootstrapMarkup::TabContent
- Defined in:
- lib/twitter_bootstrap_markup/tab_content.rb
Constant Summary
Constants included from Popover
Constants included from Tooltip
TwitterBootstrapMarkup::Tooltip::POSITIONS
Instance Attribute Summary
Attributes inherited from Tag
Instance Method Summary collapse
- #append(*args, &block) ⇒ Object
-
#initialize(attributes = {}, &block) ⇒ TabContent
constructor
A new instance of TabContent.
- #internal_append ⇒ Object
Methods inherited from Tag
block, inline, #prepend, #to_s
Methods included from SidePosition
Methods included from Popover
Methods included from Tooltip
Constructor Details
#initialize(attributes = {}, &block) ⇒ TabContent
Returns a new instance of TabContent.
5 6 7 8 9 10 11 |
# File 'lib/twitter_bootstrap_markup/tab_content.rb', line 5 def initialize(attributes={}, &block) if block_given? super(:div, attributes.prepend!(:class, 'tab-content'), &block) else super(:div, attributes.prepend!(:class, 'tab-content')) {} end end |
Instance Method Details
#append(*args, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/twitter_bootstrap_markup/tab_content.rb', line 13 def append(*args, &block) id = args.shift element = block_given? ? instance_eval(&block) : args.shift mode = args.shift || :inactive if element.is_a?(Tag) && element.name == :div && element.attributes[:class].include?('tab-pane') element.attributes[:id] = id element.attributes.append!(:class, 'active') if mode == :active internal_append element else attributes = {:class => 'tab-pane', :id => id} attributes.append!(:class, :active) if mode == :active internal_append Tag.block(:div, element, attributes) end end |
#internal_append ⇒ Object
3 |
# File 'lib/twitter_bootstrap_markup/tab_content.rb', line 3 alias :internal_append :append |