Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixing logic for rename behavior.

  • Loading branch information...
commit 6d3001f6fedc53fb4e6f547d87f3ef4c5a02d976 1 parent 1e2b197
@ellisonbg ellisonbg authored
Showing with 14 additions and 2 deletions.
  1. +14 −2 IPython/frontend/html/notebook/static/js/savewidget.js
View
16 IPython/frontend/html/notebook/static/js/savewidget.js
@@ -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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.