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}; });