Show More
@@ -440,8 +440,8 b' 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'); |
@@ -595,29 +595,31 b' define([' | |||
|
595 | 595 | if (this.selected.length != 1) return; |
|
596 | 596 | |
|
597 | 597 | var that = this; |
|
598 | var path = this.selected[0].path; | |
|
598 | var item_path = this.selected[0].path; | |
|
599 | var item_name = this.selected[0].name; | |
|
600 | var item_type = this.selected[0].type; | |
|
599 | 601 | var input = $('<input/>').attr('type','text').attr('size','25').addClass('form-control') |
|
600 |
.val( |
|
|
602 | .val(item_name); | |
|
601 | 603 | var dialog_body = $('<div/>').append( |
|
602 | 604 | $("<p/>").addClass("rename-message") |
|
603 |
.text('Enter a new |
|
|
605 | .text('Enter a new '+ item_type + ' name:') | |
|
604 | 606 | ).append( |
|
605 | 607 | $("<br/>") |
|
606 | 608 | ).append(input); |
|
607 | 609 | var d = dialog.modal({ |
|
608 |
title : "Rename |
|
|
610 | title : "Rename "+ item_type, | |
|
609 | 611 | body : dialog_body, |
|
610 | 612 | buttons : { |
|
611 | 613 | OK : { |
|
612 | 614 | class: "btn-primary", |
|
613 | 615 | click: function() { |
|
614 | that.contents.rename(path, input.val()).then(function() { | |
|
616 | that.contents.rename(item_path, utils.url_path_join(that.notebook_path, input.val())).then(function() { | |
|
615 | 617 | that.load_list(); |
|
616 | 618 | }).catch(function(e) { |
|
617 | 619 | dialog.modal({ |
|
618 | 620 | title: "Rename Failed", |
|
619 | 621 | body: $('<div/>') |
|
620 |
.text("An error occurred while renaming \"" + |
|
|
622 | .text("An error occurred while renaming \"" + item_name + "\" to \"" + input.val() + "\".") | |
|
621 | 623 | .append($('<div/>') |
|
622 | 624 | .addClass('alert alert-danger') |
|
623 | 625 | .text(e.message || e)), |
General Comments 0
You need to be logged in to leave comments.
Login now