From fc072a221bc8bf77e86f5b6d235e45a4d84347ad Mon Sep 17 00:00:00 2001 From: Grant Nestor Date: Thu, 4 Aug 2016 16:20:58 -0700 Subject: [PATCH 1/2] Display "trusted" and "untrusted" notifications --- .../static/notebook/js/notificationarea.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/notebook/static/notebook/js/notificationarea.js b/notebook/static/notebook/js/notificationarea.js index 33b9ab237..e850af087 100644 --- a/notebook/static/notebook/js/notificationarea.js +++ b/notebook/static/notebook/js/notificationarea.js @@ -24,6 +24,7 @@ define([ NotebookNotificationArea.prototype.init_notification_widgets = function () { this.init_kernel_notification_widget(); this.init_notebook_notification_widget(); + this.init_trusted_notebook_notification_widget(); }; /** @@ -338,5 +339,27 @@ define([ }); }; + /** + * Initialize the notification widget for trusted notebook messages. + * + * @method init_trusted_notebook_notification_widget + */ + NotebookNotificationArea.prototype.init_trusted_notebook_notification_widget = function () { + var that = this; + var tnw = this.widget('trusted'); + + // Notebook trust events + this.events.on('trust_changed.Notebook', function (event, trusted) { + if (trusted) { + tnw.info("Trusted"); + } else { + tnw.danger("Not Trusted", undefined, function() { + that.notebook.trust_notebook(); + return false; + }); + } + }); + }; + return {'NotebookNotificationArea': NotebookNotificationArea}; }); From 055499563cf5347fdcbba5c2cd4a58c58d1f8c7c Mon Sep 17 00:00:00 2001 From: Grant Nestor Date: Fri, 5 Aug 2016 09:30:54 -0700 Subject: [PATCH 2/2] Use classic style for trusted notification --- notebook/static/notebook/js/notificationarea.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebook/static/notebook/js/notificationarea.js b/notebook/static/notebook/js/notificationarea.js index e850af087..36b3dd60d 100644 --- a/notebook/static/notebook/js/notificationarea.js +++ b/notebook/static/notebook/js/notificationarea.js @@ -351,9 +351,9 @@ define([ // Notebook trust events this.events.on('trust_changed.Notebook', function (event, trusted) { if (trusted) { - tnw.info("Trusted"); + tnw.set_message("Trusted"); } else { - tnw.danger("Not Trusted", undefined, function() { + tnw.set_message("Not Trusted", undefined, function() { that.notebook.trust_notebook(); return false; });