diff --git a/IPython/html/static/edit/js/main.js b/IPython/html/static/edit/js/main.js index 7c839a8..dc92426 100644 --- a/IPython/html/static/edit/js/main.js +++ b/IPython/html/static/edit/js/main.js @@ -44,15 +44,16 @@ require([ // Make it available for debugging IPython.editor = editor; - var menus = new menubar.MenuBar('#menubar', { - base_url: base_url, + var save_widget = new savewidget.SaveWidget('span#save_widget', { editor: editor, events: events, }); - var save_widget = new savewidget.SaveWidget('span#save_widget', { + var menus = new menubar.MenuBar('#menubar', { + base_url: base_url, editor: editor, events: events, + save_widget: save_widget, }); var notification_area = new notificationarea.EditorNotificationArea( diff --git a/IPython/html/static/edit/js/menubar.js b/IPython/html/static/edit/js/menubar.js index 2ac7060..09c4c73 100644 --- a/IPython/html/static/edit/js/menubar.js +++ b/IPython/html/static/edit/js/menubar.js @@ -31,11 +31,13 @@ define([ this.selector = selector; this.editor = options.editor; this.events = options.events; + this.save_widget = options.save_widget; if (this.selector !== undefined) { this.element = $(selector); this.bind_events(); } + Object.seal(this); }; MenuBar.prototype.bind_events = function () { @@ -66,6 +68,9 @@ define([ this.element.find('#save-file').click(function () { editor.save(); }); + this.element.find('#rename-file').click(function () { + that.save_widget.rename(); + }); // Edit this.element.find('#menu-find').click(function () { diff --git a/IPython/html/static/edit/js/savewidget.js b/IPython/html/static/edit/js/savewidget.js index 89069c5..5688780 100644 --- a/IPython/html/static/edit/js/savewidget.js +++ b/IPython/html/static/edit/js/savewidget.js @@ -28,7 +28,7 @@ define([ SaveWidget.prototype.bind_events = function () { var that = this; this.element.find('span.filename').click(function () { - that.rename({editor: that.editor}); + that.rename(); }); this.events.on('file_loaded.Editor', function (evt, model) { that.update_filename(model.name); @@ -61,7 +61,7 @@ define([ $("
") ).append( $('').attr('type','text').attr('size','25').addClass('form-control') - .val(options.editor.get_filename()) + .val(that.editor.get_filename()) ); var d = dialog.modal({ title: "Rename File", diff --git a/IPython/html/templates/edit.html b/IPython/html/templates/edit.html index e80fc8c..12542c6 100644 --- a/IPython/html/templates/edit.html +++ b/IPython/html/templates/edit.html @@ -43,6 +43,7 @@ data-file-path="{{file_path}}"