def sweetalert(text, title = '', opts = {})
      opts = {
        showConfirmButton: false,
        timer:             2000,
        allowOutsideClick: true,
        confirmButtonText: 'OK'
      }.merge(opts)

      opts[:text]  = text
      opts[:title] = title

      if opts[:button]
        opts[:showConfirmButton] = true
        opts[:confirmButtonText] = opts[:button] if opts[:button].is_a?(String)

        opts.delete(:button)
      end

      if opts[:persistent]
        opts[:showConfirmButton] = true
        opts[:allowOutsideClick] = false
        opts[:timer]             = nil
        opts[:confirmButtonText] = opts[:persistent] if opts[:persistent].is_a?(String)

        opts.delete(:persistent)
      end

      flash_config(opts)
    end
def sweetalert(text, title = '', opts = {})
      opts = {
        showConfirmButton: false,
        timer:             2000,
        allowOutsideClick: true,
        confirmButtonText: 'OK'
      }.merge(opts)

      opts[:text]  = text
      opts[:title] = title

      if opts[:button]
        opts[:showConfirmButton] = true
        opts[:confirmButtonText] = opts[:button] if opts[:button].is_a?(String)

        opts.delete(:button)
      end

      if opts[:persistent]
        opts[:showConfirmButton] = true
        opts[:allowOutsideClick] = false
        opts[:timer]             = nil
        opts[:confirmButtonText] = opts[:persistent] if opts[:persistent].is_a?(String)

        opts.delete(:persistent)
      end

      flash_config(opts)
    end
Display an alert with a text and an optional title
 Default without an specific type

 @param [String] text Body of the alert (gets automatically the title if no title is specified)
 @param [String] title Title of the alert
 @param [Hash] opts Optional Parameters