def render_alert(type, message)
      if type.to_s.index('safe_')
        type = type.to_s[5..-1]
        message = message.to_s.html_safe
      end

      type = type.to_sym

      type = :info if type == :notice
      type = :danger if type == :alert

      return nil unless [:info, :success, :danger, :warning].include?(type)

      "<div class=\"alert alert-#{type} alert-dismissible\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>#{render_alert_message(message)}</div>".html_safe
    end
def render_alert(type, message)
      if type.to_s.index('safe_')
        type = type.to_s[5..-1]
        message = message.to_s.html_safe
      end

      type = type.to_sym

      type = :info if type == :notice
      type = :danger if type == :alert

      return nil unless [:info, :success, :danger, :warning].include?(type)

      "<div class=\"alert alert-#{type} alert-dismissible\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>#{render_alert_message(message)}</div>".html_safe
    end
Renders an alert message.

 * +type+ The type of message [info, success, warn, error, danger, etc]
 * +message+ The message to display.

 To provide messages including HTML, you need to prefix the type with 'safe_'.

   render_alert(safe_info, '<strong>This</strong> is a message containing <code>HTML</code> content.')

 The message can be a string, hash, or array.  When an array is specified, then each array element is enumerated and
 joined together.  The real power comes in when you specify a hash.  A hash will print the key as a label and then
 enumerate the value (string, hash, or array) in an unordered list.  Hash values are processed recursively, allowing
 you to create alerts with lists within lists.

   render_alert(info, { 'Section 1' => [ 'Line 1', 'Line 2', 'Line 3' ] })

   <label>Section 1</label>
   <ul>
     <li>Line 1</li>
     <li>Line 2</li>
     <li>Line 3</li>
   </ul>

   render_alert(info, { 'Block A' => { 'Block A:1' => [ 'Line 1', 'Line 2' ] }})

   <label>Block A</label>
   <ul>
     <li>
       <label>Block A:1</label>
       <ul>
         <li>Line 1</li>
         <li>Line 2</li>
       </ul>
     </li>
   </ul>