Show More
@@ -16,6 +16,7 var IPython = (function (IPython) { | |||||
16 | var SaveWidget = function (selector) { |
|
16 | var SaveWidget = function (selector) { | |
17 | this.selector = selector; |
|
17 | this.selector = selector; | |
18 | this.notebook_name_re = /[^/\\]+/ |
|
18 | this.notebook_name_re = /[^/\\]+/ | |
|
19 | this.last_saved_name = ''; | |||
19 | if (this.selector !== undefined) { |
|
20 | if (this.selector !== undefined) { | |
20 | this.element = $(selector); |
|
21 | this.element = $(selector); | |
21 | this.style(); |
|
22 | this.style(); | |
@@ -40,13 +41,23 var IPython = (function (IPython) { | |||||
40 | this.element.find('button#save_notebook').click(function () { |
|
41 | this.element.find('button#save_notebook').click(function () { | |
41 | IPython.notebook.save_notebook(); |
|
42 | IPython.notebook.save_notebook(); | |
42 | that.set_document_title(); |
|
43 | that.set_document_title(); | |
|
44 | that.last_saved_name = that.get_notebook_name(); | |||
43 | }); |
|
45 | }); | |
44 |
this.element.find('input#notebook_name'). |
|
46 | this.element.find('input#notebook_name').keyup(function () { | |
45 |
that. |
|
47 | that.is_renaming(); | |
46 | }); |
|
48 | }); | |
47 | }; |
|
49 | }; | |
48 |
|
50 | |||
49 |
|
51 | |||
|
52 | SaveWidget.prototype.is_renaming = function () { | |||
|
53 | if (this.get_notebook_name() !== this.last_saved_name) { | |||
|
54 | this.status_rename(); | |||
|
55 | } else { | |||
|
56 | this.status_save(); | |||
|
57 | }; | |||
|
58 | }; | |||
|
59 | ||||
|
60 | ||||
50 | SaveWidget.prototype.get_notebook_name = function () { |
|
61 | SaveWidget.prototype.get_notebook_name = function () { | |
51 | return this.element.find('input#notebook_name').attr('value'); |
|
62 | return this.element.find('input#notebook_name').attr('value'); | |
52 | } |
|
63 | } | |
@@ -55,6 +66,7 var IPython = (function (IPython) { | |||||
55 | SaveWidget.prototype.set_notebook_name = function (nbname) { |
|
66 | SaveWidget.prototype.set_notebook_name = function (nbname) { | |
56 | this.element.find('input#notebook_name').attr('value',nbname); |
|
67 | this.element.find('input#notebook_name').attr('value',nbname); | |
57 | this.set_document_title(); |
|
68 | this.set_document_title(); | |
|
69 | this.last_saved_name = nbname; | |||
58 | } |
|
70 | } | |
59 |
|
71 | |||
60 |
|
72 |
General Comments 0
You need to be logged in to leave comments.
Login now