Class: Bootstrap::ViewHelpers::Components::Alert

Inherits:
Bootstrap::ViewHelpers::Component show all
Defined in:
lib/bootstrap/view_helpers/components/alert.rb

Instance Attribute Summary

Attributes inherited from Bootstrap::ViewHelpers::Component

#block, #options, #style, #view

Instance Method Summary collapse

Methods inherited from Bootstrap::ViewHelpers::Component

#initialize

Constructor Details

This class inherits a constructor from Bootstrap::ViewHelpers::Component

Instance Method Details



13
14
15
16
# File 'lib/bootstrap/view_helpers/components/alert.rb', line 13

def alert_link_to(name = nil, opts = nil, html_options = nil, &block)
  link_to(name, opts, html_options.merge({ class: 'alert-link' }),
          &block)
end

#dismissible?Boolean

Defaults to false

Returns:

  • (Boolean)


19
20
21
# File 'lib/bootstrap/view_helpers/components/alert.rb', line 19

def dismissible?
  options[:dismissible]
end

#fade?Boolean

Defaults to true

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/bootstrap/view_helpers/components/alert.rb', line 24

def fade?
  return true if options[:fade].nil?
  options[:fade]
end

#to_htmlObject



5
6
7
8
9
10
11
# File 'lib/bootstrap/view_helpers/components/alert.rb', line 5

def to_html
  (:div, options) do
    concat(options[:content]) if options[:content]
    concat close_button
    block.call(self) if block.present?
  end
end