##// END OF EJS Templates
fix rename issues in dashboard...
Mathieu -
Show More
@@ -438,8 +438,8 b' define(['
438 438 });
439 439 this.selected = selected;
440 440
441 // Rename is only visible when one item is selected.
442 if (selected.length==1) {
441 // Rename is only visible when one item is selected, and it is not a running notebook
442 if (selected.length==1 && !has_running_notebook) {
443 443 $('.rename-button').css('display', 'inline-block');
444 444 } else {
445 445 $('.rename-button').css('display', 'none');
@@ -586,29 +586,32 b' define(['
586 586 if (this.selected.length != 1) return;
587 587
588 588 var that = this;
589 var path = this.selected[0].path;
589 var item_path = this.selected[0].path;
590 var item_name = this.selected[0].name;
591 var item_type = this.selected[0].type;
592 console.log(this.selected[0]);
590 593 var input = $('<input/>').attr('type','text').attr('size','25').addClass('form-control')
591 .val(path);
594 .val(item_name);
592 595 var dialog_body = $('<div/>').append(
593 596 $("<p/>").addClass("rename-message")
594 .text('Enter a new directory name:')
597 .text('Enter a new '+ item_type + ' name:')
595 598 ).append(
596 599 $("<br/>")
597 600 ).append(input);
598 601 var d = dialog.modal({
599 title : "Rename directory",
602 title : "Rename "+ item_type,
600 603 body : dialog_body,
601 604 buttons : {
602 605 OK : {
603 606 class: "btn-primary",
604 607 click: function() {
605 that.contents.rename(path, input.val()).then(function() {
608 that.contents.rename(item_path, utils.url_path_join(that.notebook_path, input.val())).then(function() {
606 609 that.load_list();
607 610 }).catch(function(e) {
608 611 dialog.modal({
609 612 title: "Rename Failed",
610 613 body: $('<div/>')
611 .text("An error occurred while renaming \"" + path + "\" to \"" + input.val() + "\".")
614 .text("An error occurred while renaming \"" + item_name + "\" to \"" + input.val() + "\".")
612 615 .append($('<div/>')
613 616 .addClass('alert alert-danger')
614 617 .text(e.message || e)),
General Comments 0
You need to be logged in to leave comments. Login now