Commit b3635483 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'punktetool' of git.math.uzh.ch:typo3/qfq into punktetool

parents 50401c41 aee367e1
......@@ -31,6 +31,39 @@ the server (`"success"`) or encountered an error (`"error"`). On
Depending on the request, the server may provide additional
information in the response, as outlined below.
### Alert
{
"message": "<message>",
"type": "<type of message>",
"timeout": <timeout in milliseconds>,
"modal": <boolean>,
"buttons": [{
"label": "<label>",
"eventName": "<eventName>",
"focus": <boolean>
}]
}
`"type"`
: can be `"info"`, `"warning"`, or `"error"`. Default is `"info"`.
`"timeout"`
: If timeout is less than or equal to 0, the alert won't timeout and stay open until dismissed by the user. Default `n.Alert.constants.NO_TIMEOUT`.
`"modal"`
: whether or not alert is modal, i.e. prevent clicks anywhere but the dialog. Default is `false`.
`"buttons"`
: what buttons to display on alert. If empty array is provided, no buttons are displayed and a click anywhere in the alert will dismiss it.
`"buttons.label"`
: Label of the button.
`"buttons.eventName"`
: Name of the event to be executed when button is clicked.
`"buttons.focus"`
: Whether or not button has focus by default. Default is `false`.
### HTML Form Element Validation Response
......
......@@ -152,7 +152,10 @@ var QfqNS = QfqNS || {};
* @private
*/
n.Alert.prototype.removeAlertContainer = function () {
$(n.Alert.constants.alertContainerSelector).remove();
$(n.Alert.constants.alertContainerSelector + "> div").remove();
if (this.modal) {
$("#alert-interactive").remove();
}
};
/**
......@@ -228,9 +231,11 @@ var QfqNS = QfqNS || {};
$alertContainer = this.makeAlertContainerSingleton();
if (this.modal) {
this.$modalDiv = $("<div>");
this.$modalDiv.css('z-index', 1000);
$alertContainer.css('position', 'fixed');
$alertContainer.css('left', 0);
$alertContainer.css('top', 0);
$alertContainer.css('z-index', 999);
$alertContainer.css('background', 'rgba(0,0,0,0.5)');
$alertContainer.css('width', "100%");
$alertContainer.css('height', Math.max($(document).height(), $(window).height()) + "px");
......@@ -323,9 +328,10 @@ var QfqNS = QfqNS || {};
});
} else {
this.$alertDiv.fadeOut(this.fadeOutDuration, function(){
this.$alertDiv.remove();
this.$alertDiv = null;
this.shown = false;
that.$alertDiv.remove();
that.$alertDiv = null;
that.shown = false;
that.removeAlertContainer();
});
}
......
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