diff --git a/IPython/frontend/html/notebook/static/js/menubar.js b/IPython/frontend/html/notebook/static/js/menubar.js
index 9814418d0..b0927c51a 100644
--- a/IPython/frontend/html/notebook/static/js/menubar.js
+++ b/IPython/frontend/html/notebook/static/js/menubar.js
@@ -87,6 +87,8 @@ var IPython = (function (IPython) {
this.element.find('#save_checkpoint').click(function () {
IPython.notebook.save_checkpoint();
});
+ this.element.find('#restore_checkpoint').click(function () {
+ });
this.element.find('#download_ipynb').click(function () {
var notebook_id = IPython.notebook.get_notebook_id();
var url = that.baseProjectUrl() + 'notebooks/' +
@@ -221,8 +223,34 @@ var IPython = (function (IPython) {
this.element.find('#keyboard_shortcuts').click(function () {
IPython.quick_help.show_keyboard_shortcuts();
});
+
+ this.update_restore_checkpoint(null);
+
+ $([IPython.events]).on('checkpoints_listed.Notebook', function (event, data) {
+ that.update_restore_checkpoint(data);
+ });
+
+ $([IPython.events]).on('checkpoint_created.Notebook', function (event, data) {
+ that.update_restore_checkpoint(data);
+ });
};
+ MenuBar.prototype.update_restore_checkpoint = function(checkpoint) {
+ if (!checkpoint) {
+ this.element.find("#restore_checkpoint")
+ .addClass('ui-state-disabled')
+ .off('click')
+ .find('a').text("Revert");
+ return;
+ };
+ var d = new Date(checkpoint.last_modified);
+ this.element.find("#restore_checkpoint")
+ .removeClass('ui-state-disabled')
+ .off('click')
+ .click(function () {
+ IPython.notebook.restore_checkpoint_dialog();
+ }).find('a').html("Revert to:
" + d.format("mmm dd HH:MM:ss"));
+ }
IPython.MenuBar = MenuBar;
diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js
index 0abe0ad98..8a5afee1c 100644
--- a/IPython/frontend/html/notebook/static/js/notebook.js
+++ b/IPython/frontend/html/notebook/static/js/notebook.js
@@ -1696,10 +1696,13 @@ var IPython = (function (IPython) {
});
}
+
// Create the kernel after the notebook is completely loaded to prevent
// code execution upon loading, which is a security risk.
if (! this.read_only) {
this.start_kernel();
+ // load our checkpoint list
+ IPython.notebook.list_checkpoints();
}
$([IPython.events]).trigger('notebook_loaded.Notebook');
};
diff --git a/IPython/frontend/html/notebook/templates/notebook.html b/IPython/frontend/html/notebook/templates/notebook.html
index d0620ad64..3aa9437dd 100644
--- a/IPython/frontend/html/notebook/templates/notebook.html
+++ b/IPython/frontend/html/notebook/templates/notebook.html
@@ -59,6 +59,8 @@ class="notebook_app"