From 624a6c93427656f89774f9ac48c27cdec3a8ec15 Mon Sep 17 00:00:00 2001 From: bbaer <bbaer@math.uzh.ch> Date: Wed, 7 Feb 2018 01:40:04 +0100 Subject: [PATCH] added title --- javascript/src/Alert.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/javascript/src/Alert.js b/javascript/src/Alert.js index 8ee0fcade..0ecbe9282 100644 --- a/javascript/src/Alert.js +++ b/javascript/src/Alert.js @@ -97,6 +97,8 @@ var QfqNS = QfqNS || {}; // new style this.message = options.message || "MESSAGE"; this.messageType = options.type || "info"; + this.messageTitle = options.title || false; + this.errorCode = options.code || false; this.buttons = options.buttons || []; this.modal = options.modal || false; this.timeout = options.timeout || n.Alert.constants.NO_TIMEOUT; @@ -230,6 +232,12 @@ var QfqNS = QfqNS || {}; //this.$modalDiv.css('height', Math.max(document.documentElement.clientHeight, window.innerHeight || 0)); } + if (this.messageTitle) { + this.$titleWrap = $("<p>") + .addClass("title") + .append(this.messageTitle); + } + this.$messageWrap = $("<p>") .addClass("body") .append(this.message); @@ -240,6 +248,10 @@ var QfqNS = QfqNS || {}; .attr("role", "alert") .append(this.$messageWrap); + if (this.$titleWrap) { + this.$alertDiv.prepend(this.$titleWrap); + } + if (this.modal) { this.$alertDiv.addClass("alert-interactive"); } else { -- GitLab