setAlert(name, cls, line1, opt_line2) {
    var alert;
    var existing = this.findAlert(name);
    if (existing) {
      // Replace the contents of the existing alert, if any.
      $('.alert[data-alert-name="' + name + '"] p').remove();
      alert = existing.removeClass().addClass(
          'alert alert-dismissable alert-' + cls);
    } else {
      // Create a new alert if needed.
      alert = $('.templates .alert')
                  .clone()
                  .addClass('alert-' + cls)
                  .attr('data-alert-name', name);
      $('.alerts').append(alert);
    }
    alert.append($('<p/>').append(line1))
        .append($('<p/>', {class: 'line2'}).append(opt_line2))
        .addClass('visible');
  }
Sets the alert with the given name to the have the class and content given.
The alert is created if it doesn't already exist.
@param {string} name The name of the alert to set.
@param {string} cls The type of the alert for Bootstrap CSS styling.
@param {string} line1 The first line of the alert text.
@param {string=} opt_line2 The second line of the alert text.