Commit 2f2a5951 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge remote-tracking branch 'origin/6345_AlertRework' into 6345_AlertRework

parents ffc314c2 a3ed9182
Pipeline #1127 passed with stage
in 2 minutes
...@@ -113,6 +113,7 @@ var QfqNS = QfqNS || {}; ...@@ -113,6 +113,7 @@ var QfqNS = QfqNS || {};
this.fadeOutDuration = 400; this.fadeOutDuration = 400;
this.timerId = null; this.timerId = null;
this.parent = {}; this.parent = {};
this.identifier = false;
this.eventEmitter = new EventEmitter(); this.eventEmitter = new EventEmitter();
}; };
...@@ -133,9 +134,14 @@ var QfqNS = QfqNS || {}; ...@@ -133,9 +134,14 @@ var QfqNS = QfqNS || {};
if (!n.QfqPage.alertManager) { if (!n.QfqPage.alertManager) {
n.QfqPage.alertManager = new n.AlertManager({}); n.QfqPage.alertManager = new n.AlertManager({});
} }
return n.QfqPage.alertManager; return n.QfqPage.alertManager;
}; };
n.Alert.prototype.setIdentifier = function (i) {
this.identifier = i;
};
/** /**
* *
* @returns {number|jQuery} * @returns {number|jQuery}
...@@ -225,12 +231,13 @@ var QfqNS = QfqNS || {}; ...@@ -225,12 +231,13 @@ var QfqNS = QfqNS || {};
} }
this.parent = this.makeAlertContainerSingleton(); this.parent = this.makeAlertContainerSingleton();
this.parent.addAlert(this);
if (this.modal) { if (this.modal) {
this.$modalDiv = $("<div>", { this.$modalDiv = $("<div>", {
class: "removeMe" class: "removeMe"
}); });
this.parent.createBlockScreen(); this.parent.createBlockScreen(this);
} }
if (this.messageTitle) { if (this.messageTitle) {
...@@ -325,6 +332,7 @@ var QfqNS = QfqNS || {}; ...@@ -325,6 +332,7 @@ var QfqNS = QfqNS || {};
that.removeAlertContainer(); that.removeAlertContainer();
}); });
} }
this.parent.removeAlert(this.identifier);
}; };
/** /**
......
...@@ -44,9 +44,18 @@ var QfqNS = QfqNS || {}; ...@@ -44,9 +44,18 @@ var QfqNS = QfqNS || {};
*/ */
n.AlertManager.prototype.addAlert = function(alert) { n.AlertManager.prototype.addAlert = function(alert) {
this.alerts.push(alert); this.alerts.push(alert);
alert.setIdentifier(this.alerts.length);
console.log(this.alerts); console.log(this.alerts);
}; };
n.AlertManager.prototype.removeAlert = function(identifier) {
for(var i=0; this.alerts.length > i; i++) {
if (this.alerts[i].identifier === identifier) {
this.alerts.splice(i, 1);
}
}
};
/** /**
* Removes the last Alert in the Array. Can be used to safely delete all alerts in a loop. * Removes the last Alert in the Array. Can be used to safely delete all alerts in a loop.
* Returns false when the AlertManager has no more Alerts. * Returns false when the AlertManager has no more Alerts.
...@@ -117,11 +126,14 @@ var QfqNS = QfqNS || {}; ...@@ -117,11 +126,14 @@ var QfqNS = QfqNS || {};
* that the screen block is removed. * that the screen block is removed.
*/ */
n.AlertManager.prototype.checkAlert = function() { n.AlertManager.prototype.checkAlert = function() {
if (this.blockingAlert.isShown) { if (!this.blockingAlert.isShown) {
this.removeModalAlert(); this.removeModalAlert();
} }
}; };
/**
* Remove modal alerts
*/
n.AlertManager.prototype.removeModalAlert = function() { n.AlertManager.prototype.removeModalAlert = function() {
if (this.screenBlocked) { if (this.screenBlocked) {
$(".blockscreenQfq").remove(); $(".blockscreenQfq").remove();
......
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