@@ -60,6 +60,7 @@ var IPython = (function (IPython) {
6060 IPython . notebook . select ( i ) ;
6161 }
6262 } ) ;
63+ this . element . find ( "#restore_checkpoint" ) . find ( "ul" ) . find ( "li" ) . hide ( ) ;
6364 } ;
6465
6566
@@ -228,26 +229,33 @@ var IPython = (function (IPython) {
228229 } ) ;
229230
230231 $ ( [ IPython . events ] ) . on ( 'checkpoint_created.Notebook' , function ( event , data ) {
231- that . update_restore_checkpoint ( data ) ;
232+ that . update_restore_checkpoint ( [ data ] ) ;
232233 } ) ;
233234 } ;
234235
235- MenuBar . prototype . update_restore_checkpoint = function ( checkpoint ) {
236- if ( ! checkpoint ) {
237- this . element . find ( "#restore_checkpoint" )
238- . addClass ( 'ui-state-disabled' )
239- . off ( 'click' )
240- . find ( 'a' ) . text ( "Revert" ) ;
241- return ;
236+ MenuBar . prototype . update_restore_checkpoint = function ( checkpoints ) {
237+ if ( ! checkpoints ) {
238+ checkpoints = [ ] ;
242239 } ;
243- var d = new Date ( checkpoint . last_modified ) ;
244- this . element . find ( "#restore_checkpoint" )
245- . removeClass ( 'ui-state-disabled' )
246- . off ( 'click' )
247- . click ( function ( ) {
248- IPython . notebook . restore_checkpoint_dialog ( ) ;
249- } ) . find ( 'a' ) . html ( "Revert to: <br/>" + d . format ( "mmm dd HH:MM:ss" ) ) ;
250- }
240+ this . element . find ( "#restore_checkpoint" ) . find ( "ul" ) . find ( "li" ) . each ( function ( i ) {
241+ var li = $ ( this ) ;
242+ var a = li . find ( "a" ) ;
243+ a . off ( "click" ) ;
244+ if ( checkpoints . length <= i ) {
245+ li . hide ( ) ;
246+ return ;
247+ } else {
248+ li . show ( ) ;
249+ } ;
250+ var checkpoint = checkpoints [ i ] ;
251+ var d = new Date ( checkpoint . last_modified ) ;
252+ li . find ( 'a' ) . text (
253+ d . format ( "mmm dd HH:MM:ss" )
254+ ) . click ( function ( ) {
255+ IPython . notebook . restore_checkpoint_dialog ( checkpoint ) ;
256+ } ) ;
257+ } ) ;
258+ } ;
251259
252260 IPython . MenuBar = MenuBar ;
253261
0 commit comments