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