From cbe3563d8dffc3b681686ee6003bb4016ad92a9c Mon Sep 17 00:00:00 2001 From: "Brian E. Granger" Date: Thu, 18 Aug 2011 20:23:03 -0700 Subject: [PATCH] Save button becomes Rename when the notebook name changes. --- .../frontend/html/notebook/static/js/savewidget.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/IPython/frontend/html/notebook/static/js/savewidget.js b/IPython/frontend/html/notebook/static/js/savewidget.js index 853cc96bd..947f3e8bb 100644 --- a/IPython/frontend/html/notebook/static/js/savewidget.js +++ b/IPython/frontend/html/notebook/static/js/savewidget.js @@ -26,11 +26,12 @@ var IPython = (function (IPython) { SaveWidget.prototype.style = function () { this.element.find('input#notebook_name').addClass('ui-widget ui-widget-content'); + this.element.find('input#notebook_name').attr('tabindex','1'); this.element.find('button#save_notebook').button(); var left_panel_width = $('div#left_panel').outerWidth(); var left_panel_splitter_width = $('div#left_panel_splitter').outerWidth(); $('span#save_widget').css({marginLeft:left_panel_width+left_panel_splitter_width}); - $('input#notebook_name').attr('tabindex','1'); + }; @@ -40,6 +41,9 @@ var IPython = (function (IPython) { IPython.notebook.save_notebook(); that.set_document_title(); }); + this.element.find('input#notebook_name').change(function () { + that.status_rename(); + }); }; @@ -111,6 +115,13 @@ var IPython = (function (IPython) { }; + SaveWidget.prototype.status_rename = function () { + this.element.find('button#save_notebook').button('option', 'label', 'Rename'); + this.element.find('button#save_notebook').button('enable'); + IPython.print_widget.enable(); + }; + + IPython.SaveWidget = SaveWidget; return IPython;