def bootstrap_alert_tag(*args, &block)
      type = args[0]
      if block_given?
        message = capture(&block)
        options = args[1] || {}
        return bootstrap_alert_tag(type, message, options)
      else
        message = args[1] || ''
        options = args[2] || {}
        options.stringify_keys!

        classes = ['alert']
        classes << "alert-#{type}" if type && type != :alert
        unless options.include?('dismissible') && !options['dismissible']
          classes << 'alert-dismissible'
          options['dismissible'] = true
        end
        options['class'] = classes.join(' ')

        message = button_tag('&times;'.html_safe,
                             type: 'button',
                             class: 'close',
                             "data-dismiss": 'alert') + message if options.delete('dismissible')
        content_tag(:div, message, options)
      end
    end
def bootstrap_alert_tag(*args, &block)
      type = args[0]
      if block_given?
        message = capture(&block)
        options = args[1] || {}
        return bootstrap_alert_tag(type, message, options)
      else
        message = args[1] || ''
        options = args[2] || {}
        options.stringify_keys!

        classes = ['alert']
        classes << "alert-#{type}" if type && type != :alert
        unless options.include?('dismissible') && !options['dismissible']
          classes << 'alert-dismissible'
          options['dismissible'] = true
        end
        options['class'] = classes.join(' ')

        message = button_tag('&times;'.html_safe,
                             type: 'button',
                             class: 'close',
                             "data-dismiss": 'alert') + message if options.delete('dismissible')
        content_tag(:div, message, options)
      end
    end
Creates an alert box of the given +type+. It supports the following alert box types
 <tt>:alert</tt>, <tt>:danger</tt>, <tt>:info</tt> and <tt>:success</tt>.

 ==== Signatures

   bootstrap_alert_tag(type, message, options = {})
   bootstrap_alert_tag(type, options = {}) do
     # message
   end

 ==== Options
 * <tt>dismissible: true</tt> - This will set whether or not a close X button
   will appear, allowing the alert box to be dismissed by the user. This is only
   supported with the Bootstrap layout and defaults to true.
   link to open in a popup window. By passing true, a default browser window
   will be opened with the URL. You can also specify an array of options
   that are passed-thru to JavaScripts window.open method.
 * All remaining options are treated as html attributes for the containing div tag.
   The class attribute is overwritten by the helper and so will be ignored if specified.

 ==== Examples

   <%= bootstrap_alert_tag(:info, 'Check it out!!') %>
   # => <div class="alert alert-info"><a href="#" class="close"
   data-dismiss="alert">&times;</a>Check it out!!</div>

 You can use a block as well if your alert message is hard to fit into the message parameter.
 ERb example:

   <%= bootstrap_alert_tag(:info) do %>
     Check it out!!
   <% end %>
   # => <div class="alert alert-info"><button type="button" class="close"
   data-dismiss="alert">&times;</button>Check it out!!</div>

 Ids for css and/or javascript are easy to produce:

   <%= bootstrap_alert_tag(:info, 'Check it out!!', dismissible: false, id: "news") %>
   # => <div class="alert alert-info" id="news">Check it out!!</div>