def f(message: '', type: :info, blocked: false, closable: true, **options, &block)
      flash_class = 'alert'
      flash_class << " alert-#{type.to_s}"
      flash_class << ' alert-block' if blocked

      content_tag(:div, nil, merge_predef_class(flash_class, options)) do
        content = ''
        content << '<a href="#" class="close" data-dismiss="alert">&times;</a>' if closable
        if block_given?
          content << capture(&block)
        else
          content << message if message.present?
        end
        content.html_safe
      end
    end
def f(message: '', type: :info, blocked: false, closable: true, **options, &block)
      flash_class = 'alert'
      flash_class << " alert-#{type.to_s}"
      flash_class << ' alert-block' if blocked

      content_tag(:div, nil, merge_predef_class(flash_class, options)) do
        content = ''
        content << '<a href="#" class="close" data-dismiss="alert">&times;</a>' if closable
        if block_given?
          content << capture(&block)
        else
          content << message if message.present?
        end
        content.html_safe
      end
    end
Public: Bootstrap alerts. For success, warning, and error messages.

 message  - String. The message of alert.
 type     - Symbol or String. Type of alerts: error, warning, success,
            info. ( default: :info )
 blocked  - Boolean. Add padding-top and padding-bottom to alert.
            ( default: false )
 closable - Boolean. Add a close button to alert. ( default: true )
 options  - Other options that can be accepted by div.
 block    - Content of the alert. It can be a string or a HTML block.

 Examples

   f(message: 'Hello World')
   # => <div class="alert alert-info">
          <a href="#" class="close" data-dismiss="alert">&times;</a>
          Hello World
        </div>

   f(message: 'Hello World', type: :success, block: true)
   # => <div class="alert alert-success alert-block">
          <a href="#" class="close" data-dismiss="alert">&times;</a>
          Hello World
        </div>

   = f do
     %h3 Hello World
     %p foo bar
   # => <div class="alert alert-info">
          <a href="#" class="close" data-dismiss="alert">&times;</a>
          <h3>Hello World</h3>
          <p>foo bar</p>
        </div>

 Returns the whole alert.