Show More
@@ -1,441 +1,441 | |||
|
1 | 1 | //---------------------------------------------------------------------------- |
|
2 | 2 | // Copyright (C) 2011 The IPython Development Team |
|
3 | 3 | // |
|
4 | 4 | // Distributed under the terms of the BSD License. The full license is in |
|
5 | 5 | // the file COPYING, distributed as part of this software. |
|
6 | 6 | //---------------------------------------------------------------------------- |
|
7 | 7 | |
|
8 | 8 | //============================================================================ |
|
9 | 9 | // NotebookList |
|
10 | 10 | //============================================================================ |
|
11 | 11 | |
|
12 | 12 | var IPython = (function (IPython) { |
|
13 | 13 | "use strict"; |
|
14 | 14 | |
|
15 | 15 | var utils = IPython.utils; |
|
16 | 16 | |
|
17 | 17 | var NotebookList = function (selector, options, element_name) { |
|
18 | 18 | var that = this |
|
19 | 19 | // allow code re-use by just changing element_name in kernellist.js |
|
20 | 20 | this.element_name = element_name || 'notebook'; |
|
21 | 21 | this.selector = selector; |
|
22 | 22 | if (this.selector !== undefined) { |
|
23 | 23 | this.element = $(selector); |
|
24 | 24 | this.style(); |
|
25 | 25 | this.bind_events(); |
|
26 | 26 | } |
|
27 | 27 | this.notebooks_list = []; |
|
28 | 28 | this.sessions = {}; |
|
29 | 29 | this.base_url = options.base_url || utils.get_body_data("baseUrl"); |
|
30 | 30 | this.notebook_path = options.notebook_path || utils.get_body_data("notebookPath"); |
|
31 | 31 | $([IPython.events]).on('sessions_loaded.Dashboard', |
|
32 | 32 | function(e, d) { that.sessions_loaded(d); }); |
|
33 | 33 | }; |
|
34 | 34 | |
|
35 | 35 | NotebookList.prototype.style = function () { |
|
36 | 36 | var prefix = '#' + this.element_name |
|
37 | 37 | $(prefix + '_toolbar').addClass('list_toolbar'); |
|
38 | 38 | $(prefix + '_list_info').addClass('toolbar_info'); |
|
39 | 39 | $(prefix + '_buttons').addClass('toolbar_buttons'); |
|
40 | 40 | $(prefix + '_list_header').addClass('list_header'); |
|
41 | 41 | this.element.addClass("list_container"); |
|
42 | 42 | }; |
|
43 | 43 | |
|
44 | 44 | |
|
45 | 45 | NotebookList.prototype.bind_events = function () { |
|
46 | 46 | var that = this; |
|
47 | 47 | $('#refresh_' + this.element_name + '_list').click(function () { |
|
48 | 48 | that.load_sessions(); |
|
49 | 49 | }); |
|
50 | 50 | this.element.bind('dragover', function () { |
|
51 | 51 | return false; |
|
52 | 52 | }); |
|
53 | 53 | this.element.bind('drop', function(event){ |
|
54 | 54 | that.handleFilesUpload(event,'drop'); |
|
55 | 55 | return false; |
|
56 | 56 | }); |
|
57 | 57 | }; |
|
58 | 58 | |
|
59 | 59 | NotebookList.prototype.handleFilesUpload = function(event, dropOrForm) { |
|
60 | 60 | var that = this; |
|
61 | 61 | var files; |
|
62 | 62 | if(dropOrForm =='drop'){ |
|
63 | 63 | files = event.originalEvent.dataTransfer.files; |
|
64 | 64 | } else |
|
65 | 65 | { |
|
66 | 66 | files = event.originalEvent.target.files; |
|
67 | 67 | } |
|
68 | 68 | for (var i = 0; i < files.length; i++) { |
|
69 | 69 | var f = files[i]; |
|
70 | 70 | var reader = new FileReader(); |
|
71 | 71 | reader.readAsText(f); |
|
72 | 72 | var name_and_ext = utils.splitext(f.name); |
|
73 | 73 | var file_ext = name_and_ext[1]; |
|
74 | 74 | if (file_ext === '.ipynb') { |
|
75 | 75 | var item = that.new_notebook_item(0); |
|
76 | 76 | item.addClass('new-file'); |
|
77 | 77 | that.add_name_input(f.name, item); |
|
78 | 78 | // Store the notebook item in the reader so we can use it later |
|
79 | 79 | // to know which item it belongs to. |
|
80 | 80 | $(reader).data('item', item); |
|
81 | 81 | reader.onload = function (event) { |
|
82 | 82 | var nbitem = $(event.target).data('item'); |
|
83 | 83 | that.add_notebook_data(event.target.result, nbitem); |
|
84 | 84 | that.add_upload_button(nbitem); |
|
85 | 85 | }; |
|
86 | 86 | } else { |
|
87 | 87 | var dialog = 'Uploaded notebooks must be .ipynb files'; |
|
88 | 88 | IPython.dialog.modal({ |
|
89 | 89 | title : 'Invalid file type', |
|
90 | 90 | body : dialog, |
|
91 | 91 | buttons : {'OK' : {'class' : 'btn-primary'}} |
|
92 | 92 | }); |
|
93 | 93 | } |
|
94 | 94 | } |
|
95 | 95 | // Replace the file input form wth a clone of itself. This is required to |
|
96 | 96 | // reset the form. Otherwise, if you upload a file, delete it and try to |
|
97 | 97 | // upload it again, the changed event won't fire. |
|
98 | 98 | var form = $('input.fileinput'); |
|
99 | 99 | form.replaceWith(form.clone(true)); |
|
100 | 100 | return false; |
|
101 | 101 | }; |
|
102 | 102 | |
|
103 | 103 | NotebookList.prototype.clear_list = function (remove_uploads) { |
|
104 | 104 | // Clears the navigation tree. |
|
105 | 105 | // |
|
106 | 106 | // Parameters |
|
107 | 107 | // remove_uploads: bool=False |
|
108 | 108 | // Should upload prompts also be removed from the tree. |
|
109 | 109 | if (remove_uploads) { |
|
110 | 110 | this.element.children('.list_item').remove(); |
|
111 | 111 | } else { |
|
112 | 112 | this.element.children('.list_item:not(.new-file)').remove(); |
|
113 | 113 | } |
|
114 | 114 | }; |
|
115 | 115 | |
|
116 | 116 | NotebookList.prototype.load_sessions = function(){ |
|
117 | 117 | IPython.session_list.load_sessions(); |
|
118 | 118 | }; |
|
119 | 119 | |
|
120 | 120 | |
|
121 | 121 | NotebookList.prototype.sessions_loaded = function(data){ |
|
122 | 122 | this.sessions = data; |
|
123 | 123 | this.load_list(); |
|
124 | 124 | }; |
|
125 | 125 | |
|
126 | 126 | NotebookList.prototype.load_list = function () { |
|
127 | 127 | var that = this; |
|
128 | 128 | var settings = { |
|
129 | 129 | processData : false, |
|
130 | 130 | cache : false, |
|
131 | 131 | type : "GET", |
|
132 | 132 | dataType : "json", |
|
133 | 133 | success : $.proxy(this.list_loaded, this), |
|
134 | 134 | error : $.proxy( function(xhr, status, error){ |
|
135 | 135 | utils.log_ajax_error(xhr, status, error); |
|
136 | 136 | that.list_loaded([], null, null, {msg:"Error connecting to server."}); |
|
137 | 137 | },this) |
|
138 | 138 | }; |
|
139 | 139 | |
|
140 | 140 | var url = utils.url_join_encode( |
|
141 | 141 | this.base_url, |
|
142 | 142 | 'api', |
|
143 | 143 | 'notebooks', |
|
144 | 144 | this.notebook_path |
|
145 | 145 | ); |
|
146 | 146 | $.ajax(url, settings); |
|
147 | 147 | }; |
|
148 | 148 | |
|
149 | 149 | |
|
150 | 150 | NotebookList.prototype.list_loaded = function (data, status, xhr, param) { |
|
151 | 151 | var message = 'Notebook list empty.'; |
|
152 | 152 | if (param !== undefined && param.msg) { |
|
153 | 153 | message = param.msg; |
|
154 | 154 | } |
|
155 | 155 | var item = null; |
|
156 | 156 | var len = data.length; |
|
157 | 157 | this.clear_list(); |
|
158 | 158 | if (len === 0) { |
|
159 | 159 | item = this.new_notebook_item(0); |
|
160 | 160 | var span12 = item.children().first(); |
|
161 | 161 | span12.empty(); |
|
162 | 162 | span12.append($('<div style="margin:auto;text-align:center;color:grey"/>').text(message)); |
|
163 | 163 | } |
|
164 | 164 | var path = this.notebook_path; |
|
165 | 165 | var offset = 0; |
|
166 | 166 | if (path !== '') { |
|
167 | 167 | item = this.new_notebook_item(0); |
|
168 | 168 | this.add_dir(path, '..', item); |
|
169 | 169 | offset = 1; |
|
170 | 170 | } |
|
171 | 171 | for (var i=0; i<len; i++) { |
|
172 | 172 | if (data[i].type === 'directory') { |
|
173 | 173 | var name = data[i].name; |
|
174 | 174 | item = this.new_notebook_item(i+offset); |
|
175 | 175 | this.add_dir(path, name, item); |
|
176 | 176 | } else { |
|
177 | 177 | var name = data[i].name; |
|
178 | 178 | item = this.new_notebook_item(i+offset); |
|
179 | 179 | this.add_link(path, name, item); |
|
180 | 180 | name = utils.url_path_join(path, name); |
|
181 | 181 | if(this.sessions[name] === undefined){ |
|
182 | 182 | this.add_delete_button(item); |
|
183 | 183 | } else { |
|
184 | 184 | this.add_shutdown_button(item,this.sessions[name]); |
|
185 | 185 | } |
|
186 | 186 | } |
|
187 | 187 | } |
|
188 | 188 | }; |
|
189 | 189 | |
|
190 | 190 | |
|
191 | 191 | NotebookList.prototype.new_notebook_item = function (index) { |
|
192 | 192 | var item = $('<div/>').addClass("list_item").addClass("row"); |
|
193 | 193 | // item.addClass('list_item ui-widget ui-widget-content ui-helper-clearfix'); |
|
194 | 194 | // item.css('border-top-style','none'); |
|
195 |
item.append($("<div/>").addClass(" |
|
|
195 | item.append($("<div/>").addClass("col-md-12").append( | |
|
196 | 196 | $('<i/>').addClass('item_icon') |
|
197 | 197 | ).append( |
|
198 | 198 | $("<a/>").addClass("item_link").append( |
|
199 | 199 | $("<span/>").addClass("item_name") |
|
200 | 200 | ) |
|
201 | 201 | ).append( |
|
202 | 202 | $('<div/>').addClass("item_buttons btn-group pull-right") |
|
203 | 203 | )); |
|
204 | 204 | |
|
205 | 205 | if (index === -1) { |
|
206 | 206 | this.element.append(item); |
|
207 | 207 | } else { |
|
208 | 208 | this.element.children().eq(index).after(item); |
|
209 | 209 | } |
|
210 | 210 | return item; |
|
211 | 211 | }; |
|
212 | 212 | |
|
213 | 213 | |
|
214 | 214 | NotebookList.prototype.add_dir = function (path, name, item) { |
|
215 | 215 | item.data('name', name); |
|
216 | 216 | item.data('path', path); |
|
217 | 217 | item.find(".item_name").text(name); |
|
218 | 218 | item.find(".item_icon").addClass('folder_icon').addClass('icon-fixed-width'); |
|
219 | 219 | item.find("a.item_link") |
|
220 | 220 | .attr('href', |
|
221 | 221 | utils.url_join_encode( |
|
222 | 222 | this.base_url, |
|
223 | 223 | "tree", |
|
224 | 224 | path, |
|
225 | 225 | name |
|
226 | 226 | ) |
|
227 | 227 | ); |
|
228 | 228 | }; |
|
229 | 229 | |
|
230 | 230 | |
|
231 | 231 | NotebookList.prototype.add_link = function (path, nbname, item) { |
|
232 | 232 | item.data('nbname', nbname); |
|
233 | 233 | item.data('path', path); |
|
234 | 234 | item.find(".item_name").text(nbname); |
|
235 | 235 | item.find(".item_icon").addClass('notebook_icon').addClass('icon-fixed-width'); |
|
236 | 236 | item.find("a.item_link") |
|
237 | 237 | .attr('href', |
|
238 | 238 | utils.url_join_encode( |
|
239 | 239 | this.base_url, |
|
240 | 240 | "notebooks", |
|
241 | 241 | path, |
|
242 | 242 | nbname |
|
243 | 243 | ) |
|
244 | 244 | ).attr('target','_blank'); |
|
245 | 245 | }; |
|
246 | 246 | |
|
247 | 247 | |
|
248 | 248 | NotebookList.prototype.add_name_input = function (nbname, item) { |
|
249 | 249 | item.data('nbname', nbname); |
|
250 | 250 | item.find(".item_icon").addClass('notebook_icon').addClass('icon-fixed-width'); |
|
251 | 251 | item.find(".item_name").empty().append( |
|
252 | 252 | $('<input/>') |
|
253 | 253 | .addClass("nbname_input") |
|
254 | 254 | .attr('value', utils.splitext(nbname)[0]) |
|
255 | 255 | .attr('size', '30') |
|
256 | 256 | .attr('type', 'text') |
|
257 | 257 | ); |
|
258 | 258 | }; |
|
259 | 259 | |
|
260 | 260 | |
|
261 | 261 | NotebookList.prototype.add_notebook_data = function (data, item) { |
|
262 | 262 | item.data('nbdata', data); |
|
263 | 263 | }; |
|
264 | 264 | |
|
265 | 265 | |
|
266 | 266 | NotebookList.prototype.add_shutdown_button = function (item, session) { |
|
267 | 267 | var that = this; |
|
268 | 268 | var shutdown_button = $("<button/>").text("Shutdown").addClass("btn btn-xs btn-danger"). |
|
269 | 269 | click(function (e) { |
|
270 | 270 | var settings = { |
|
271 | 271 | processData : false, |
|
272 | 272 | cache : false, |
|
273 | 273 | type : "DELETE", |
|
274 | 274 | dataType : "json", |
|
275 | 275 | success : function () { |
|
276 | 276 | that.load_sessions(); |
|
277 | 277 | }, |
|
278 | 278 | error : utils.log_ajax_error, |
|
279 | 279 | }; |
|
280 | 280 | var url = utils.url_join_encode( |
|
281 | 281 | that.base_url, |
|
282 | 282 | 'api/sessions', |
|
283 | 283 | session |
|
284 | 284 | ); |
|
285 | 285 | $.ajax(url, settings); |
|
286 | 286 | return false; |
|
287 | 287 | }); |
|
288 | 288 | // var new_buttons = item.find('a'); // shutdown_button; |
|
289 | 289 | item.find(".item_buttons").text("").append(shutdown_button); |
|
290 | 290 | }; |
|
291 | 291 | |
|
292 | 292 | NotebookList.prototype.add_delete_button = function (item) { |
|
293 | 293 | var new_buttons = $('<span/>').addClass("btn-group pull-right"); |
|
294 | 294 | var notebooklist = this; |
|
295 | 295 | var delete_button = $("<button/>").text("Delete").addClass("btn btn-default btn-xs"). |
|
296 | 296 | click(function (e) { |
|
297 | 297 | // $(this) is the button that was clicked. |
|
298 | 298 | var that = $(this); |
|
299 | 299 | // We use the nbname and notebook_id from the parent notebook_item element's |
|
300 | 300 | // data because the outer scopes values change as we iterate through the loop. |
|
301 | 301 | var parent_item = that.parents('div.list_item'); |
|
302 | 302 | var nbname = parent_item.data('nbname'); |
|
303 | 303 | var message = 'Are you sure you want to permanently delete the notebook: ' + nbname + '?'; |
|
304 | 304 | IPython.dialog.modal({ |
|
305 | 305 | title : "Delete notebook", |
|
306 | 306 | body : message, |
|
307 | 307 | buttons : { |
|
308 | 308 | Delete : { |
|
309 | 309 | class: "btn-danger", |
|
310 | 310 | click: function() { |
|
311 | 311 | var settings = { |
|
312 | 312 | processData : false, |
|
313 | 313 | cache : false, |
|
314 | 314 | type : "DELETE", |
|
315 | 315 | dataType : "json", |
|
316 | 316 | success : function (data, status, xhr) { |
|
317 | 317 | parent_item.remove(); |
|
318 | 318 | }, |
|
319 | 319 | error : utils.log_ajax_error, |
|
320 | 320 | }; |
|
321 | 321 | var url = utils.url_join_encode( |
|
322 | 322 | notebooklist.base_url, |
|
323 | 323 | 'api/notebooks', |
|
324 | 324 | notebooklist.notebook_path, |
|
325 | 325 | nbname |
|
326 | 326 | ); |
|
327 | 327 | $.ajax(url, settings); |
|
328 | 328 | } |
|
329 | 329 | }, |
|
330 | 330 | Cancel : {} |
|
331 | 331 | } |
|
332 | 332 | }); |
|
333 | 333 | return false; |
|
334 | 334 | }); |
|
335 | 335 | item.find(".item_buttons").text("").append(delete_button); |
|
336 | 336 | }; |
|
337 | 337 | |
|
338 | 338 | |
|
339 | 339 | NotebookList.prototype.add_upload_button = function (item) { |
|
340 | 340 | var that = this; |
|
341 | 341 | var upload_button = $('<button/>').text("Upload") |
|
342 | 342 | .addClass('btn btn-primary btn-xs upload_button') |
|
343 | 343 | .click(function (e) { |
|
344 | 344 | var nbname = item.find('.item_name > input').val(); |
|
345 | 345 | if (nbname.slice(nbname.length-6, nbname.length) != ".ipynb") { |
|
346 | 346 | nbname = nbname + ".ipynb"; |
|
347 | 347 | } |
|
348 | 348 | var path = that.notebook_path; |
|
349 | 349 | var nbdata = item.data('nbdata'); |
|
350 | 350 | var content_type = 'application/json'; |
|
351 | 351 | var model = { |
|
352 | 352 | content : JSON.parse(nbdata), |
|
353 | 353 | }; |
|
354 | 354 | var settings = { |
|
355 | 355 | processData : false, |
|
356 | 356 | cache : false, |
|
357 | 357 | type : 'PUT', |
|
358 | 358 | dataType : 'json', |
|
359 | 359 | data : JSON.stringify(model), |
|
360 | 360 | headers : {'Content-Type': content_type}, |
|
361 | 361 | success : function (data, status, xhr) { |
|
362 | 362 | that.add_link(path, nbname, item); |
|
363 | 363 | that.add_delete_button(item); |
|
364 | 364 | }, |
|
365 | 365 | error : utils.log_ajax_error, |
|
366 | 366 | }; |
|
367 | 367 | |
|
368 | 368 | var url = utils.url_join_encode( |
|
369 | 369 | that.base_url, |
|
370 | 370 | 'api/notebooks', |
|
371 | 371 | that.notebook_path, |
|
372 | 372 | nbname |
|
373 | 373 | ); |
|
374 | 374 | $.ajax(url, settings); |
|
375 | 375 | return false; |
|
376 | 376 | }); |
|
377 | 377 | var cancel_button = $('<button/>').text("Cancel") |
|
378 | 378 | .addClass("btn btn-default btn-xs") |
|
379 | 379 | .click(function (e) { |
|
380 | 380 | console.log('cancel click'); |
|
381 | 381 | item.remove(); |
|
382 | 382 | return false; |
|
383 | 383 | }); |
|
384 | 384 | item.find(".item_buttons").empty() |
|
385 | 385 | .append(upload_button) |
|
386 | 386 | .append(cancel_button); |
|
387 | 387 | }; |
|
388 | 388 | |
|
389 | 389 | |
|
390 | 390 | NotebookList.prototype.new_notebook = function(){ |
|
391 | 391 | var path = this.notebook_path; |
|
392 | 392 | var base_url = this.base_url; |
|
393 | 393 | var settings = { |
|
394 | 394 | processData : false, |
|
395 | 395 | cache : false, |
|
396 | 396 | type : "POST", |
|
397 | 397 | dataType : "json", |
|
398 | 398 | async : false, |
|
399 | 399 | success : function (data, status, xhr) { |
|
400 | 400 | var notebook_name = data.name; |
|
401 | 401 | window.open( |
|
402 | 402 | utils.url_join_encode( |
|
403 | 403 | base_url, |
|
404 | 404 | 'notebooks', |
|
405 | 405 | path, |
|
406 | 406 | notebook_name), |
|
407 | 407 | '_blank' |
|
408 | 408 | ); |
|
409 | 409 | }, |
|
410 | 410 | error : $.proxy(this.new_notebook_failed, this), |
|
411 | 411 | }; |
|
412 | 412 | var url = utils.url_join_encode( |
|
413 | 413 | base_url, |
|
414 | 414 | 'api/notebooks', |
|
415 | 415 | path |
|
416 | 416 | ); |
|
417 | 417 | $.ajax(url, settings); |
|
418 | 418 | }; |
|
419 | 419 | |
|
420 | 420 | |
|
421 | 421 | NotebookList.prototype.new_notebook_failed = function (xhr, status, error) { |
|
422 | 422 | utils.log_ajax_error(xhr, status, error); |
|
423 | 423 | var msg; |
|
424 | 424 | if (xhr.responseJSON && xhr.responseJSON.message) { |
|
425 | 425 | msg = xhr.responseJSON.message; |
|
426 | 426 | } else { |
|
427 | 427 | msg = xhr.statusText; |
|
428 | 428 | } |
|
429 | 429 | IPython.dialog.modal({ |
|
430 | 430 | title : 'Creating Notebook Failed', |
|
431 | 431 | body : "The error was: " + msg, |
|
432 | 432 | buttons : {'OK' : {'class' : 'btn-primary'}} |
|
433 | 433 | }); |
|
434 | 434 | } |
|
435 | 435 | |
|
436 | 436 | |
|
437 | 437 | IPython.NotebookList = NotebookList; |
|
438 | 438 | |
|
439 | 439 | return IPython; |
|
440 | 440 | |
|
441 | 441 | }(IPython)); |
@@ -1,362 +1,362 | |||
|
1 | 1 | {% extends "page.html" %} |
|
2 | 2 | |
|
3 | 3 | {% block stylesheet %} |
|
4 | 4 | |
|
5 | 5 | {% if mathjax_url %} |
|
6 | 6 | <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script> |
|
7 | 7 | {% endif %} |
|
8 | 8 | <script type="text/javascript"> |
|
9 | 9 | // MathJax disabled, set as null to distingish from *missing* MathJax, |
|
10 | 10 | // where it will be undefined, and should prompt a dialog later. |
|
11 | 11 | window.mathjax_url = "{{mathjax_url}}"; |
|
12 | 12 | </script> |
|
13 | 13 | |
|
14 | 14 | <link rel="stylesheet" href="{{ static_url("components/bootstrap-tour/build/css/bootstrap-tour.min.css") }}" type="text/css" /> |
|
15 | 15 | <link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}"> |
|
16 | 16 | |
|
17 | 17 | {{super()}} |
|
18 | 18 | |
|
19 | 19 | <link rel="stylesheet" href="{{ static_url("notebook/css/override.css") }}" type="text/css" /> |
|
20 | 20 | |
|
21 | 21 | {% endblock %} |
|
22 | 22 | |
|
23 | 23 | {% block params %} |
|
24 | 24 | |
|
25 | 25 | data-project="{{project}}" |
|
26 | 26 | data-base-url="{{base_url}}" |
|
27 | 27 | data-notebook-name="{{notebook_name}}" |
|
28 | 28 | data-notebook-path="{{notebook_path}}" |
|
29 | 29 | class="notebook_app" |
|
30 | 30 | |
|
31 | 31 | {% endblock %} |
|
32 | 32 | |
|
33 | 33 | |
|
34 | 34 | {% block header %} |
|
35 | 35 | |
|
36 | 36 | <span id="save_widget" class="nav pull-left"> |
|
37 | 37 | <span id="notebook_name"></span> |
|
38 | 38 | <span id="checkpoint_status"></span> |
|
39 | 39 | <span id="autosave_status"></span> |
|
40 | 40 | </span> |
|
41 | 41 | |
|
42 | 42 | {% endblock %} |
|
43 | 43 | |
|
44 | 44 | |
|
45 | 45 | {% block site %} |
|
46 | 46 | |
|
47 | 47 | <div id="menubar-container" class="container"> |
|
48 | 48 | <div id="menubar"> |
|
49 | 49 | <div class="navbar"> |
|
50 | 50 | <div class="navbar-inner"> |
|
51 | 51 | <div class="container"> |
|
52 | <ul id="menus" class="nav"> | |
|
52 | <ul id="menus" class="nav nav-pills"> | |
|
53 | 53 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a> |
|
54 | 54 | <ul id="file_menu" class="dropdown-menu"> |
|
55 | 55 | <li id="new_notebook" |
|
56 | 56 | title="Make a new notebook (Opens a new window)"> |
|
57 | 57 | <a href="#">New</a></li> |
|
58 | 58 | <li id="open_notebook" |
|
59 | 59 | title="Opens a new window with the Dashboard view"> |
|
60 | 60 | <a href="#">Open...</a></li> |
|
61 | 61 | <!-- <hr/> --> |
|
62 | 62 | <li class="divider"></li> |
|
63 | 63 | <li id="copy_notebook" |
|
64 | 64 | title="Open a copy of this notebook's contents and start a new kernel"> |
|
65 | 65 | <a href="#">Make a Copy...</a></li> |
|
66 | 66 | <li id="rename_notebook"><a href="#">Rename...</a></li> |
|
67 | 67 | <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li> |
|
68 | 68 | <!-- <hr/> --> |
|
69 | 69 | <li class="divider"></li> |
|
70 | 70 | <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a> |
|
71 | 71 | <ul class="dropdown-menu"> |
|
72 | 72 | <li><a href="#"></a></li> |
|
73 | 73 | <li><a href="#"></a></li> |
|
74 | 74 | <li><a href="#"></a></li> |
|
75 | 75 | <li><a href="#"></a></li> |
|
76 | 76 | <li><a href="#"></a></li> |
|
77 | 77 | </ul> |
|
78 | 78 | </li> |
|
79 | 79 | <li class="divider"></li> |
|
80 | 80 | <li id="print_preview"><a href="#">Print Preview</a></li> |
|
81 | 81 | <li class="dropdown-submenu"><a href="#">Download as</a> |
|
82 | 82 | <ul class="dropdown-menu"> |
|
83 | 83 | <li id="download_ipynb"><a href="#">IPython Notebook (.ipynb)</a></li> |
|
84 | 84 | <li id="download_py"><a href="#">Python (.py)</a></li> |
|
85 | 85 | <li id="download_html"><a href="#">HTML (.html)</a></li> |
|
86 | 86 | <li id="download_rst"><a href="#">reST (.rst)</a></li> |
|
87 | 87 | <li id="download_pdf"><a href="#">PDF (.pdf)</a></li> |
|
88 | 88 | </ul> |
|
89 | 89 | </li> |
|
90 | 90 | <li class="divider"></li> |
|
91 | 91 | <li id="trust_notebook" |
|
92 | 92 | title="Trust the output of this notebook"> |
|
93 | 93 | <a href="#" >Trust Notebook</a></li> |
|
94 | 94 | <li class="divider"></li> |
|
95 | 95 | <li id="kill_and_exit" |
|
96 | 96 | title="Shutdown this notebook's kernel, and close this window"> |
|
97 | 97 | <a href="#" >Close and halt</a></li> |
|
98 | 98 | </ul> |
|
99 | 99 | </li> |
|
100 | 100 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a> |
|
101 | 101 | <ul id="edit_menu" class="dropdown-menu"> |
|
102 | 102 | <li id="cut_cell"><a href="#">Cut Cell</a></li> |
|
103 | 103 | <li id="copy_cell"><a href="#">Copy Cell</a></li> |
|
104 | 104 | <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li> |
|
105 | 105 | <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li> |
|
106 | 106 | <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell & Replace</a></li> |
|
107 | 107 | <li id="delete_cell"><a href="#">Delete Cell</a></li> |
|
108 | 108 | <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li> |
|
109 | 109 | <li class="divider"></li> |
|
110 | 110 | <li id="split_cell"><a href="#">Split Cell</a></li> |
|
111 | 111 | <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li> |
|
112 | 112 | <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li> |
|
113 | 113 | <li class="divider"></li> |
|
114 | 114 | <li id="move_cell_up"><a href="#">Move Cell Up</a></li> |
|
115 | 115 | <li id="move_cell_down"><a href="#">Move Cell Down</a></li> |
|
116 | 116 | <li class="divider"></li> |
|
117 | 117 | <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li> |
|
118 | 118 | </ul> |
|
119 | 119 | </li> |
|
120 | 120 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a> |
|
121 | 121 | <ul id="view_menu" class="dropdown-menu"> |
|
122 | 122 | <li id="toggle_header" |
|
123 | 123 | title="Show/Hide the IPython Notebook logo and notebook title (above menu bar)"> |
|
124 | 124 | <a href="#">Toggle Header</a></li> |
|
125 | 125 | <li id="toggle_toolbar" |
|
126 | 126 | title="Show/Hide the action icons (below menu bar)"> |
|
127 | 127 | <a href="#">Toggle Toolbar</a></li> |
|
128 | 128 | </ul> |
|
129 | 129 | </li> |
|
130 | 130 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a> |
|
131 | 131 | <ul id="insert_menu" class="dropdown-menu"> |
|
132 | 132 | <li id="insert_cell_above" |
|
133 | 133 | title="Insert an empty Code cell above the currently active cell"> |
|
134 | 134 | <a href="#">Insert Cell Above</a></li> |
|
135 | 135 | <li id="insert_cell_below" |
|
136 | 136 | title="Insert an empty Code cell below the currently active cell"> |
|
137 | 137 | <a href="#">Insert Cell Below</a></li> |
|
138 | 138 | </ul> |
|
139 | 139 | </li> |
|
140 | 140 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a> |
|
141 | 141 | <ul id="cell_menu" class="dropdown-menu"> |
|
142 | 142 | <li id="run_cell" title="Run this cell, and move cursor to the next one"> |
|
143 | 143 | <a href="#">Run</a></li> |
|
144 | 144 | <li id="run_cell_select_below" title="Run this cell, select below"> |
|
145 | 145 | <a href="#">Run and Select Below</a></li> |
|
146 | 146 | <li id="run_cell_insert_below" title="Run this cell, insert below"> |
|
147 | 147 | <a href="#">Run and Insert Below</a></li> |
|
148 | 148 | <li id="run_all_cells" title="Run all cells in the notebook"> |
|
149 | 149 | <a href="#">Run All</a></li> |
|
150 | 150 | <li id="run_all_cells_above" title="Run all cells above (but not including) this cell"> |
|
151 | 151 | <a href="#">Run All Above</a></li> |
|
152 | 152 | <li id="run_all_cells_below" title="Run this cell and all cells below it"> |
|
153 | 153 | <a href="#">Run All Below</a></li> |
|
154 | 154 | <li class="divider"></li> |
|
155 | 155 | <li id="change_cell_type" class="dropdown-submenu" |
|
156 | 156 | title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells"> |
|
157 | 157 | <a href="#">Cell Type</a> |
|
158 | 158 | <ul class="dropdown-menu"> |
|
159 | 159 | <li id="to_code" |
|
160 | 160 | title="Contents will be sent to the kernel for execution, and output will display in the footer of cell"> |
|
161 | 161 | <a href="#">Code</a></li> |
|
162 | 162 | <li id="to_markdown" |
|
163 | 163 | title="Contents will be rendered as HTML and serve as explanatory text"> |
|
164 | 164 | <a href="#">Markdown</a></li> |
|
165 | 165 | <li id="to_raw" |
|
166 | 166 | title="Contents will pass through nbconvert unmodified"> |
|
167 | 167 | <a href="#">Raw NBConvert</a></li> |
|
168 | 168 | <li id="to_heading1"><a href="#">Heading 1</a></li> |
|
169 | 169 | <li id="to_heading2"><a href="#">Heading 2</a></li> |
|
170 | 170 | <li id="to_heading3"><a href="#">Heading 3</a></li> |
|
171 | 171 | <li id="to_heading4"><a href="#">Heading 4</a></li> |
|
172 | 172 | <li id="to_heading5"><a href="#">Heading 5</a></li> |
|
173 | 173 | <li id="to_heading6"><a href="#">Heading 6</a></li> |
|
174 | 174 | </ul> |
|
175 | 175 | </li> |
|
176 | 176 | <li class="divider"></li> |
|
177 | 177 | <li id="current_outputs" class="dropdown-submenu"><a href="#">Current Output</a> |
|
178 | 178 | <ul class="dropdown-menu"> |
|
179 | 179 | <li id="toggle_current_output" |
|
180 | 180 | title="Hide/Show the output of the current cell"> |
|
181 | 181 | <a href="#">Toggle</a> |
|
182 | 182 | </li> |
|
183 | 183 | <li id="toggle_current_output_scroll" |
|
184 | 184 | title="Scroll the output of the current cell"> |
|
185 | 185 | <a href="#">Toggle Scrolling</a> |
|
186 | 186 | </li> |
|
187 | 187 | <li id="clear_current_output" |
|
188 | 188 | title="Clear the output of the current cell"> |
|
189 | 189 | <a href="#">Clear</a> |
|
190 | 190 | </li> |
|
191 | 191 | </ul> |
|
192 | 192 | </li> |
|
193 | 193 | <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a> |
|
194 | 194 | <ul class="dropdown-menu"> |
|
195 | 195 | <li id="toggle_all_output" |
|
196 | 196 | title="Hide/Show the output of all cells"> |
|
197 | 197 | <a href="#">Toggle</a> |
|
198 | 198 | </li> |
|
199 | 199 | <li id="toggle_all_output_scroll" |
|
200 | 200 | title="Scroll the output of all cells"> |
|
201 | 201 | <a href="#">Toggle Scrolling</a> |
|
202 | 202 | </li> |
|
203 | 203 | <li id="clear_all_output" |
|
204 | 204 | title="Clear the output of all cells"> |
|
205 | 205 | <a href="#">Clear</a> |
|
206 | 206 | </li> |
|
207 | 207 | </ul> |
|
208 | 208 | </li> |
|
209 | 209 | </ul> |
|
210 | 210 | </li> |
|
211 | 211 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a> |
|
212 | 212 | <ul id="kernel_menu" class="dropdown-menu"> |
|
213 | 213 | <li id="int_kernel" |
|
214 | 214 | title="Send KeyboardInterrupt (CTRL-C) to the Kernel"> |
|
215 | 215 | <a href="#">Interrupt</a></li> |
|
216 | 216 | <li id="restart_kernel" |
|
217 | 217 | title="Restart the Kernel"> |
|
218 | 218 | <a href="#">Restart</a></li> |
|
219 | 219 | </ul> |
|
220 | 220 | </li> |
|
221 | 221 | <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a> |
|
222 | 222 | <ul id="help_menu" class="dropdown-menu"> |
|
223 | 223 | <li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li> |
|
224 | 224 | <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li> |
|
225 | 225 | <li class="divider"></li> |
|
226 | 226 | {% set |
|
227 | 227 | sections = ( |
|
228 | 228 | ( |
|
229 | 229 | ("http://ipython.org/documentation.html","IPython Help",True), |
|
230 | 230 | ("http://nbviewer.ipython.org/github/ipython/ipython/tree/2.x/examples/Index.ipynb", "Notebook Help", True), |
|
231 | 231 | ),( |
|
232 | 232 | ("http://docs.python.org","Python",True), |
|
233 | 233 | ("http://help.github.com/articles/github-flavored-markdown","Markdown",True), |
|
234 | 234 | ("http://docs.scipy.org/doc/numpy/reference/","NumPy",True), |
|
235 | 235 | ("http://docs.scipy.org/doc/scipy/reference/","SciPy",True), |
|
236 | 236 | ("http://matplotlib.org/contents.html","Matplotlib",True), |
|
237 | 237 | ("http://docs.sympy.org/latest/index.html","SymPy",True), |
|
238 | 238 | ("http://pandas.pydata.org/pandas-docs/stable/","pandas", True) |
|
239 | 239 | ) |
|
240 | 240 | ) |
|
241 | 241 | %} |
|
242 | 242 | |
|
243 | 243 | {% for helplinks in sections %} |
|
244 | 244 | {% for link in helplinks %} |
|
245 | 245 | <li><a href="{{link[0]}}" {{'target="_blank" title="Opens in a new window"' if link[2]}}> |
|
246 | 246 | {{'<i class="icon-external-link menu-icon pull-right"></i>' if link[2]}} |
|
247 | 247 | {{link[1]}} |
|
248 | 248 | </a></li> |
|
249 | 249 | {% endfor %} |
|
250 | 250 | {% if not loop.last %} |
|
251 | 251 | <li class="divider"></li> |
|
252 | 252 | {% endif %} |
|
253 | 253 | {% endfor %} |
|
254 | 254 | </li> |
|
255 | 255 | </ul> |
|
256 | 256 | </li> |
|
257 | 257 | </ul> |
|
258 | 258 | <div id="kernel_indicator" class="indicator_area pull-right"> |
|
259 | 259 | <i id="kernel_indicator_icon"></i> |
|
260 | 260 | </div> |
|
261 | 261 | <div id="modal_indicator" class="indicator_area pull-right"> |
|
262 | 262 | <i id="modal_indicator_icon"></i> |
|
263 | 263 | </div> |
|
264 | 264 | <div id="notification_area"></div> |
|
265 | 265 | </div> |
|
266 | 266 | </div> |
|
267 | 267 | </div> |
|
268 | 268 | </div> |
|
269 | 269 | <div id="maintoolbar" class="navbar"> |
|
270 | 270 | <div class="toolbar-inner navbar-inner navbar-nobg"> |
|
271 | 271 | <div id="maintoolbar-container" class="container"></div> |
|
272 | 272 | </div> |
|
273 | 273 | </div> |
|
274 | 274 | </div> |
|
275 | 275 | |
|
276 | 276 | <div id="ipython-main-app"> |
|
277 | 277 | |
|
278 | 278 | <div id="notebook_panel"> |
|
279 | 279 | <div id="notebook"></div> |
|
280 | 280 | <div id="pager_splitter"></div> |
|
281 | 281 | <div id="pager"> |
|
282 | 282 | <div id='pager_button_area'> |
|
283 | 283 | </div> |
|
284 | 284 | <div id="pager-container" class="container"></div> |
|
285 | 285 | </div> |
|
286 | 286 | </div> |
|
287 | 287 | |
|
288 | 288 | </div> |
|
289 | 289 | <div id='tooltip' class='ipython_tooltip' style='display:none'></div> |
|
290 | 290 | |
|
291 | 291 | |
|
292 | 292 | {% endblock %} |
|
293 | 293 | |
|
294 | 294 | |
|
295 | 295 | {% block script %} |
|
296 | 296 | |
|
297 | 297 | {{super()}} |
|
298 | 298 | |
|
299 | 299 | <script src="{{ static_url("components/google-caja/html-css-sanitizer-minified.js") }}" charset="utf-8"></script> |
|
300 | 300 | <script src="{{ static_url("components/codemirror/lib/codemirror.js") }}" charset="utf-8"></script> |
|
301 | 301 | <script type="text/javascript"> |
|
302 | 302 | CodeMirror.modeURL = "{{ static_url("components/codemirror/mode/%N/%N.js", include_version=False) }}"; |
|
303 | 303 | </script> |
|
304 | 304 | <script src="{{ static_url("components/codemirror/addon/mode/loadmode.js") }}" charset="utf-8"></script> |
|
305 | 305 | <script src="{{ static_url("components/codemirror/addon/mode/multiplex.js") }}" charset="utf-8"></script> |
|
306 | 306 | <script src="{{ static_url("components/codemirror/addon/mode/overlay.js") }}" charset="utf-8"></script> |
|
307 | 307 | <script src="{{ static_url("components/codemirror/addon/edit/matchbrackets.js") }}" charset="utf-8"></script> |
|
308 | 308 | <script src="{{ static_url("components/codemirror/addon/edit/closebrackets.js") }}" charset="utf-8"></script> |
|
309 | 309 | <script src="{{ static_url("components/codemirror/addon/comment/comment.js") }}" charset="utf-8"></script> |
|
310 | 310 | <script src="{{ static_url("components/codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script> |
|
311 | 311 | <script src="{{ static_url("components/codemirror/mode/xml/xml.js") }}" charset="utf-8"></script> |
|
312 | 312 | <script src="{{ static_url("components/codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script> |
|
313 | 313 | <script src="{{ static_url("components/codemirror/mode/css/css.js") }}" charset="utf-8"></script> |
|
314 | 314 | <script src="{{ static_url("components/codemirror/mode/rst/rst.js") }}" charset="utf-8"></script> |
|
315 | 315 | <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script> |
|
316 | 316 | <script src="{{ static_url("components/codemirror/mode/python/python.js") }}" charset="utf-8"></script> |
|
317 | 317 | <script src="{{ static_url("notebook/js/codemirror-ipython.js") }}" charset="utf-8"></script> |
|
318 | 318 | <script src="{{ static_url("notebook/js/codemirror-ipythongfm.js") }}" charset="utf-8"></script> |
|
319 | 319 | |
|
320 | 320 | <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script> |
|
321 | 321 | |
|
322 | 322 | <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script> |
|
323 | 323 | |
|
324 | 324 | <script src="{{ static_url("base/js/events.js") }}" type="text/javascript" charset="utf-8"></script> |
|
325 | 325 | <script src="{{ static_url("base/js/utils.js") }}" type="text/javascript" charset="utf-8"></script> |
|
326 | 326 | <script src="{{ static_url("base/js/keyboard.js") }}" type="text/javascript" charset="utf-8"></script> |
|
327 | 327 | <script src="{{ static_url("base/js/security.js") }}" type="text/javascript" charset="utf-8"></script> |
|
328 | 328 | <script src="{{ static_url("base/js/dialog.js") }}" type="text/javascript" charset="utf-8"></script> |
|
329 | 329 | <script src="{{ static_url("services/kernels/js/kernel.js") }}" type="text/javascript" charset="utf-8"></script> |
|
330 | 330 | <script src="{{ static_url("services/kernels/js/comm.js") }}" type="text/javascript" charset="utf-8"></script> |
|
331 | 331 | <script src="{{ static_url("services/sessions/js/session.js") }}" type="text/javascript" charset="utf-8"></script> |
|
332 | 332 | <script src="{{ static_url("notebook/js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script> |
|
333 | 333 | <script src="{{ static_url("notebook/js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script> |
|
334 | 334 | <script src="{{ static_url("notebook/js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script> |
|
335 | 335 | <script src="{{ static_url("notebook/js/cell.js") }}" type="text/javascript" charset="utf-8"></script> |
|
336 | 336 | <script src="{{ static_url("notebook/js/celltoolbar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
337 | 337 | <script src="{{ static_url("notebook/js/codecell.js") }}" type="text/javascript" charset="utf-8"></script> |
|
338 | 338 | <script src="{{ static_url("notebook/js/completer.js") }}" type="text/javascript" charset="utf-8"></script> |
|
339 | 339 | <script src="{{ static_url("notebook/js/textcell.js") }}" type="text/javascript" charset="utf-8"></script> |
|
340 | 340 | <script src="{{ static_url("notebook/js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script> |
|
341 | 341 | <script src="{{ static_url("notebook/js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script> |
|
342 | 342 | <script src="{{ static_url("notebook/js/pager.js") }}" type="text/javascript" charset="utf-8"></script> |
|
343 | 343 | <script src="{{ static_url("notebook/js/menubar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
344 | 344 | <script src="{{ static_url("notebook/js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
345 | 345 | <script src="{{ static_url("notebook/js/maintoolbar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
346 | 346 | <script src="{{ static_url("notebook/js/notebook.js") }}" type="text/javascript" charset="utf-8"></script> |
|
347 | 347 | <script src="{{ static_url("notebook/js/keyboardmanager.js") }}" type="text/javascript" charset="utf-8"></script> |
|
348 | 348 | <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script> |
|
349 | 349 | <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script> |
|
350 | 350 | <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script> |
|
351 | 351 | <script src="{{ static_url("notebook/js/tour.js") }}" type="text/javascript" charset="utf-8"></script> |
|
352 | 352 | |
|
353 | 353 | <script src="{{ static_url("notebook/js/config.js") }}" type="text/javascript" charset="utf-8"></script> |
|
354 | 354 | <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script> |
|
355 | 355 | |
|
356 | 356 | <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script> |
|
357 | 357 | |
|
358 | 358 | <script src="{{ static_url("notebook/js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script> |
|
359 | 359 | <script src="{{ static_url("notebook/js/celltoolbarpresets/rawcell.js") }}" type="text/javascript" charset="utf-8"></script> |
|
360 | 360 | <script src="{{ static_url("notebook/js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script> |
|
361 | 361 | |
|
362 | 362 | {% endblock %} |
General Comments 0
You need to be logged in to leave comments.
Login now