Show More
@@ -87,6 +87,8 b' var IPython = (function (IPython) {' | |||||
87 | this.element.find('#save_checkpoint').click(function () { |
|
87 | this.element.find('#save_checkpoint').click(function () { | |
88 | IPython.notebook.save_checkpoint(); |
|
88 | IPython.notebook.save_checkpoint(); | |
89 | }); |
|
89 | }); | |
|
90 | this.element.find('#restore_checkpoint').click(function () { | |||
|
91 | }); | |||
90 | this.element.find('#download_ipynb').click(function () { |
|
92 | this.element.find('#download_ipynb').click(function () { | |
91 | var notebook_id = IPython.notebook.get_notebook_id(); |
|
93 | var notebook_id = IPython.notebook.get_notebook_id(); | |
92 | var url = that.baseProjectUrl() + 'notebooks/' + |
|
94 | var url = that.baseProjectUrl() + 'notebooks/' + | |
@@ -221,8 +223,34 b' var IPython = (function (IPython) {' | |||||
221 | this.element.find('#keyboard_shortcuts').click(function () { |
|
223 | this.element.find('#keyboard_shortcuts').click(function () { | |
222 | IPython.quick_help.show_keyboard_shortcuts(); |
|
224 | IPython.quick_help.show_keyboard_shortcuts(); | |
223 | }); |
|
225 | }); | |
|
226 | ||||
|
227 | this.update_restore_checkpoint(null); | |||
|
228 | ||||
|
229 | $([IPython.events]).on('checkpoints_listed.Notebook', function (event, data) { | |||
|
230 | that.update_restore_checkpoint(data); | |||
|
231 | }); | |||
|
232 | ||||
|
233 | $([IPython.events]).on('checkpoint_created.Notebook', function (event, data) { | |||
|
234 | that.update_restore_checkpoint(data); | |||
|
235 | }); | |||
224 | }; |
|
236 | }; | |
225 |
|
237 | |||
|
238 | MenuBar.prototype.update_restore_checkpoint = function(checkpoint) { | |||
|
239 | if (!checkpoint) { | |||
|
240 | this.element.find("#restore_checkpoint") | |||
|
241 | .addClass('ui-state-disabled') | |||
|
242 | .off('click') | |||
|
243 | .find('a').text("Revert"); | |||
|
244 | return; | |||
|
245 | }; | |||
|
246 | var d = new Date(checkpoint.last_modified); | |||
|
247 | this.element.find("#restore_checkpoint") | |||
|
248 | .removeClass('ui-state-disabled') | |||
|
249 | .off('click') | |||
|
250 | .click(function () { | |||
|
251 | IPython.notebook.restore_checkpoint_dialog(); | |||
|
252 | }).find('a').html("Revert to: <br/>" + d.format("mmm dd HH:MM:ss")); | |||
|
253 | } | |||
226 |
|
254 | |||
227 | IPython.MenuBar = MenuBar; |
|
255 | IPython.MenuBar = MenuBar; | |
228 |
|
256 |
@@ -1696,10 +1696,13 b' var IPython = (function (IPython) {' | |||||
1696 | }); |
|
1696 | }); | |
1697 |
|
1697 | |||
1698 | } |
|
1698 | } | |
|
1699 | ||||
1699 | // Create the kernel after the notebook is completely loaded to prevent |
|
1700 | // Create the kernel after the notebook is completely loaded to prevent | |
1700 | // code execution upon loading, which is a security risk. |
|
1701 | // code execution upon loading, which is a security risk. | |
1701 | if (! this.read_only) { |
|
1702 | if (! this.read_only) { | |
1702 | this.start_kernel(); |
|
1703 | this.start_kernel(); | |
|
1704 | // load our checkpoint list | |||
|
1705 | IPython.notebook.list_checkpoints(); | |||
1703 | } |
|
1706 | } | |
1704 | $([IPython.events]).trigger('notebook_loaded.Notebook'); |
|
1707 | $([IPython.events]).trigger('notebook_loaded.Notebook'); | |
1705 | }; |
|
1708 | }; |
@@ -59,6 +59,8 b' class="notebook_app"' | |||||
59 | <li id="save_notebook"><a href="#">Save</a></li> |
|
59 | <li id="save_notebook"><a href="#">Save</a></li> | |
60 | <li id="save_checkpoint"><a href="#">Save Checkpoint</a></li> |
|
60 | <li id="save_checkpoint"><a href="#">Save Checkpoint</a></li> | |
61 | <hr/> |
|
61 | <hr/> | |
|
62 | <li id="restore_checkpoint"><a href="#">Revert to Checkpoint</a></li> | |||
|
63 | <hr/> | |||
62 | <li><a href="#">Download as</a> |
|
64 | <li><a href="#">Download as</a> | |
63 | <ul> |
|
65 | <ul> | |
64 | <li id="download_ipynb"><a href="#">IPython (.ipynb)</a></li> |
|
66 | <li id="download_ipynb"><a href="#">IPython (.ipynb)</a></li> |
General Comments 0
You need to be logged in to leave comments.
Login now