Class: TwitterBootstrapMarkup::DropdownButton
- Defined in:
- lib/twitter_bootstrap_markup/dropdown_button.rb
Constant Summary
Constants included from Popover
Constants included from Tooltip
Instance Attribute Summary
Attributes inherited from Tag
Instance Method Summary collapse
- #append(element) ⇒ Object
-
#initialize(text, &block) ⇒ DropdownButton
constructor
A new instance of DropdownButton.
- #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(text, &block) ⇒ DropdownButton
Returns a new instance of DropdownButton.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/twitter_bootstrap_markup/dropdown_button.rb', line 5 def initialize(text, &block) super(:div, :class => 'btn-group') do @button = internal_append(Button.new(:class => 'dropdown-toggle', 'data-toggle' => 'dropdown') do append "#{text} " append Tag.block :span, :class => 'caret' end) @ul = internal_append Tag.block(:ul, :class => 'dropdown-menu') instance_eval &block if block_given? end end |
Instance Method Details
#append(element) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/twitter_bootstrap_markup/dropdown_button.rb', line 16 def append(element) if element.is_a?(Tag) && element.name == :li @ul.append element else @ul.append Tag.block(:li, element) end end |
#internal_append ⇒ Object
3 |
# File 'lib/twitter_bootstrap_markup/dropdown_button.rb', line 3 alias :internal_append :append |