Commit 117e8c3e authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Alert.js: Click handler on message will only be installed IF no buttons are to...

Alert.js: Click handler on message will only be installed IF no buttons are to be displayed. If buttons are displayed, the buttons will dismiss the message upon click.
parent 1ec88d8b
......@@ -161,12 +161,16 @@ if (!QfqNS) {
.addClass("alert")
.addClass(this.getAlertClassBasedOnMessageType())
.attr("role", "alert")
.append(this.message)
.click(this.removeAlert.bind(this));
.append(this.message);
var buttons = this.getButtons();
if (buttons && this.timeout < 1) {
// Buttons will take care of removing the message
this.$alertDiv.append(buttons);
} else {
// Click on the message anywhere will remove the message
this.$alertDiv.click(this.removeAlert.bind(this));
}
$alertContainer.append(this.$alertDiv);
......@@ -234,6 +238,7 @@ if (!QfqNS) {
* @private
*/
n.Alert.prototype.okButtonHandler = function (handler) {
this.removeAlert();
this.userOkButtonHandlers.call(this);
};
......@@ -244,6 +249,7 @@ if (!QfqNS) {
* @private
*/
n.Alert.prototype.saveButtonHandler = function (handler) {
this.removeAlert();
this.userSaveButtonHandlers.call(this);
};
......@@ -254,6 +260,7 @@ if (!QfqNS) {
* @private
*/
n.Alert.prototype.cancelButtonHandler = function (handler) {
this.removeAlert();
this.userCancelButtonHandlers.call(this);
};
......
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