Commit fa5ff135 authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Alert.js: started commenting class.

parent bdd3d03b
......@@ -11,6 +11,48 @@ if (!QfqNS) {
(function (n) {
'use strict';
/**
* Display a message.
*
* Display one message on a page. Several instances can be used per page, which results in messages being
* stacked, with the latest message being at the bottom.
*
* The first instance displaying a message will append an `alert container` to the body. The last message being
* dismissed will remove the `alert container`. A typical call sequence might look like:
*
* var alert = new QfqNS.Alert("Text being displayed", "info", "none");
* alert.show();
*
* Messages may have different background colors (severity levels), controlled by the second argument
* `messageType` of the constructor. The possible values are
*
* * `"info"`
* * `"warning"`
* * `"error"`
*
* The values are translated into Bootstrap `alert-*` classes internally.
*
* Messages can feature clickable buttons, or no buttons at all, in which case a click anywhere on the message
* will dismiss it. Buttons are controlled by the third argument to the constructor:
*
* * `"okcancel"`
* * `"yesno"`
* * `"yesnosave"`
* * `"none"`
*
* Callback functions of the `Ok` or `Yes` button are added by calling Alert#addOkButtonHandler(). Callback
* functions of the `Cancel` or `No` button are added by calling Alert#addCancelButtonHandler(). Lastly,
* Alert#addSaveButtonHandler() adds callback functions to the `Save` button.
*
* Regardless of the
*
*
* @param message {string} message to be displayed
* @param messageType {string} type of message, can either be `"info"`, `"warning"`, or `"error"`.
* @param buttons {string} buttons to be displayed, can either be `"okcancel"`, `"yesno"`, `"yesnosave"`, or `"none"`.
* When `"none"` is provided, clicking anywhere on the message will dismiss it.
* @constructor
*/
n.Alert = function (message, messageType, buttons) {
this.message = message;
this.messageType = messageType || "info";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment