##// END OF EJS Templates
simplify NotebookList.duplicate with recent changes...
Min RK -
Show More
@@ -307,7 +307,6 b' define(['
307 $.ajax(url, settings);
307 $.ajax(url, settings);
308 return false;
308 return false;
309 });
309 });
310 // var new_buttons = item.find('a'); // shutdown_button;
311 item.find(".item_buttons").append(shutdown_button);
310 item.find(".item_buttons").append(shutdown_button);
312 };
311 };
313
312
@@ -317,11 +316,8 b' define(['
317 click(function (e) {
316 click(function (e) {
318 // $(this) is the button that was clicked.
317 // $(this) is the button that was clicked.
319 var that = $(this);
318 var that = $(this);
320 // We use the nbname and notebook_id from the parent notebook_item element's
319 var name = item.data('name');
321 // data because the outer scopes values change as we iterate through the loop.
320 var path = item.data('path');
322 var parent_item = that.parents('div.list_item');
323 var name = parent_item.data('name');
324 var path = parent_item.data('path');
325 var message = 'Are you sure you want to duplicate ' + name + '?';
321 var message = 'Are you sure you want to duplicate ' + name + '?';
326 var copy_from = {copy_from : path};
322 var copy_from = {copy_from : path};
327 IPython.dialog.modal({
323 IPython.dialog.modal({
@@ -331,22 +327,9 b' define(['
331 Duplicate : {
327 Duplicate : {
332 class: "btn-primary",
328 class: "btn-primary",
333 click: function() {
329 click: function() {
334 var settings = {
330 notebooklist.contents.copy(path, notebooklist.notebook_path).then(function () {
335 processData : false,
331 notebooklist.load_list();
336 cache : false,
332 });
337 type : "POST",
338 dataType : "json",
339 data : JSON.stringify(copy_from),
340 success : function () {
341 notebooklist.load_list();
342 }
343 };
344 var url = utils.url_join_encode(
345 notebooklist.base_url,
346 'api/contents',
347 notebooklist.notebook_path
348 );
349 $.ajax(url, settings);
350 }
333 }
351 },
334 },
352 Cancel : {}
335 Cancel : {}
General Comments 0
You need to be logged in to leave comments. Login now