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