##// END OF EJS Templates
add 'No Checkpoints' to Revert menu...
MinRK -
Show More
@@ -233,27 +233,35 b' var IPython = (function (IPython) {'
233 };
233 };
234
234
235 MenuBar.prototype.update_restore_checkpoint = function(checkpoints) {
235 MenuBar.prototype.update_restore_checkpoint = function(checkpoints) {
236 if (! checkpoints) {
236 var ul = this.element.find("#restore_checkpoint").find("ul");
237 checkpoints = [];
237 ul.empty();
238 if (! checkpoints || checkpoints.length == 0) {
239 ul.append(
240 $("<li/>")
241 .addClass("disabled")
242 .append(
243 $("<a/>")
244 .attr("href", "#")
245 .text("No checkpoints")
246 )
247 );
248 return;
238 };
249 };
239 this.element.find("#restore_checkpoint").find("ul").find("li").each(function(i) {
250 console.log("checkpoints!", checkpoints);
240 var li = $(this);
251 for (var i = 0; i < checkpoints.length; i++) {
241 var a = li.find("a");
242 a.off("click");
243 if (checkpoints.length <= i) {
244 li.hide();
245 return;
246 } else {
247 li.show();
248 };
249 var checkpoint = checkpoints[i];
252 var checkpoint = checkpoints[i];
250 var d = new Date(checkpoint.last_modified);
253 var d = new Date(checkpoint.last_modified);
251 li.find('a').text(
254 ul.append(
252 d.format("mmm dd HH:MM:ss")
255 $("<li/>").append(
253 ).click(function () {
256 $("<a/>")
254 IPython.notebook.restore_checkpoint_dialog(checkpoint);
257 .attr("href", "#")
255 });
258 .text(d.format("mmm dd HH:MM:ss"))
256 });
259 .click(function () {
260 IPython.notebook.restore_checkpoint_dialog(checkpoint);
261 })
262 )
263 );
264 };
257 };
265 };
258
266
259 IPython.MenuBar = MenuBar;
267 IPython.MenuBar = MenuBar;
General Comments 0
You need to be logged in to leave comments. Login now