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