From 21cfb71617b9bd366938dbee1b24d85e4ed3d436 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sun, 3 Dec 2017 22:26:17 +0000 Subject: [PATCH] Add modal notification type with buttons --- editor/js/ui/notifications.js | 59 ++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/editor/js/ui/notifications.js b/editor/js/ui/notifications.js index 7c17741ea..5a2070f77 100644 --- a/editor/js/ui/notifications.js +++ b/editor/js/ui/notifications.js @@ -14,9 +14,49 @@ * limitations under the License. **/ RED.notify = (function() { + + /* + // Example usage for a modal dialog with buttons + var myNotification = RED.notify("This is the message to display",{ + modal: true, + fixed: true, + type: 'warning', + buttons: [ + { + text: "cancel", + click: function(e) { + myNotification.close(); + } + }, + { + text: "okay", + class:"primary", + click: function(e) { + myNotification.close(); + } + } + ] + }); + */ + var currentNotifications = []; var c = 0; return function(msg,type,fixed,timeout) { + var options = {}; + if (type !== null && typeof type === 'object') { + options = type; + fixed = options.fixed; + timeout = options.timeout; + type = options.type; + } + + if (options.modal) { + $("#header-shade").show(); + $("#editor-shade").show(); + $("#palette-shade").show(); + $(".sidebar-shade").show(); + } + if (currentNotifications.length > 4) { var ll = currentNotifications.length; for (var i = 0;ll > 4 && i').appendTo(n) + options.buttons.forEach(function(buttonDef) { + var b = $('