Show More
@@ -44,15 +44,16 b' require([' | |||||
44 | // Make it available for debugging |
|
44 | // Make it available for debugging | |
45 | IPython.editor = editor; |
|
45 | IPython.editor = editor; | |
46 |
|
46 | |||
47 | var menus = new menubar.MenuBar('#menubar', { |
|
47 | var save_widget = new savewidget.SaveWidget('span#save_widget', { | |
48 | base_url: base_url, |
|
|||
49 | editor: editor, |
|
48 | editor: editor, | |
50 | events: events, |
|
49 | events: events, | |
51 | }); |
|
50 | }); | |
52 |
|
51 | |||
53 | var save_widget = new savewidget.SaveWidget('span#save_widget', { |
|
52 | var menus = new menubar.MenuBar('#menubar', { | |
|
53 | base_url: base_url, | |||
54 | editor: editor, |
|
54 | editor: editor, | |
55 | events: events, |
|
55 | events: events, | |
|
56 | save_widget: save_widget, | |||
56 | }); |
|
57 | }); | |
57 |
|
58 | |||
58 | var notification_area = new notificationarea.EditorNotificationArea( |
|
59 | var notification_area = new notificationarea.EditorNotificationArea( |
@@ -31,11 +31,13 b' define([' | |||||
31 | this.selector = selector; |
|
31 | this.selector = selector; | |
32 | this.editor = options.editor; |
|
32 | this.editor = options.editor; | |
33 | this.events = options.events; |
|
33 | this.events = options.events; | |
|
34 | this.save_widget = options.save_widget; | |||
34 |
|
35 | |||
35 | if (this.selector !== undefined) { |
|
36 | if (this.selector !== undefined) { | |
36 | this.element = $(selector); |
|
37 | this.element = $(selector); | |
37 | this.bind_events(); |
|
38 | this.bind_events(); | |
38 | } |
|
39 | } | |
|
40 | Object.seal(this); | |||
39 | }; |
|
41 | }; | |
40 |
|
42 | |||
41 | MenuBar.prototype.bind_events = function () { |
|
43 | MenuBar.prototype.bind_events = function () { | |
@@ -66,6 +68,9 b' define([' | |||||
66 | this.element.find('#save-file').click(function () { |
|
68 | this.element.find('#save-file').click(function () { | |
67 | editor.save(); |
|
69 | editor.save(); | |
68 | }); |
|
70 | }); | |
|
71 | this.element.find('#rename-file').click(function () { | |||
|
72 | that.save_widget.rename(); | |||
|
73 | }); | |||
69 |
|
74 | |||
70 | // Edit |
|
75 | // Edit | |
71 | this.element.find('#menu-find').click(function () { |
|
76 | this.element.find('#menu-find').click(function () { |
@@ -28,7 +28,7 b' define([' | |||||
28 | SaveWidget.prototype.bind_events = function () { |
|
28 | SaveWidget.prototype.bind_events = function () { | |
29 | var that = this; |
|
29 | var that = this; | |
30 | this.element.find('span.filename').click(function () { |
|
30 | this.element.find('span.filename').click(function () { | |
31 |
that.rename( |
|
31 | that.rename(); | |
32 | }); |
|
32 | }); | |
33 | this.events.on('file_loaded.Editor', function (evt, model) { |
|
33 | this.events.on('file_loaded.Editor', function (evt, model) { | |
34 | that.update_filename(model.name); |
|
34 | that.update_filename(model.name); | |
@@ -61,7 +61,7 b' define([' | |||||
61 | $("<br/>") |
|
61 | $("<br/>") | |
62 | ).append( |
|
62 | ).append( | |
63 | $('<input/>').attr('type','text').attr('size','25').addClass('form-control') |
|
63 | $('<input/>').attr('type','text').attr('size','25').addClass('form-control') | |
64 |
.val( |
|
64 | .val(that.editor.get_filename()) | |
65 | ); |
|
65 | ); | |
66 | var d = dialog.modal({ |
|
66 | var d = dialog.modal({ | |
67 | title: "Rename File", |
|
67 | title: "Rename File", |
@@ -43,6 +43,7 b' data-file-path="{{file_path}}"' | |||||
43 | <ul id="file-menu" class="dropdown-menu"> |
|
43 | <ul id="file-menu" class="dropdown-menu"> | |
44 | <li id="new-file"><a href="#">New</a></li> |
|
44 | <li id="new-file"><a href="#">New</a></li> | |
45 | <li id="save-file"><a href="#">Save</a></li> |
|
45 | <li id="save-file"><a href="#">Save</a></li> | |
|
46 | <li id="rename-file"><a href="#">Rename</a></li> | |||
46 | </ul> |
|
47 | </ul> | |
47 | </li> |
|
48 | </li> | |
48 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a> |
|
49 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a> |
General Comments 0
You need to be logged in to leave comments.
Login now