Fixing logic for rename behavior.

pull/37/head
Brian E. Granger 15 years ago
parent 8f149a2623
commit 4d15c8b8e5

@ -16,6 +16,7 @@ var IPython = (function (IPython) {
var SaveWidget = function (selector) {
this.selector = selector;
this.notebook_name_re = /[^/\\]+/
this.last_saved_name = '';
if (this.selector !== undefined) {
this.element = $(selector);
this.style();
@ -40,13 +41,23 @@ var IPython = (function (IPython) {
this.element.find('button#save_notebook').click(function () {
IPython.notebook.save_notebook();
that.set_document_title();
that.last_saved_name = that.get_notebook_name();
});
this.element.find('input#notebook_name').change(function () {
that.status_rename();
this.element.find('input#notebook_name').keyup(function () {
that.is_renaming();
});
};
SaveWidget.prototype.is_renaming = function () {
if (this.get_notebook_name() !== this.last_saved_name) {
this.status_rename();
} else {
this.status_save();
};
};
SaveWidget.prototype.get_notebook_name = function () {
return this.element.find('input#notebook_name').attr('value');
}
@ -55,6 +66,7 @@ var IPython = (function (IPython) {
SaveWidget.prototype.set_notebook_name = function (nbname) {
this.element.find('input#notebook_name').attr('value',nbname);
this.set_document_title();
this.last_saved_name = nbname;
}

Loading…
Cancel
Save