Class: TwitterBootstrapMarkup::Alert

Inherits:
Tag
  • Object
show all
Defined in:
lib/twitter_bootstrap_markup/alert.rb

Constant Summary collapse

TYPES =
[:warning, :info, :success, :danger]

Constants included from Popover

Popover::POSITIONS

Constants included from Tooltip

Tooltip::POSITIONS

Instance Attribute Summary

Attributes inherited from Tag

#attributes, #children, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Tag

#append, block, inline, #prepend, #to_s

Methods included from SidePosition

#pull_left, #pull_right

Methods included from Popover

#popover

Methods included from Tooltip

#tooltip

Constructor Details

#initialize(*args, &block) ⇒ Alert

Returns a new instance of Alert.



5
6
7
8
# File 'lib/twitter_bootstrap_markup/alert.rb', line 5

def initialize(*args, &block)
  super(:div, *args, &block)
  attributes.prepend!(:class, 'alert')
end

Class Method Details

.closable(*args, &block) ⇒ Object



32
33
34
# File 'lib/twitter_bootstrap_markup/alert.rb', line 32

def self.closable(*args, &block)
  self.new(*args, &block).closable
end

Instance Method Details

#closableObject



17
18
19
20
# File 'lib/twitter_bootstrap_markup/alert.rb', line 17

def closable
  prepend Tag.new(:a, :class => 'close', 'data-dismiss' => 'alert') { append '&times' }
  self
end