Skip to content

Commit 5a03481

Browse files
authoredAug 5, 2016
Merge pull request #1658 from gnestor/trusted-notification
Display "trusted" and "untrusted" notifications
2 parents 9442804 + 0554995 commit 5a03481

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
 

‎notebook/static/notebook/js/notificationarea.js

+23
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ define([
2424
NotebookNotificationArea.prototype.init_notification_widgets = function () {
2525
this.init_kernel_notification_widget();
2626
this.init_notebook_notification_widget();
27+
this.init_trusted_notebook_notification_widget();
2728
};
2829

2930
/**
@@ -338,5 +339,27 @@ define([
338339
});
339340
};
340341

342+
/**
343+
* Initialize the notification widget for trusted notebook messages.
344+
*
345+
* @method init_trusted_notebook_notification_widget
346+
*/
347+
NotebookNotificationArea.prototype.init_trusted_notebook_notification_widget = function () {
348+
var that = this;
349+
var tnw = this.widget('trusted');
350+
351+
// Notebook trust events
352+
this.events.on('trust_changed.Notebook', function (event, trusted) {
353+
if (trusted) {
354+
tnw.set_message("Trusted");
355+
} else {
356+
tnw.set_message("Not Trusted", undefined, function() {
357+
that.notebook.trust_notebook();
358+
return false;
359+
});
360+
}
361+
});
362+
};
363+
341364
return {'NotebookNotificationArea': NotebookNotificationArea};
342365
});

0 commit comments

Comments
 (0)
Please sign in to comment.