Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
fa5ff135
Commit
fa5ff135
authored
Feb 17, 2016
by
Rafael Ostertag
Browse files
Alert.js: started commenting class.
parent
bdd3d03b
Changes
1
Hide whitespace changes
Inline
Side-by-side
javascript/src/Alert.js
View file @
fa5ff135
...
...
@@ -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
"
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment