Skip to content

Commit

Permalink
Merge pull request #1658 from gnestor/trusted-notification
Browse files Browse the repository at this point in the history
Display "trusted" and "untrusted" notifications
  • Loading branch information
gnestor committed Aug 5, 2016
2 parents 9442804 + 0554995 commit 5a03481
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions notebook/static/notebook/js/notificationarea.js
Expand Up @@ -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();
};

/**
Expand Down Expand Up @@ -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.set_message("Trusted");
} else {
tnw.set_message("Not Trusted", undefined, function() {
that.notebook.trust_notebook();
return false;
});
}
});
};

return {'NotebookNotificationArea': NotebookNotificationArea};
});

0 comments on commit 5a03481

Please sign in to comment.