Show More
@@ -138,11 +138,11 class IPythonHandler(AuthenticatedHandler): | |||
|
138 | 138 | return self.settings.get('websocket_url', '') |
|
139 | 139 | |
|
140 | 140 | @property |
|
141 |
def content |
|
|
142 |
self.log.debug("Using content |
|
|
143 |
'base/js/content |
|
|
144 |
return self.settings.get('content |
|
|
145 |
'base/js/content |
|
|
141 | def contents_js_source(self): | |
|
142 | self.log.debug("Using contents: %s", self.settings.get('contents_js_source', | |
|
143 | 'base/js/contents')) | |
|
144 | return self.settings.get('contents_js_source', | |
|
145 | 'base/js/contents') | |
|
146 | 146 | |
|
147 | 147 | #--------------------------------------------------------------- |
|
148 | 148 | # Manager objects |
@@ -232,7 +232,7 class IPythonHandler(AuthenticatedHandler): | |||
|
232 | 232 | login_available=self.login_available, |
|
233 | 233 | static_url=self.static_url, |
|
234 | 234 | sys_info=sys_info, |
|
235 |
content |
|
|
235 | contents_js_source=self.contents_js_source, | |
|
236 | 236 | ) |
|
237 | 237 | |
|
238 | 238 | def get_json_body(self): |
@@ -7,10 +7,10 define([ | |||
|
7 | 7 | 'base/js/utils', |
|
8 | 8 | 'base/js/dialog', |
|
9 | 9 | ], function(IPython, $, utils, dialog) { |
|
10 |
var Content |
|
|
10 | var Contents = function(options) { | |
|
11 | 11 | // Constructor |
|
12 | 12 | // |
|
13 |
// A content |
|
|
13 | // A contents handles passing file operations | |
|
14 | 14 | // to the back-end. This includes checkpointing |
|
15 | 15 | // with the normal file operations. |
|
16 | 16 | // |
@@ -40,7 +40,7 define([ | |||
|
40 | 40 | * @param {Function} success_callback |
|
41 | 41 | * @param {Function} error_callback |
|
42 | 42 | */ |
|
43 |
Content |
|
|
43 | Contents.prototype.load_notebook = function (path, name, success_callback, | |
|
44 | 44 | error_callback) { |
|
45 | 45 | // We do the call with settings so we can set cache to false. |
|
46 | 46 | var settings = { |
@@ -69,7 +69,7 define([ | |||
|
69 | 69 | * @method scroll_to_cell |
|
70 | 70 | * @param {String} path The path to create the new notebook at |
|
71 | 71 | */ |
|
72 |
Content |
|
|
72 | Contents.prototype.new_notebook = function(path) { | |
|
73 | 73 | var base_url = this.base_url; |
|
74 | 74 | var settings = { |
|
75 | 75 | processData : false, |
@@ -112,14 +112,14 define([ | |||
|
112 | 112 | $.ajax(url,settings); |
|
113 | 113 | }; |
|
114 | 114 | |
|
115 |
Content |
|
|
115 | Contents.prototype.delete_notebook = function(name, path) { | |
|
116 | 116 | var settings = { |
|
117 | 117 | processData : false, |
|
118 | 118 | cache : false, |
|
119 | 119 | type : "DELETE", |
|
120 | 120 | dataType : "json", |
|
121 | 121 | success : $.proxy(this.events.trigger, this.events, |
|
122 |
'notebook_deleted.Content |
|
|
122 | 'notebook_deleted.Contents', | |
|
123 | 123 | { |
|
124 | 124 | name: name, |
|
125 | 125 | path: path |
@@ -135,7 +135,7 define([ | |||
|
135 | 135 | $.ajax(url, settings); |
|
136 | 136 | }; |
|
137 | 137 | |
|
138 |
Content |
|
|
138 | Contents.prototype.rename_notebook = function(path, name, new_name) { | |
|
139 | 139 | var that = this; |
|
140 | 140 | var data = {name: new_name}; |
|
141 | 141 | var settings = { |
@@ -146,11 +146,11 define([ | |||
|
146 | 146 | dataType: "json", |
|
147 | 147 | contentType: 'application/json', |
|
148 | 148 | success : function (json, status, xhr) { |
|
149 |
that.events.trigger('notebook_rename_success.Content |
|
|
149 | that.events.trigger('notebook_rename_success.Contents', | |
|
150 | 150 | json); |
|
151 | 151 | }, |
|
152 | 152 | error : function (xhr, status, error) { |
|
153 |
that.events.trigger('notebook_rename_error.Content |
|
|
153 | that.events.trigger('notebook_rename_error.Contents', | |
|
154 | 154 | [xhr, status, error]); |
|
155 | 155 | } |
|
156 | 156 | }; |
@@ -163,7 +163,7 define([ | |||
|
163 | 163 | $.ajax(url, settings); |
|
164 | 164 | }; |
|
165 | 165 | |
|
166 |
Content |
|
|
166 | Contents.prototype.save_notebook = function(path, name, content, | |
|
167 | 167 | extra_settings) { |
|
168 | 168 | var that = content; |
|
169 | 169 | // Create a JSON model to be sent to the server. |
@@ -183,10 +183,10 define([ | |||
|
183 | 183 | data : JSON.stringify(model), |
|
184 | 184 | contentType: 'application/json', |
|
185 | 185 | success : $.proxy(this.events.trigger, this.events, |
|
186 |
'notebook_save_success.Content |
|
|
186 | 'notebook_save_success.Contents', | |
|
187 | 187 | $.extend(model, { start : start })), |
|
188 | 188 | error : function (xhr, status, error) { |
|
189 |
that.events.trigger('notebook_save_error.Content |
|
|
189 | that.events.trigger('notebook_save_error.Contents', | |
|
190 | 190 | [xhr, status, error, model]); |
|
191 | 191 | } |
|
192 | 192 | }; |
@@ -208,11 +208,11 define([ | |||
|
208 | 208 | * Checkpointing Functions |
|
209 | 209 | */ |
|
210 | 210 | |
|
211 |
Content |
|
|
211 | Contents.prototype.save_checkpoint = function() { | |
|
212 | 212 | // This is not necessary - integrated into save |
|
213 | 213 | }; |
|
214 | 214 | |
|
215 |
Content |
|
|
215 | Contents.prototype.restore_checkpoint = function(notebook, id) { | |
|
216 | 216 | that = notebook; |
|
217 | 217 | this.events.trigger('notebook_restoring.Notebook', checkpoint); |
|
218 | 218 | var url = utils.url_join_encode( |
@@ -230,7 +230,7 define([ | |||
|
230 | 230 | ); |
|
231 | 231 | }; |
|
232 | 232 | |
|
233 |
Content |
|
|
233 | Contents.prototype.list_checkpoints = function(notebook) { | |
|
234 | 234 | that = notebook; |
|
235 | 235 | var url = utils.url_join_encode( |
|
236 | 236 | that.base_url, |
@@ -266,7 +266,7 define([ | |||
|
266 | 266 | * @param {Function} load_callback called with list of notebooks on success |
|
267 | 267 | * @param {Function} error_callback called with ajax results on error |
|
268 | 268 | */ |
|
269 |
Content |
|
|
269 | Contents.prototype.list_contents = function(path, load_callback, | |
|
270 | 270 | error_callback) { |
|
271 | 271 | var that = this; |
|
272 | 272 | var settings = { |
@@ -284,7 +284,7 define([ | |||
|
284 | 284 | } |
|
285 | 285 | |
|
286 | 286 | |
|
287 |
IPython.Content |
|
|
287 | IPython.Contents = Contents; | |
|
288 | 288 | |
|
289 |
return {'Content |
|
|
289 | return {'Contents': Contents}; | |
|
290 | 290 | }); |
@@ -5,7 +5,7 require([ | |||
|
5 | 5 | 'base/js/namespace', |
|
6 | 6 | 'jquery', |
|
7 | 7 | 'notebook/js/notebook', |
|
8 |
'content |
|
|
8 | 'contents', | |
|
9 | 9 | 'base/js/utils', |
|
10 | 10 | 'base/js/page', |
|
11 | 11 | 'notebook/js/layoutmanager', |
@@ -28,7 +28,7 require([ | |||
|
28 | 28 | IPython, |
|
29 | 29 | $, |
|
30 | 30 | notebook, |
|
31 |
content |
|
|
31 | contents, | |
|
32 | 32 | utils, |
|
33 | 33 | page, |
|
34 | 34 | layoutmanager, |
@@ -72,14 +72,14 require([ | |||
|
72 | 72 | var save_widget = new savewidget.SaveWidget('span#save_widget', { |
|
73 | 73 | events: events, |
|
74 | 74 | keyboard_manager: keyboard_manager}); |
|
75 |
var content |
|
|
75 | var contents = new contents.Contents($.extend({ | |
|
76 | 76 | events: events}, |
|
77 | 77 | common_options)); |
|
78 | 78 | var notebook = new notebook.Notebook('div#notebook', $.extend({ |
|
79 | 79 | events: events, |
|
80 | 80 | keyboard_manager: keyboard_manager, |
|
81 | 81 | save_widget: save_widget, |
|
82 |
content |
|
|
82 | contents: contents, | |
|
83 | 83 | config: user_config}, |
|
84 | 84 | common_options)); |
|
85 | 85 | var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options); |
@@ -92,7 +92,7 require([ | |||
|
92 | 92 | notebook: notebook}); |
|
93 | 93 | var menubar = new menubar.MenuBar('#menubar', $.extend({ |
|
94 | 94 | notebook: notebook, |
|
95 |
content |
|
|
95 | contents: contents, | |
|
96 | 96 | layout_manager: layout_manager, |
|
97 | 97 | events: events, |
|
98 | 98 | save_widget: save_widget, |
@@ -138,7 +138,7 require([ | |||
|
138 | 138 | IPython.page = page; |
|
139 | 139 | IPython.layout_manager = layout_manager; |
|
140 | 140 | IPython.notebook = notebook; |
|
141 |
IPython.content |
|
|
141 | IPython.contents = contents; | |
|
142 | 142 | IPython.pager = pager; |
|
143 | 143 | IPython.quick_help = quick_help; |
|
144 | 144 | IPython.login_widget = login_widget; |
@@ -21,7 +21,7 define([ | |||
|
21 | 21 | // options: dictionary |
|
22 | 22 | // Dictionary of keyword arguments. |
|
23 | 23 | // notebook: Notebook instance |
|
24 |
// content |
|
|
24 | // contents: ContentManager instance | |
|
25 | 25 | // layout_manager: LayoutManager instance |
|
26 | 26 | // events: $(Events) instance |
|
27 | 27 | // save_widget: SaveWidget instance |
@@ -33,7 +33,7 define([ | |||
|
33 | 33 | this.base_url = options.base_url || utils.get_body_data("baseUrl"); |
|
34 | 34 | this.selector = selector; |
|
35 | 35 | this.notebook = options.notebook; |
|
36 |
this.content |
|
|
36 | this.contents = options.contents; | |
|
37 | 37 | this.layout_manager = options.layout_manager; |
|
38 | 38 | this.events = options.events; |
|
39 | 39 | this.save_widget = options.save_widget; |
@@ -89,7 +89,7 define([ | |||
|
89 | 89 | this.element.find('#new_notebook').click(function () { |
|
90 | 90 | // Create a new notebook in the same path as the current |
|
91 | 91 | // notebook's path. |
|
92 |
that.content |
|
|
92 | that.contents.new_notebook(that.notebook.notebook_path); | |
|
93 | 93 | }); |
|
94 | 94 | this.element.find('#open_notebook').click(function () { |
|
95 | 95 | window.open(utils.url_join_encode( |
@@ -50,7 +50,7 define([ | |||
|
50 | 50 | // Dictionary of keyword arguments. |
|
51 | 51 | // events: $(Events) instance |
|
52 | 52 | // keyboard_manager: KeyboardManager instance |
|
53 |
// content |
|
|
53 | // contents: Contents instance | |
|
54 | 54 | // save_widget: SaveWidget instance |
|
55 | 55 | // config: dictionary |
|
56 | 56 | // base_url : string |
@@ -62,7 +62,7 define([ | |||
|
62 | 62 | this.notebook_name = options.notebook_name; |
|
63 | 63 | this.events = options.events; |
|
64 | 64 | this.keyboard_manager = options.keyboard_manager; |
|
65 |
this.content |
|
|
65 | this.contents = options.contents; | |
|
66 | 66 | this.save_widget = options.save_widget; |
|
67 | 67 | this.tooltip = new tooltip.Tooltip(this.events); |
|
68 | 68 | this.ws_url = options.ws_url; |
@@ -178,7 +178,7 define([ | |||
|
178 | 178 | Notebook.prototype.bind_events = function () { |
|
179 | 179 | var that = this; |
|
180 | 180 | |
|
181 |
this.content |
|
|
181 | this.contents.events.on('notebook_rename_success.Contents', | |
|
182 | 182 | function (event, data) { |
|
183 | 183 | var name = that.notebook_name = data.name; |
|
184 | 184 | var path = data.path; |
@@ -186,15 +186,15 define([ | |||
|
186 | 186 | that.events.trigger('notebook_renamed.Notebook', data); |
|
187 | 187 | }); |
|
188 | 188 | |
|
189 |
this.content |
|
|
189 | this.contents.events.on('notebook_rename_error.Contents', | |
|
190 | 190 | function (event, data) { |
|
191 | 191 | that.rename_error(data[0], data[1], data[2]); |
|
192 | 192 | }); |
|
193 | 193 | |
|
194 |
this.content |
|
|
194 | this.contents.events.on('notebook_save_success.Contents', | |
|
195 | 195 | $.proxy(this.save_notebook_success, this)); |
|
196 | 196 | |
|
197 |
this.content |
|
|
197 | this.contents.events.on('notebook_save_error.Contents', | |
|
198 | 198 | $.proxy(this.events.trigger, this.events, |
|
199 | 199 | 'notebook_save_failed.Notebook')); |
|
200 | 200 | |
@@ -1929,7 +1929,7 define([ | |||
|
1929 | 1929 | nbformat : this.nbformat, |
|
1930 | 1930 | nbformat_minor : this.nbformat_minor |
|
1931 | 1931 | }) |
|
1932 |
this.content |
|
|
1932 | this.contents.save_notebook(this.notebook_path, | |
|
1933 | 1933 | this.notebook_name, |
|
1934 | 1934 | content, |
|
1935 | 1935 | extra_settings); |
@@ -2092,12 +2092,12 define([ | |||
|
2092 | 2092 | nbname = nbname + ".ipynb"; |
|
2093 | 2093 | } |
|
2094 | 2094 | |
|
2095 |
this.content |
|
|
2095 | this.contents.rename_notebook(this.notebook_path, | |
|
2096 | 2096 | this.notebook_name, nbname); |
|
2097 | 2097 | }; |
|
2098 | 2098 | |
|
2099 | 2099 | Notebook.prototype.delete = function () { |
|
2100 |
this.content |
|
|
2100 | this.contents.delete_notebook(this.notebook_name, | |
|
2101 | 2101 | this.notebook_path); |
|
2102 | 2102 | }; |
|
2103 | 2103 | |
@@ -2142,7 +2142,7 define([ | |||
|
2142 | 2142 | Notebook.prototype.load_notebook = function (notebook_name, notebook_path) { |
|
2143 | 2143 | this.notebook_name = notebook_name; |
|
2144 | 2144 | this.notebook_path = notebook_path; |
|
2145 |
this.content |
|
|
2145 | this.contents.load_notebook( | |
|
2146 | 2146 | notebook_path, |
|
2147 | 2147 | notebook_name, |
|
2148 | 2148 | $.proxy(this.load_notebook_success,this), |
@@ -7,7 +7,7 require([ | |||
|
7 | 7 | 'base/js/events', |
|
8 | 8 | 'base/js/page', |
|
9 | 9 | 'base/js/utils', |
|
10 |
'content |
|
|
10 | 'contents', | |
|
11 | 11 | 'tree/js/notebooklist', |
|
12 | 12 | 'tree/js/clusterlist', |
|
13 | 13 | 'tree/js/sessionlist', |
@@ -24,7 +24,7 require([ | |||
|
24 | 24 | events, |
|
25 | 25 | page, |
|
26 | 26 | utils, |
|
27 |
content |
|
|
27 | contents, | |
|
28 | 28 | notebooklist, |
|
29 | 29 | clusterlist, |
|
30 | 30 | sesssionlist, |
@@ -41,11 +41,11 require([ | |||
|
41 | 41 | session_list = new sesssionlist.SesssionList($.extend({ |
|
42 | 42 | events: events}, |
|
43 | 43 | common_options)); |
|
44 |
content |
|
|
44 | contents = new contents.Contents($.extend({ | |
|
45 | 45 | events: events}, |
|
46 | 46 | common_options)); |
|
47 | 47 | notebook_list = new notebooklist.NotebookList('#notebook_list', $.extend({ |
|
48 |
content |
|
|
48 | contents: contents, | |
|
49 | 49 | session_list: session_list}, |
|
50 | 50 | common_options)); |
|
51 | 51 | cluster_list = new clusterlist.ClusterList('#cluster_list', common_options); |
@@ -60,7 +60,7 require([ | |||
|
60 | 60 | login_widget = new loginwidget.LoginWidget('#login_widget', common_options); |
|
61 | 61 | |
|
62 | 62 | $('#new_notebook').button().click(function (e) { |
|
63 |
content |
|
|
63 | contents.new_notebook(common_options.notebook_path); | |
|
64 | 64 | }); |
|
65 | 65 | |
|
66 | 66 | var interval_id=0; |
@@ -127,7 +127,7 require([ | |||
|
127 | 127 | |
|
128 | 128 | // For backwards compatability. |
|
129 | 129 | IPython.page = page; |
|
130 |
IPython.content |
|
|
130 | IPython.contents = contents; | |
|
131 | 131 | IPython.notebook_list = notebook_list; |
|
132 | 132 | IPython.cluster_list = cluster_list; |
|
133 | 133 | IPython.session_list = session_list; |
@@ -20,7 +20,7 define([ | |||
|
20 | 20 | // element_name: string |
|
21 | 21 | // base_url: string |
|
22 | 22 | // notebook_path: string |
|
23 |
// content |
|
|
23 | // contents: Contents instance | |
|
24 | 24 | var that = this; |
|
25 | 25 | this.session_list = options.session_list; |
|
26 | 26 | // allow code re-use by just changing element_name in kernellist.js |
@@ -35,15 +35,15 define([ | |||
|
35 | 35 | this.sessions = {}; |
|
36 | 36 | this.base_url = options.base_url || utils.get_body_data("baseUrl"); |
|
37 | 37 | this.notebook_path = options.notebook_path || utils.get_body_data("notebookPath"); |
|
38 |
this.content |
|
|
38 | this.contents = options.contents; | |
|
39 | 39 | if (this.session_list && this.session_list.events) { |
|
40 | 40 | this.session_list.events.on('sessions_loaded.Dashboard', |
|
41 | 41 | function(e, d) { that.sessions_loaded(d); }); |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | |
|
45 |
if (this.content |
|
|
46 |
this.content |
|
|
45 | if (this.contents && this.contents.events) { | |
|
46 | this.contents.events.on('notebook_deleted.Contents', | |
|
47 | 47 | function(e, d) { |
|
48 | 48 | // Remove the deleted notebook. |
|
49 | 49 | $( ":data(nbname)" ).each(function() { |
@@ -157,7 +157,7 define([ | |||
|
157 | 157 | |
|
158 | 158 | NotebookList.prototype.load_list = function () { |
|
159 | 159 | var that = this |
|
160 |
this.content |
|
|
160 | this.contents.list_contents( | |
|
161 | 161 | that.notebook_path, |
|
162 | 162 | $.proxy(that.draw_notebook_list, that), |
|
163 | 163 | $.proxy( function(xhr, status, error) { |
@@ -347,7 +347,7 define([ | |||
|
347 | 347 | Delete : { |
|
348 | 348 | class: "btn-danger", |
|
349 | 349 | click: function() { |
|
350 |
notebooklist.content |
|
|
350 | notebooklist.contents.delete_notebook(nbname, path); | |
|
351 | 351 | } |
|
352 | 352 | }, |
|
353 | 353 | Cancel : {} |
General Comments 0
You need to be logged in to leave comments.
Login now